Improve Axis integration (#36205)

* Improve configuration

* Read new properties for basic device information
Improve tests by mocking less improving stability of tests

* Clean up in device tests

* Support new port management api

* Improve initializing data

* Bump dependency to v28
This commit is contained in:
Robert Svensson authored and GitHub committed 2020-05-31 20:00:15 +02:00
1 parent 6ed68d8ced
commit 01d9366299
10 files changed
+215 -152

No files matched your search

+2 -3
View File
@@ -1,7 +1,6 @@
"""Support for Axis switches."""
from axis.event_stream import CLASS_OUTPUT
from axis.port_cgi import ACTION_HIGH, ACTION_LOW
from homeassistant.components.switch import SwitchEntity
from homeassistant.core import callback
@@ -39,13 +38,13 @@ class AxisSwitch(AxisEventBase, SwitchEntity):
async def async_turn_on(self, **kwargs):
"""Turn on switch."""
await self.hass.async_add_executor_job(
self.device.api.vapix.ports[self.event.id].action, ACTION_HIGH
self.device.api.vapix.ports[self.event.id].close
)
async def async_turn_off(self, **kwargs):
"""Turn off switch."""
await self.hass.async_add_executor_job(
self.device.api.vapix.ports[self.event.id].action, ACTION_LOW
self.device.api.vapix.ports[self.event.id].open
)
@property