Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion homeassistant/components/opentherm_gw/binary_sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@ async def async_will_remove_from_hass(self):
)
self._unsub_updates()

@property
def available(self):
"""Return availability of the sensor."""
return self._state is not None

@property
def entity_registry_enabled_default(self):
"""Disable binary_sensors by default."""
Expand All @@ -68,7 +73,8 @@ def entity_registry_enabled_default(self):
@callback
def receive_report(self, status):
"""Handle status updates from the component."""
self._state = bool(status.get(self._var))
state = status.get(self._var)
self._state = None if state is None else bool(state)
self.async_write_ha_state()

@property
Expand Down
7 changes: 7 additions & 0 deletions homeassistant/components/opentherm_gw/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ def __init__(self, gw_dev, options):
self.friendly_name = gw_dev.name
self.floor_temp = options.get(CONF_FLOOR_TEMP, DEFAULT_FLOOR_TEMP)
self.temp_precision = options.get(CONF_PRECISION, DEFAULT_PRECISION)
self._available = False
self._current_operation = None
self._current_temperature = None
self._hvac_mode = HVAC_MODE_HEAT
Expand Down Expand Up @@ -101,6 +102,7 @@ async def async_will_remove_from_hass(self):
@callback
def receive_report(self, status):
"""Receive and handle a new report from the Gateway."""
self._available = bool(status)
ch_active = status.get(gw_vars.DATA_SLAVE_CH_ACTIVE)
flame_on = status.get(gw_vars.DATA_SLAVE_FLAME_ON)
cooling_active = status.get(gw_vars.DATA_SLAVE_COOLING_ACTIVE)
Expand Down Expand Up @@ -146,6 +148,11 @@ def receive_report(self, status):
)
self.async_write_ha_state()

@property
def available(self):
"""Return availability of the sensor."""
return self._available

@property
def name(self):
"""Return the friendly name."""
Expand Down
5 changes: 5 additions & 0 deletions homeassistant/components/opentherm_gw/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@ async def async_will_remove_from_hass(self):
_LOGGER.debug("Removing OpenTherm Gateway sensor %s", self._friendly_name)
self._unsub_updates()

@property
def available(self):
"""Return availability of the sensor."""
return self._value is not None

@property
def entity_registry_enabled_default(self):
"""Disable sensors by default."""
Expand Down