mirror of
https://github.com/home-assistant/core.git
synced 2025-07-16 17:57:11 +00:00
Make Axis non-privileged users work again (#36731)
This commit is contained in:
parent
65e9e4a2f3
commit
78af0a4705
@ -5,6 +5,7 @@ import asyncio
|
|||||||
import async_timeout
|
import async_timeout
|
||||||
import axis
|
import axis
|
||||||
from axis.configuration import Configuration
|
from axis.configuration import Configuration
|
||||||
|
from axis.errors import Unauthorized
|
||||||
from axis.event_stream import OPERATION_INITIALIZED
|
from axis.event_stream import OPERATION_INITIALIZED
|
||||||
from axis.mqtt import mqtt_json_to_event
|
from axis.mqtt import mqtt_json_to_event
|
||||||
from axis.streammanager import SIGNAL_PLAYING, STATE_STOPPED
|
from axis.streammanager import SIGNAL_PLAYING, STATE_STOPPED
|
||||||
@ -153,9 +154,13 @@ class AxisNetworkDevice:
|
|||||||
|
|
||||||
async def use_mqtt(self, hass: HomeAssistant, component: str) -> None:
|
async def use_mqtt(self, hass: HomeAssistant, component: str) -> None:
|
||||||
"""Set up to use MQTT."""
|
"""Set up to use MQTT."""
|
||||||
status = await hass.async_add_executor_job(
|
try:
|
||||||
self.api.vapix.mqtt.get_client_status
|
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":
|
if status.get("data", {}).get("status", {}).get("state") == "active":
|
||||||
self.listeners.append(
|
self.listeners.append(
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
"name": "Axis",
|
"name": "Axis",
|
||||||
"config_flow": true,
|
"config_flow": true,
|
||||||
"documentation": "https://www.home-assistant.io/integrations/axis",
|
"documentation": "https://www.home-assistant.io/integrations/axis",
|
||||||
"requirements": ["axis==29"],
|
"requirements": ["axis==30"],
|
||||||
"zeroconf": ["_axis-video._tcp.local."],
|
"zeroconf": ["_axis-video._tcp.local."],
|
||||||
"after_dependencies": ["mqtt"],
|
"after_dependencies": ["mqtt"],
|
||||||
"codeowners": ["@Kane610"]
|
"codeowners": ["@Kane610"]
|
||||||
|
@ -306,7 +306,7 @@ avea==1.4
|
|||||||
avri-api==0.1.7
|
avri-api==0.1.7
|
||||||
|
|
||||||
# homeassistant.components.axis
|
# homeassistant.components.axis
|
||||||
axis==29
|
axis==30
|
||||||
|
|
||||||
# homeassistant.components.azure_event_hub
|
# homeassistant.components.azure_event_hub
|
||||||
azure-eventhub==5.1.0
|
azure-eventhub==5.1.0
|
||||||
|
@ -150,7 +150,7 @@ av==8.0.2
|
|||||||
avri-api==0.1.7
|
avri-api==0.1.7
|
||||||
|
|
||||||
# homeassistant.components.axis
|
# homeassistant.components.axis
|
||||||
axis==29
|
axis==30
|
||||||
|
|
||||||
# homeassistant.components.homekit
|
# homeassistant.components.homekit
|
||||||
base36==0.1.1
|
base36==0.1.1
|
||||||
|
Loading…
x
Reference in New Issue
Block a user