Make Axis non-privileged users work again (#36731)

pull/36756/head
Robert Svensson 2020-06-13 12:35:52 +02:00 committed by Bram Kragten
parent 66ad69bff3
commit 16d045aa9f
4 changed files with 11 additions and 6 deletions

View File

@ -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(

View File

@ -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"]

View File

@ -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

View File

@ -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