diff --git a/Gemfile.lock b/Gemfile.lock index 3a2c827..262481b 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -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) @@ -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) diff --git a/exe/bwa_mqtt_bridge b/exe/bwa_mqtt_bridge index baeb6c7..5323981 100755 --- a/exe/bwa_mqtt_bridge +++ b/exe/bwa_mqtt_bridge @@ -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, @@ -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? @@ -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 diff --git a/lib/bwa/version.rb b/lib/bwa/version.rb index cb0113d..8ddb324 100644 --- a/lib/bwa/version.rb +++ b/lib/bwa/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module BWA - VERSION = "2.2.1" + VERSION = "2.3.0" end