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
|
@ -500,7 +500,7 @@ class SimpliSafe:
|
||||||
|
|
||||||
async def async_update_system(system):
|
async def async_update_system(system):
|
||||||
"""Update a system."""
|
"""Update a system."""
|
||||||
await system.update(cached=False)
|
await system.update(cached=system.version != 3)
|
||||||
self._async_process_new_notifications(system)
|
self._async_process_new_notifications(system)
|
||||||
|
|
||||||
tasks = [async_update_system(system) for system in self.systems.values()]
|
tasks = [async_update_system(system) for system in self.systems.values()]
|
||||||
|
|
|
@ -12,7 +12,7 @@ from homeassistant.components.binary_sensor import (
|
||||||
from homeassistant.core import callback
|
from homeassistant.core import callback
|
||||||
|
|
||||||
from . import SimpliSafeEntity
|
from . import SimpliSafeEntity
|
||||||
from .const import DATA_CLIENT, DOMAIN
|
from .const import DATA_CLIENT, DOMAIN, LOGGER
|
||||||
|
|
||||||
SUPPORTED_BATTERY_SENSOR_TYPES = [
|
SUPPORTED_BATTERY_SENSOR_TYPES = [
|
||||||
EntityTypes.carbon_monoxide,
|
EntityTypes.carbon_monoxide,
|
||||||
|
@ -48,9 +48,13 @@ SENSOR_MODELS = {
|
||||||
async def async_setup_entry(hass, entry, async_add_entities):
|
async def async_setup_entry(hass, entry, async_add_entities):
|
||||||
"""Set up SimpliSafe binary sensors based on a config entry."""
|
"""Set up SimpliSafe binary sensors based on a config entry."""
|
||||||
simplisafe = hass.data[DOMAIN][DATA_CLIENT][entry.entry_id]
|
simplisafe = hass.data[DOMAIN][DATA_CLIENT][entry.entry_id]
|
||||||
|
|
||||||
sensors = []
|
sensors = []
|
||||||
|
|
||||||
for system in simplisafe.systems.values():
|
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():
|
for sensor in system.sensors.values():
|
||||||
if sensor.type in SUPPORTED_SENSOR_TYPES:
|
if sensor.type in SUPPORTED_SENSOR_TYPES:
|
||||||
sensors.append(SimpliSafeBinarySensor(simplisafe, system, sensor))
|
sensors.append(SimpliSafeBinarySensor(simplisafe, system, sensor))
|
||||||
|
|
|
@ -5,21 +5,24 @@ from homeassistant.const import DEVICE_CLASS_TEMPERATURE, TEMP_FAHRENHEIT
|
||||||
from homeassistant.core import callback
|
from homeassistant.core import callback
|
||||||
|
|
||||||
from . import SimpliSafeEntity
|
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):
|
async def async_setup_entry(hass, entry, async_add_entities):
|
||||||
"""Set up SimpliSafe freeze sensors based on a config entry."""
|
"""Set up SimpliSafe freeze sensors based on a config entry."""
|
||||||
simplisafe = hass.data[DOMAIN][DATA_CLIENT][entry.entry_id]
|
simplisafe = hass.data[DOMAIN][DATA_CLIENT][entry.entry_id]
|
||||||
|
sensors = []
|
||||||
|
|
||||||
async_add_entities(
|
for system in simplisafe.systems.values():
|
||||||
[
|
if system.version == 2:
|
||||||
SimplisafeFreezeSensor(simplisafe, system, sensor)
|
LOGGER.info("Skipping sensor setup for V2 system: %s", system.system_id)
|
||||||
for system in simplisafe.systems.values()
|
continue
|
||||||
for sensor in system.sensors.values()
|
|
||||||
if sensor.type == EntityTypes.temperature
|
for sensor in system.sensors.values():
|
||||||
]
|
if sensor.type == EntityTypes.temperature:
|
||||||
)
|
sensors.append(SimplisafeFreezeSensor(simplisafe, system, sensor))
|
||||||
|
|
||||||
|
async_add_entities(sensors)
|
||||||
|
|
||||||
|
|
||||||
class SimplisafeFreezeSensor(SimpliSafeEntity):
|
class SimplisafeFreezeSensor(SimpliSafeEntity):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue