ScreenLogic cleanups (#48136)

* ScreenLogic cleanup.
Bump screenlogicpy to 0.2.0.
Move heating functions from water_heater to climate platform.
Address notes from original PR.

* Fix temperature attribute

* Addressing notes.
Bump screenlogicpy to 0.2.1.
Made device_types constants.
Made (known) equipment flags constants.
Used dict.get() in places where None is the default.
Return fast with good _last_preset.

* Update homeassistant/components/screenlogic/climate.py

Let base entity handle state property.

Co-authored-by: J. Nick Koston <nick@koston.org>

* Patch integration setup functions.

* Exception, ATTR_TEMPERATURE notes

Co-authored-by: J. Nick Koston <nick@koston.org>
This commit is contained in:
Kevin Worrel 2021-03-21 03:56:46 -07:00 committed by GitHub
parent 346a724ac3
commit fb48fd7d10
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 354 additions and 194 deletions

View file

@ -19,7 +19,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
for switch in data["devices"]["switch"]:
entities.append(ScreenLogicSwitch(coordinator, switch))
async_add_entities(entities, True)
async_add_entities(entities)
class ScreenLogicSwitch(ScreenlogicEntity, SwitchEntity):
@ -47,17 +47,14 @@ class ScreenLogicSwitch(ScreenlogicEntity, SwitchEntity):
if await self.hass.async_add_executor_job(
self.gateway.set_circuit, self._data_key, circuit_value
):
_LOGGER.debug("Screenlogic turn %s %s", circuit_value, self._data_key)
_LOGGER.debug("Turn %s %s", self._data_key, circuit_value)
await self.coordinator.async_request_refresh()
else:
_LOGGER.info("Screenlogic turn %s %s error", circuit_value, self._data_key)
_LOGGER.warning(
"Failed to set_circuit %s %s", self._data_key, circuit_value
)
@property
def circuit(self):
"""Shortcut to access the circuit."""
return self.circuits_data[self._data_key]
@property
def circuits_data(self):
"""Shortcut to access the circuits data."""
return self.coordinator.data["circuits"]
return self.coordinator.data["circuits"][self._data_key]