mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 13:17:32 +00:00
Bump axis to v60 (#114544)
* Improve Axis MQTT support * Bump axis to v60
This commit is contained in:
parent
f08af5dc6d
commit
05d40fbc4c
@ -116,7 +116,7 @@ class AxisHub:
|
|||||||
if status.status.state == ClientState.ACTIVE:
|
if status.status.state == ClientState.ACTIVE:
|
||||||
self.config.entry.async_on_unload(
|
self.config.entry.async_on_unload(
|
||||||
await mqtt.async_subscribe(
|
await mqtt.async_subscribe(
|
||||||
hass, f"{self.api.vapix.serial_number}/#", self.mqtt_message
|
hass, f"{status.config.device_topic_prefix}/#", self.mqtt_message
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -124,7 +124,8 @@ class AxisHub:
|
|||||||
def mqtt_message(self, message: ReceiveMessage) -> None:
|
def mqtt_message(self, message: ReceiveMessage) -> None:
|
||||||
"""Receive Axis MQTT message."""
|
"""Receive Axis MQTT message."""
|
||||||
self.disconnect_from_stream()
|
self.disconnect_from_stream()
|
||||||
|
if message.topic.endswith("event/connection"):
|
||||||
|
return
|
||||||
event = mqtt_json_to_event(message.payload)
|
event = mqtt_json_to_event(message.payload)
|
||||||
self.api.event.handler(event)
|
self.api.event.handler(event)
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
"iot_class": "local_push",
|
"iot_class": "local_push",
|
||||||
"loggers": ["axis"],
|
"loggers": ["axis"],
|
||||||
"quality_scale": "platinum",
|
"quality_scale": "platinum",
|
||||||
"requirements": ["axis==59"],
|
"requirements": ["axis==60"],
|
||||||
"ssdp": [
|
"ssdp": [
|
||||||
{
|
{
|
||||||
"manufacturer": "AXIS"
|
"manufacturer": "AXIS"
|
||||||
|
@ -514,7 +514,7 @@ aurorapy==0.2.7
|
|||||||
# avion==0.10
|
# avion==0.10
|
||||||
|
|
||||||
# homeassistant.components.axis
|
# homeassistant.components.axis
|
||||||
axis==59
|
axis==60
|
||||||
|
|
||||||
# homeassistant.components.azure_event_hub
|
# homeassistant.components.azure_event_hub
|
||||||
azure-eventhub==5.11.1
|
azure-eventhub==5.11.1
|
||||||
|
@ -454,7 +454,7 @@ auroranoaa==0.0.3
|
|||||||
aurorapy==0.2.7
|
aurorapy==0.2.7
|
||||||
|
|
||||||
# homeassistant.components.axis
|
# homeassistant.components.axis
|
||||||
axis==59
|
axis==60
|
||||||
|
|
||||||
# homeassistant.components.azure_event_hub
|
# homeassistant.components.azure_event_hub
|
||||||
azure-eventhub==5.11.1
|
azure-eventhub==5.11.1
|
||||||
|
@ -74,6 +74,7 @@ MQTT_CLIENT_RESPONSE = {
|
|||||||
"status": {"state": "active", "connectionStatus": "Connected"},
|
"status": {"state": "active", "connectionStatus": "Connected"},
|
||||||
"config": {
|
"config": {
|
||||||
"server": {"protocol": "tcp", "host": "192.168.0.90", "port": 1883},
|
"server": {"protocol": "tcp", "host": "192.168.0.90", "port": 1883},
|
||||||
|
"deviceTopicPrefix": f"axis/{MAC}",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -91,9 +91,9 @@ async def test_device_support_mqtt(
|
|||||||
hass: HomeAssistant, mqtt_mock: MqttMockHAClient, setup_config_entry
|
hass: HomeAssistant, mqtt_mock: MqttMockHAClient, setup_config_entry
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Successful setup."""
|
"""Successful setup."""
|
||||||
mqtt_mock.async_subscribe.assert_called_with(f"{MAC}/#", mock.ANY, 0, "utf-8")
|
mqtt_mock.async_subscribe.assert_called_with(f"axis/{MAC}/#", mock.ANY, 0, "utf-8")
|
||||||
|
|
||||||
topic = f"{MAC}/event/tns:onvif/Device/tns:axis/Sensor/PIR/$source/sensor/0"
|
topic = f"axis/{MAC}/event/tns:onvif/Device/tns:axis/Sensor/PIR/$source/sensor/0"
|
||||||
message = (
|
message = (
|
||||||
b'{"timestamp": 1590258472044, "topic": "onvif:Device/axis:Sensor/PIR",'
|
b'{"timestamp": 1590258472044, "topic": "onvif:Device/axis:Sensor/PIR",'
|
||||||
b' "message": {"source": {"sensor": "0"}, "key": {}, "data": {"state": "1"}}}'
|
b' "message": {"source": {"sensor": "0"}, "key": {}, "data": {"state": "1"}}}'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user