Skip to content

Commit

Permalink
use water heater component instead of separate heating and temperatur…
Browse files Browse the repository at this point in the history
…e components
  • Loading branch information
ccutrer committed Jan 20, 2025
1 parent cad2256 commit 09cb373
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 7 deletions.
4 changes: 2 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
balboa_worldwide_app (2.2.1)
balboa_worldwide_app (2.3.0)
ccutrer-serialport (~> 1.0)
digest-crc (~> 0.4)
mqtt-homie-homeassistant (~> 1.0, >= 1.0.5)
Expand All @@ -17,7 +17,7 @@ GEM
ffi (~> 1.9, >= 1.9.3)
digest-crc (0.6.5)
rake (>= 12.0.0, < 14.0.0)
ffi (1.17.1)
ffi (1.17.1-x86_64-linux-gnu)
homie-mqtt (1.6.3)
mqtt-ccutrer (~> 1.0, >= 1.0.3)
ruby2_keywords (~> 0.0.5)
Expand Down
23 changes: 19 additions & 4 deletions exe/bwa_mqtt_bridge
Original file line number Diff line number Diff line change
Expand Up @@ -217,10 +217,9 @@ class MQTTBridge
spa.property("heating",
"Heating",
:boolean,
@bwa.heating?,
hass: {
binary_sensor: { device_class: :running, icon: "mdi:hot-tub" }
})
@bwa.heating?)
@homie.mqtt.unpublish_hass_binary_sensor("spa_heating", node_id: @homie.id)

spa.property("temperature-range",
"Temperature Range",
:enum,
Expand All @@ -236,6 +235,8 @@ class MQTTBridge
spa.property("target-temperature", "Target Water Temperature", :float, @bwa.target_temperature) do |value|
@bwa.target_temperature = value
end
@homie.mqtt.unpublish_hass_sensor("spa_current-temperature", node_id: @homie.id)
@homie.mqtt.unpublish_hass_sensor("spa_target-temperature", node_id: @homie.id)
update_temperature_scale

unless @bwa.configuration.blower.zero?
Expand Down Expand Up @@ -406,6 +407,20 @@ class MQTTBridge
@homie["spa"]["target-temperature"].hass_number(icon: "mdi:thermometer", step: 1)
end

@homie["spa"].hass_water_heater(
current_temperature_property: "current-temperature",
mode_property: "heating",
modes: %i[off electric],
mode_state_template: <<~JINJA,
{% if value == 'true' %}
electric
{% elif value == 'false' %}
off
{% endif %}
JINJA
temperature_property: "target-temperature",
icon: "mdi:hot-tub"
)
@homie["spa"]["current-temperature"].hass_sensor(device_class: :temperature)
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/bwa/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module BWA
VERSION = "2.2.1"
VERSION = "2.3.0"
end

0 comments on commit 09cb373

Please sign in to comment.