Fix bug for SimpliSafe 2 systems repeatedly saying "your settings have been synchronised" (#42197)
* Fix bug for SimpliSafe 2 systems * Improved loop and logging for SimpliSafe 2
This commit is contained in:
parent
57cd3058d9
commit
93841e3e0c
3 changed files with 19 additions and 12 deletions
|
@ -5,21 +5,24 @@ from homeassistant.const import DEVICE_CLASS_TEMPERATURE, TEMP_FAHRENHEIT
|
|||
from homeassistant.core import callback
|
||||
|
||||
from . import SimpliSafeEntity
|
||||
from .const import DATA_CLIENT, DOMAIN
|
||||
from .const import DATA_CLIENT, DOMAIN, LOGGER
|
||||
|
||||
|
||||
async def async_setup_entry(hass, entry, async_add_entities):
|
||||
"""Set up SimpliSafe freeze sensors based on a config entry."""
|
||||
simplisafe = hass.data[DOMAIN][DATA_CLIENT][entry.entry_id]
|
||||
sensors = []
|
||||
|
||||
async_add_entities(
|
||||
[
|
||||
SimplisafeFreezeSensor(simplisafe, system, sensor)
|
||||
for system in simplisafe.systems.values()
|
||||
for sensor in system.sensors.values()
|
||||
if sensor.type == EntityTypes.temperature
|
||||
]
|
||||
)
|
||||
for system in simplisafe.systems.values():
|
||||
if system.version == 2:
|
||||
LOGGER.info("Skipping sensor setup for V2 system: %s", system.system_id)
|
||||
continue
|
||||
|
||||
for sensor in system.sensors.values():
|
||||
if sensor.type == EntityTypes.temperature:
|
||||
sensors.append(SimplisafeFreezeSensor(simplisafe, system, sensor))
|
||||
|
||||
async_add_entities(sensors)
|
||||
|
||||
|
||||
class SimplisafeFreezeSensor(SimpliSafeEntity):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue