Make Axis non-privileged users work again (#36731)
parent
66ad69bff3
commit
16d045aa9f
|
@ -5,6 +5,7 @@ import asyncio
|
|||
import async_timeout
|
||||
import axis
|
||||
from axis.configuration import Configuration
|
||||
from axis.errors import Unauthorized
|
||||
from axis.event_stream import OPERATION_INITIALIZED
|
||||
from axis.mqtt import mqtt_json_to_event
|
||||
from axis.streammanager import SIGNAL_PLAYING, STATE_STOPPED
|
||||
|
@ -160,9 +161,13 @@ class AxisNetworkDevice:
|
|||
|
||||
async def use_mqtt(self, hass: HomeAssistant, component: str) -> None:
|
||||
"""Set up to use MQTT."""
|
||||
status = await hass.async_add_executor_job(
|
||||
self.api.vapix.mqtt.get_client_status
|
||||
)
|
||||
try:
|
||||
status = await hass.async_add_executor_job(
|
||||
self.api.vapix.mqtt.get_client_status
|
||||
)
|
||||
except Unauthorized:
|
||||
# This means the user has too low privileges
|
||||
status = {}
|
||||
|
||||
if status.get("data", {}).get("status", {}).get("state") == "active":
|
||||
self.listeners.append(
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
"name": "Axis",
|
||||
"config_flow": true,
|
||||
"documentation": "https://www.home-assistant.io/integrations/axis",
|
||||
"requirements": ["axis==29"],
|
||||
"requirements": ["axis==30"],
|
||||
"zeroconf": ["_axis-video._tcp.local."],
|
||||
"after_dependencies": ["mqtt"],
|
||||
"codeowners": ["@Kane610"]
|
||||
|
|
|
@ -306,7 +306,7 @@ avea==1.4
|
|||
avri-api==0.1.7
|
||||
|
||||
# homeassistant.components.axis
|
||||
axis==29
|
||||
axis==30
|
||||
|
||||
# homeassistant.components.azure_event_hub
|
||||
azure-eventhub==5.1.0
|
||||
|
|
|
@ -147,7 +147,7 @@ async-upnp-client==0.14.13
|
|||
av==8.0.2
|
||||
|
||||
# homeassistant.components.axis
|
||||
axis==29
|
||||
axis==30
|
||||
|
||||
# homeassistant.components.homekit
|
||||
base36==0.1.1
|
||||
|
|
Loading…
Reference in New Issue