Skip to content

Commit

Permalink
Merge pull request #8 from andrew-codechimp/slr1
Browse files Browse the repository at this point in the history
Conditional for SLR1x
  • Loading branch information
andrew-codechimp authored May 6, 2024
2 parents 5e5a141 + b0b62dd commit c074b77
Show file tree
Hide file tree
Showing 4 changed files with 389 additions and 141 deletions.
47 changes: 35 additions & 12 deletions custom_components/hive_local_thermostat/button.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,9 @@ def __init__(

def process_update(self, mqtt_data) -> None:
"""Update the state of the switch."""
if (self.hass is not None): # this is a hack to get around the fact that the entity is not yet initialized at first
if (
self.hass is not None
): # this is a hack to get around the fact that the entity is not yet initialized at first
self.async_schedule_update_ha_state()

async def async_press(self) -> None:
Expand All @@ -117,23 +119,44 @@ async def async_press(self) -> None:
+ r',"temperature_setpoint_hold_water":1}'
)
elif self.entity_description.key == "boost_heating":
payload = (
r'{"system_mode_heat":"emergency_heating","temperature_setpoint_hold_duration_heat":'
+ str(
int(
if self.entity_description.model == MODEL_SLR2:
payload = (
r'{"system_mode_heat":"emergency_heating","temperature_setpoint_hold_duration_heat":'
+ str(
int(
self.get_entity_value(
"heating_boost_duration", DEFAULT_HEATING_BOOST_MINUTES
)
)
)
+ r',"temperature_setpoint_hold_heat":1,"occupied_heating_setpoint_heat":'
+ str(
self.get_entity_value(
"heating_boost_duration", DEFAULT_HEATING_BOOST_MINUTES
"heating_boost_temperature",
DEFAULT_HEATING_BOOST_TEMPERATURE,
)
)
+ r"}"
)
+ r',"temperature_setpoint_hold_heat":1,"occupied_heating_setpoint_heat":'
+ str(
self.get_entity_value(
"heating_boost_temperature", DEFAULT_HEATING_BOOST_TEMPERATURE
else:
payload = (
r'{"system_mode":"emergency_heating","temperature_setpoint_hold_duration":'
+ str(
int(
self.get_entity_value(
"heating_boost_duration", DEFAULT_HEATING_BOOST_MINUTES
)
)
)
+ r',"temperature_setpoint_hold":1,"occupied_heating_setpoint":'
+ str(
self.get_entity_value(
"heating_boost_temperature",
DEFAULT_HEATING_BOOST_TEMPERATURE,
)
)
+ r"}"
)
+ r"}"
)

LOGGER.debug("Sending to {self._topic}/set message {payload}")
await mqtt_client.async_publish(self.hass, self._topic + "/set", payload)
Loading

0 comments on commit c074b77

Please sign in to comment.