diff --git a/changelog b/changelog index 166f0158..515dc0cc 100644 --- a/changelog +++ b/changelog @@ -1,4 +1,6 @@ aarlo/pyaarlo +0.7.4.3: + Fix important deprecated warning and errors. 0.7.4.2: Support 'synced' state 0.7.4.1: diff --git a/custom_components/aarlo/__init__.py b/custom_components/aarlo/__init__.py index 231a2df8..85701461 100644 --- a/custom_components/aarlo/__init__.py +++ b/custom_components/aarlo/__init__.py @@ -33,7 +33,7 @@ SIREN_STATE_KEY ) -__version__ = "0.7.4.2" +__version__ = "0.7.4.3" _LOGGER = logging.getLogger(__name__) diff --git a/custom_components/aarlo/alarm_control_panel.py b/custom_components/aarlo/alarm_control_panel.py index 110cde38..c36915ed 100644 --- a/custom_components/aarlo/alarm_control_panel.py +++ b/custom_components/aarlo/alarm_control_panel.py @@ -235,11 +235,10 @@ def icon(self): async def async_added_to_hass(self): """Register callbacks.""" - @callback def update_state(_device, attr, value): _LOGGER.debug("callback:" + self._name + ":" + attr + ":" + str(value)) self._state = self._get_state_from_ha(self._base.attribute(MODE_KEY)) - self.async_schedule_update_ha_state() + self.schedule_update_ha_state()() self._state = self._get_state_from_ha(self._base.attribute(MODE_KEY, ARMED)) self._base.add_attr_callback(MODE_KEY, update_state) @@ -316,7 +315,7 @@ def alarm_trigger(self, code=None): duration=self._trigger_time.total_seconds(), volume=self._alarm_volume, ) - self.async_schedule_update_ha_state() + self.schedule_update_ha_state() track_point_in_time( self.hass, self.async_update_ha_state, @@ -428,11 +427,10 @@ def icon(self): async def async_added_to_hass(self): """Register callbacks.""" - @callback def update_state(_device, attr, value): _LOGGER.debug("callback:" + self._name + ":" + attr + ":" + str(value)) self._state = self._get_state_from_ha(self._location.attribute(MODE_KEY)) - self.async_schedule_update_ha_state() + self.schedule_update_ha_state() self._state = self._get_state_from_ha(self._location.attribute(MODE_KEY, "Stand By")) self._location.add_attr_callback(MODE_KEY, update_state) diff --git a/custom_components/aarlo/binary_sensor.py b/custom_components/aarlo/binary_sensor.py index 2e8445e1..25bddd3a 100644 --- a/custom_components/aarlo/binary_sensor.py +++ b/custom_components/aarlo/binary_sensor.py @@ -108,12 +108,11 @@ def __init__(self, device, sensor_type): async def async_added_to_hass(self): """Register callbacks.""" - @callback def update_state(_device, attr, value): _LOGGER.debug("callback:" + self._name + ":" + attr + ":" + str(value)[:80]) if self._attr == attr: self._state = self.map_value(attr, value) - self.async_schedule_update_ha_state() + self.schedule_update_ha_state() if self._attr is not None: self._state = self.map_value(self._attr, self._device.attribute(self._attr)) diff --git a/custom_components/aarlo/camera.py b/custom_components/aarlo/camera.py index 9b1fd851..1ed02c0f 100644 --- a/custom_components/aarlo/camera.py +++ b/custom_components/aarlo/camera.py @@ -365,7 +365,6 @@ def __init__(self, camera, config, arlo, hass): async def async_added_to_hass(self): """Register callbacks.""" - @callback def update_state(_device, attr, value): _LOGGER.debug("callback:" + self._name + ":" + attr + ":" + str(value)[:80]) @@ -425,7 +424,7 @@ def update_state(_device, attr, value): img_file.write(value) # Signal changes. - self.async_schedule_update_ha_state() + self.schedule_update_ha_state() self._camera.add_attr_callback(ACTIVITY_STATE_KEY, update_state) self._camera.add_attr_callback(CHARGER_KEY, update_state) diff --git a/custom_components/aarlo/light.py b/custom_components/aarlo/light.py index defc625a..8f596a2b 100644 --- a/custom_components/aarlo/light.py +++ b/custom_components/aarlo/light.py @@ -83,14 +83,13 @@ def __init__(self, light): async def async_added_to_hass(self): """Register callbacks.""" - @callback def update_state(_light, attr, value): _LOGGER.debug("callback:" + self._name + ":" + attr + ":" + str(value)[:80]) if attr == LAMP_STATE_KEY: self._state = value if attr == BRIGHTNESS_KEY: self._brightness = value - self.async_schedule_update_ha_state() + self.schedule_update_ha_state() _LOGGER.info("ArloLight: %s registering callbacks", self._name) self._state = self._light.attribute(LAMP_STATE_KEY, default="off") @@ -205,14 +204,13 @@ def _set_light_mode(self, light_mode): async def async_added_to_hass(self): """Register callbacks.""" - @callback def update_attr(_light, attr, value): _LOGGER.debug("callback:" + self._name + ":" + attr + ":" + str(value)[:80]) if attr == LIGHT_BRIGHTNESS_KEY: self._brightness = value if attr == LIGHT_MODE_KEY: self._set_light_mode(value) - self.async_schedule_update_ha_state() + self.schedule_update_ha_state() _LOGGER.info("ArloNightLight: %s registering callbacks", self._name) @@ -331,11 +329,10 @@ def set_states(state): self._sleep_time = None self._sleep_time_rel = None - @callback def update_attr(_light, attr, value): _LOGGER.debug("callback:" + self._name + ":" + attr + ":" + str(value)[:80]) set_states(value) - self.async_schedule_update_ha_state() + self.schedule_update_ha_state() _LOGGER.info("ArloFloodLight: %s registering callbacks", self._name) floodlight = self._light.attribute(FLOODLIGHT_KEY, default={}) @@ -400,14 +397,13 @@ def __init__(self, camera): async def async_added_to_hass(self): """Register callbacks.""" - @callback def update_attr(_light, attr, value): _LOGGER.debug("callback:" + self._name + ":" + attr + ":" + str(value)[:80]) if attr == SPOTLIGHT_KEY: self._state = value if attr == SPOTLIGHT_BRIGHTNESS_KEY: self._brightness = value / 100 * 255 - self.async_schedule_update_ha_state() + self.schedule_update_ha_state() _LOGGER.info("ArloSpotlight: %s registering callbacks", self._name) diff --git a/custom_components/aarlo/manifest.json b/custom_components/aarlo/manifest.json index fd465b05..72667775 100644 --- a/custom_components/aarlo/manifest.json +++ b/custom_components/aarlo/manifest.json @@ -7,5 +7,5 @@ "iot_class": "cloud_push", "issue_tracker": "https://github.com/twrecked/hass-aarlo/issues", "requirements": ["unidecode","cloudscraper>=1.2.71", "paho-mqtt"], - "version": "0.7.4.2" + "version": "0.7.4.3" } diff --git a/custom_components/aarlo/media_player.py b/custom_components/aarlo/media_player.py index d65a40e1..83131725 100644 --- a/custom_components/aarlo/media_player.py +++ b/custom_components/aarlo/media_player.py @@ -92,7 +92,6 @@ def __init__(self, name, device): async def async_added_to_hass(self): """Register callbacks.""" - @callback def update_state(_device, attr, props): _LOGGER.info("callback:" + self._name + ":" + attr + ":" + str(props)[:80]) if attr == "status": @@ -117,7 +116,7 @@ def update_state(_device, attr, props): elif attr == "playlist": self._playlist = props - self.async_schedule_update_ha_state() + self.schedule_update_ha_state() self._device.add_attr_callback("config", update_state) self._device.add_attr_callback("speaker", update_state) diff --git a/custom_components/aarlo/pyaarlo/__init__.py b/custom_components/aarlo/pyaarlo/__init__.py index 6168b505..450224ab 100644 --- a/custom_components/aarlo/pyaarlo/__init__.py +++ b/custom_components/aarlo/pyaarlo/__init__.py @@ -46,7 +46,7 @@ _LOGGER = logging.getLogger("pyaarlo") -__version__ = "0.7.4.2" +__version__ = "0.7.4.3" class PyArlo(object): diff --git a/custom_components/aarlo/sensor.py b/custom_components/aarlo/sensor.py index de662d63..34e874c9 100644 --- a/custom_components/aarlo/sensor.py +++ b/custom_components/aarlo/sensor.py @@ -120,11 +120,10 @@ def __init__(self, arlo, device, sensor_type): async def async_added_to_hass(self): """Register callbacks.""" - @callback def update_state(_device, attr, value): _LOGGER.debug("callback:" + self._name + ":" + attr + ":" + str(value)[:80]) self._state = value - self.async_schedule_update_ha_state() + self.schedule_update_ha_state() if self._attr is not None: self._state = self._device.attribute(self._attr) diff --git a/custom_components/aarlo/switch.py b/custom_components/aarlo/switch.py index 16a951de..1b2db6ee 100644 --- a/custom_components/aarlo/switch.py +++ b/custom_components/aarlo/switch.py @@ -232,13 +232,12 @@ def __init__(self, config, device): async def async_added_to_hass(self): """Register callbacks.""" - @callback def update_state(_device, attr, value): _LOGGER.debug( "siren-callback:" + self._name + ":" + attr + ":" + str(value)[:80] ) self._state = value - self.async_schedule_update_ha_state() + self.schedule_update_ha_state() _LOGGER.debug("register siren callbacks for {}".format(self._device.name)) self._device.add_attr_callback(SIREN_STATE_KEY, update_state) @@ -280,7 +279,6 @@ def __init__(self, config, arlo, devices): async def async_added_to_hass(self): """Register callbacks.""" - @callback def update_state(_device, attr, value): _LOGGER.debug( "all-siren-callback:" + self._name + ":" + attr + ":" + str(value)[:80] @@ -292,7 +290,7 @@ def update_state(_device, attr, value): state = "on" self._state = state - self.async_schedule_update_ha_state() + self.schedule_update_ha_state() for device in self._devices: _LOGGER.debug("register all siren callbacks for {}".format(device.name)) @@ -331,10 +329,9 @@ def __init__(self, config, camera): async def async_added_to_hass(self): """Register callbacks.""" - @callback def update_state(_device, attr, value): _LOGGER.debug("callback:" + self._name + ":" + attr + ":" + str(value)[:80]) - self.async_schedule_update_ha_state() + self.schedule_update_ha_state() self._device.add_attr_callback(ACTIVITY_STATE_KEY, update_state) @@ -381,7 +378,6 @@ def turn_off(self, **kwargs): async def async_added_to_hass(self): """Register callbacks.""" - @callback def update_state(_device, attr, value): _LOGGER.debug( "silent-callback:" + self._name + ":" + attr + ":" + str(value)[:100] @@ -393,7 +389,7 @@ def update_state(_device, attr, value): else: self._state = self._doorbell.is_silenced - self.async_schedule_update_ha_state() + self.schedule_update_ha_state() self._doorbell.add_attr_callback(SILENT_MODE_KEY, update_state)