mirror of
https://github.com/home-assistant/core.git
synced 2025-11-08 18:39:30 +00:00
WIP: Refactor Axis component removing external dependencies (#9791)
* Async rewrite * Device and events now working with async core * More async than before * Methods have moved * Remove check if parameter serial number is available since library handles reconnection anyway and we can expect user to set up configuration correctly * Async rewrite * Device and events now working with async core * More async than before * Methods have moved * Remove check if parameter serial number is available since library handles reconnection anyway and we can expect user to set up configuration correctly * Serial number is the only unique identifier, checks are still needed * No async for setup_device * Bump axis to 13 in preparation of friday the 13th * Fix review comments * Removed async after some discussions with @armills. It wasn't possible to get past that aiohttp doesnt support digest auth, which makes it impossible to convert the full library at this point in time.
This commit is contained in:
committed by
Paulus Schoutsen
parent
e8f5445acc
commit
34368a6b69
@@ -21,19 +21,19 @@ _LOGGER = logging.getLogger(__name__)
|
||||
|
||||
def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||
"""Setup Axis device event."""
|
||||
add_devices([AxisBinarySensor(discovery_info['axis_event'], hass)], True)
|
||||
add_devices([AxisBinarySensor(hass, discovery_info)], True)
|
||||
|
||||
|
||||
class AxisBinarySensor(AxisDeviceEvent, BinarySensorDevice):
|
||||
"""Representation of a binary Axis event."""
|
||||
|
||||
def __init__(self, axis_event, hass):
|
||||
def __init__(self, hass, event_config):
|
||||
"""Initialize the binary sensor."""
|
||||
self.hass = hass
|
||||
self._state = False
|
||||
self._delay = axis_event.device_config(CONF_TRIGGER_TIME)
|
||||
self._delay = event_config[CONF_TRIGGER_TIME]
|
||||
self._timer = None
|
||||
AxisDeviceEvent.__init__(self, axis_event)
|
||||
AxisDeviceEvent.__init__(self, event_config)
|
||||
|
||||
@property
|
||||
def is_on(self):
|
||||
|
||||
Reference in New Issue
Block a user