Add availability to opentherm_gw entities (#32408)

* Add availability to opentherm_gw entities

* Address PR comment
This commit is contained in:
mvn23 2020-04-02 11:28:39 +02:00 committed by GitHub
parent be3cf52613
commit 58ae117bb4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 19 additions and 1 deletions

View file

@ -63,6 +63,7 @@ class OpenThermClimate(ClimateDevice):
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
@ -101,6 +102,7 @@ class OpenThermClimate(ClimateDevice):
@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)
@ -146,6 +148,11 @@ class OpenThermClimate(ClimateDevice):
)
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."""