diff --git a/pyoverkiz/client.py b/pyoverkiz/client.py index bea24303..b6c74589 100644 --- a/pyoverkiz/client.py +++ b/pyoverkiz/client.py @@ -28,6 +28,7 @@ SUPPORTED_SERVERS, ) from pyoverkiz.exceptions import ( + AccessDeniedToGatewayException, BadCredentialsException, CozyTouchBadCredentialsException, CozyTouchServiceException, @@ -48,6 +49,7 @@ TooManyConcurrentRequestsException, TooManyExecutionsException, TooManyRequestsException, + UnknownObjectException, UnknownUserException, ) from pyoverkiz.models import ( @@ -100,6 +102,7 @@ def __init__( username: str, password: str, server: OverkizServer, + token: str | None = None, session: ClientSession | None = None, ) -> None: """ @@ -114,6 +117,7 @@ def __init__( self.username = username self.password = password self.server = server + self._access_token = token self.setup: Setup | None = None self.devices: list[Device] = [] @@ -148,6 +152,16 @@ async def login( Authenticate and create an API session allowing access to the other operations. Caller must provide one of [userId+userPassword, userId+ssoToken, accessToken, jwt] """ + # Local authentication + if "/enduser-mobile-web/1/enduserAPI/" in self.server.endpoint: + if register_event_listener: + await self.register_event_listener() + else: + # Call a simple endpoint to verify if our token is correct + await self.get_gateways() + + return True + # Somfy TaHoma authentication using access_token if self.server == SUPPORTED_SERVERS["somfy_europe"]: await self.somfy_tahoma_get_access_token() @@ -568,6 +582,15 @@ async def get_current_executions(self) -> list[Execution]: return executions + @backoff.on_exception( + backoff.expo, NotAuthenticatedException, max_tries=2, on_backoff=relogin + ) + async def get_api_version(self) -> str: + """Get the API version (local only)""" + response = await self.__get("apiVersion") + + return cast(str, response["protocolVersion"]) + @backoff.on_exception(backoff.expo, TooManyExecutionsException, max_tries=10) @backoff.on_exception( backoff.expo, NotAuthenticatedException, max_tries=2, on_backoff=relogin @@ -644,7 +667,7 @@ async def generate_local_token(self, gateway_id: str) -> str: Generates a new token Access scope : Full enduser API access (enduser/*) """ - response = await self.__get(f"/config/{gateway_id}/local/tokens/generate") + response = await self.__get(f"config/{gateway_id}/local/tokens/generate") return cast(str, response["token"]) @@ -662,7 +685,7 @@ async def activate_local_token( Access scope : Full enduser API access (enduser/*) """ response = await self.__post( - f"/config/{gateway_id}/local/tokens", + f"config/{gateway_id}/local/tokens", {"label": label, "token": token, "scope": scope}, ) @@ -681,7 +704,7 @@ async def get_local_tokens( Get all gateway tokens with the given scope Access scope : Full enduser API access (enduser/*) """ - response = await self.__get(f"/config/{gateway_id}/local/tokens/{scope}") + response = await self.__get(f"config/{gateway_id}/local/tokens/{scope}") local_tokens = [LocalToken(**lt) for lt in humps.decamelize(response)] return local_tokens @@ -697,7 +720,7 @@ async def delete_local_token(self, gateway_id: str, uuid: str) -> bool: Delete a token Access scope : Full enduser API access (enduser/*) """ - await self.__delete(f"/config/{gateway_id}/local/tokens/{uuid}") + await self.__delete(f"config/{gateway_id}/local/tokens/{uuid}") return True @@ -718,7 +741,8 @@ async def __get(self, path: str) -> Any: headers["Authorization"] = f"Bearer {self._access_token}" async with self.session.get( - f"{self.server.endpoint}{path}", headers=headers + f"{self.server.endpoint}{path}", + headers=headers, ) as response: await self.check_response(response) return await response.json() @@ -827,6 +851,14 @@ async def check_response(response: ClientResponse) -> None: if "Unknown user :" in message: raise UnknownUserException(message) + # {"error":"Unknown object.","errorCode":"UNSPECIFIED_ERROR"} + if message == "Unknown object.": + raise UnknownObjectException(message) + + # {'errorCode': 'RESOURCE_ACCESS_DENIED', 'error': 'Access denied to gateway #1234-5678-1234 for action ADD_TOKEN'} + if "Access denied to gateway" in message: + raise AccessDeniedToGatewayException(message) + raise Exception(message if message else result) async def _refresh_token_if_expired(self) -> None: diff --git a/pyoverkiz/exceptions.py b/pyoverkiz/exceptions.py index a323de8d..14bed408 100644 --- a/pyoverkiz/exceptions.py +++ b/pyoverkiz/exceptions.py @@ -62,6 +62,14 @@ class UnknownUserException(BaseOverkizException): pass +class UnknownObjectException(BaseOverkizException): + pass + + +class AccessDeniedToGatewayException(BaseOverkizException): + pass + + # Nexity class NexityBadCredentialsException(BadCredentialsException): pass diff --git a/tests/fixtures/setup/setup_local_tahoma.json b/tests/fixtures/setup/setup_local_tahoma.json new file mode 100644 index 00000000..006fb33c --- /dev/null +++ b/tests/fixtures/setup/setup_local_tahoma.json @@ -0,0 +1,1544 @@ +{ + "gateways": [ + { + "connectivity": { + "status": "OK", + "protocolVersion": "2022.1.4-26" + }, + "gatewayId": "****-****-3293" + } + ], + "devices": [ + { + "deviceURL": "io://****-****-3293/5770898", + "available": true, + "synced": true, + "type": 1, + "states": [ + { + "type": 1, + "name": "core:Memorized1PositionState", + "value": 80 + }, + { + "type": 1, + "name": "core:TargetClosureState", + "value": 0 + }, + { + "type": 3, + "name": "core:StatusState", + "value": "available" + }, + { + "type": 3, + "name": "core:DiscreteRSSILevelState", + "value": "normal" + }, + { + "type": 1, + "name": "core:RSSILevelState", + "value": 70 + }, + { + "type": 11, + "name": "core:ManufacturerSettingsState", + "value": { + "current_position": 0 + } + }, + { + "type": 1, + "name": "core:ClosureState", + "value": 0 + }, + { + "type": 3, + "name": "core:OpenClosedState", + "value": "open" + }, + { + "type": 1, + "name": "core:DeploymentState", + "value": 0 + }, + { + "type": 6, + "name": "core:MovingState", + "value": false + }, + { + "type": 3, + "name": "core:NameState", + "value": "** **" + } + ], + "label": "** **", + "subsystemId": 0, + "attributes": [ + { + "type": 3, + "name": "core:Manufacturer", + "value": "Somfy" + }, + { + "type": 3, + "name": "core:FirmwareRevision", + "value": "5104761X04" + } + ], + "enabled": true, + "controllableName": "io:VerticalExteriorAwningIOComponent", + "definition": { + "states": [ + { + "name": "core:StatusState" + }, + { + "name": "core:NameState" + }, + { + "name": "core:AdditionalStatusState" + }, + { + "name": "core:TargetClosureState" + }, + { + "name": "core:SecuredPositionState" + }, + { + "name": "core:ManufacturerSettingsState" + }, + { + "name": "core:ClosureState" + }, + { + "name": "core:OpenClosedState" + }, + { + "name": "core:DeploymentState" + }, + { + "name": "core:MovingState" + }, + { + "name": "core:DiscreteRSSILevelState" + }, + { + "name": "core:RSSILevelState" + }, + { + "name": "core:Memorized1PositionState" + } + ], + "widgetName": "PositionableScreen", + "type": "ACTUATOR", + "commands": [ + { + "commandName": "stop", + "nparams": 0 + }, + { + "nparams": 1, + "commandName": "setDeployment", + "paramsSig": "p1" + }, + { + "nparams": 1, + "commandName": "delayedStopIdentify", + "paramsSig": "p1" + }, + { + "nparams": 2, + "commandName": "runManufacturerSettingsCommand", + "paramsSig": "p1,p2" + }, + { + "commandName": "down", + "nparams": 0 + }, + { + "nparams": 1, + "commandName": "setClosure", + "paramsSig": "p1" + }, + { + "commandName": "unpairAllOneWayControllers", + "nparams": 0 + }, + { + "nparams": 1, + "commandName": "setConfigState", + "paramsSig": "p1" + }, + { + "nparams": 1, + "commandName": "pairOneWayController", + "paramsSig": "p1,*p2" + }, + { + "nparams": 1, + "commandName": "advancedRefresh", + "paramsSig": "p1" + }, + { + "commandName": "unpairAllOneWayControllersAndDeleteNode", + "nparams": 0 + }, + { + "commandName": "refreshMemorized1Position", + "nparams": 0 + }, + { + "commandName": "undeploy", + "nparams": 0 + }, + { + "commandName": "up", + "nparams": 0 + }, + { + "commandName": "startIdentify", + "nparams": 0 + }, + { + "commandName": "stopIdentify", + "nparams": 0 + }, + { + "commandName": "open", + "nparams": 0 + }, + { + "commandName": "deploy", + "nparams": 0 + }, + { + "commandName": "keepOneWayControllersAndDeleteNode", + "nparams": 0 + }, + { + "commandName": "sendIOKey", + "nparams": 0 + }, + { + "nparams": 1, + "commandName": "setMemorized1Position", + "paramsSig": "p1" + }, + { + "nparams": 1, + "commandName": "wink", + "paramsSig": "p1" + }, + { + "commandName": "close", + "nparams": 0 + }, + { + "nparams": 1, + "commandName": "setName", + "paramsSig": "p1" + }, + { + "commandName": "identify", + "nparams": 0 + }, + { + "nparams": 1, + "commandName": "setPosition", + "paramsSig": "p1" + }, + { + "nparams": 1, + "commandName": "unpairOneWayController", + "paramsSig": "p1,*p2" + }, + { + "nparams": 1, + "commandName": "setSecuredPosition", + "paramsSig": "p1" + }, + { + "commandName": "my", + "nparams": 0 + }, + { + "commandName": "getName", + "nparams": 0 + } + ], + "uiClass": "ExteriorScreen" + } + }, + { + "deviceURL": "io://****-****-3293/3541212", + "available": true, + "synced": true, + "type": 1, + "states": [ + { + "type": 3, + "name": "core:StatusState", + "value": "available" + }, + { + "type": 3, + "name": "core:DiscreteRSSILevelState", + "value": "normal" + }, + { + "type": 1, + "name": "core:RSSILevelState", + "value": 72 + }, + { + "type": 1, + "name": "core:Memorized1PositionState", + "value": 89 + }, + { + "type": 1, + "name": "core:TargetClosureState", + "value": 0 + }, + { + "type": 3, + "name": "core:NameState", + "value": "** **" + }, + { + "type": 11, + "name": "core:ManufacturerSettingsState", + "value": { + "current_position": 0 + } + }, + { + "type": 1, + "name": "core:ClosureState", + "value": 0 + }, + { + "type": 3, + "name": "core:OpenClosedState", + "value": "open" + }, + { + "type": 1, + "name": "core:DeploymentState", + "value": 0 + }, + { + "type": 6, + "name": "core:MovingState", + "value": false + } + ], + "label": "** **", + "subsystemId": 0, + "attributes": [ + { + "type": 3, + "name": "core:Manufacturer", + "value": "Somfy" + }, + { + "type": 3, + "name": "core:FirmwareRevision", + "value": "5121525A07" + } + ], + "enabled": true, + "controllableName": "io:VerticalExteriorAwningIOComponent", + "definition": { + "states": [ + { + "name": "core:ManufacturerSettingsState" + }, + { + "name": "core:DiscreteRSSILevelState" + }, + { + "name": "core:RSSILevelState" + }, + { + "name": "core:Memorized1PositionState" + }, + { + "name": "core:TargetClosureState" + }, + { + "name": "core:SecuredPositionState" + }, + { + "name": "core:ClosureState" + }, + { + "name": "core:OpenClosedState" + }, + { + "name": "core:DeploymentState" + }, + { + "name": "core:MovingState" + }, + { + "name": "core:AdditionalStatusState" + }, + { + "name": "core:NameState" + }, + { + "name": "core:StatusState" + } + ], + "widgetName": "PositionableScreen", + "type": "ACTUATOR", + "commands": [ + { + "commandName": "stop", + "nparams": 0 + }, + { + "nparams": 1, + "commandName": "setDeployment", + "paramsSig": "p1" + }, + { + "nparams": 1, + "commandName": "delayedStopIdentify", + "paramsSig": "p1" + }, + { + "nparams": 2, + "commandName": "runManufacturerSettingsCommand", + "paramsSig": "p1,p2" + }, + { + "commandName": "down", + "nparams": 0 + }, + { + "nparams": 1, + "commandName": "setClosure", + "paramsSig": "p1" + }, + { + "commandName": "unpairAllOneWayControllers", + "nparams": 0 + }, + { + "nparams": 1, + "commandName": "setConfigState", + "paramsSig": "p1" + }, + { + "nparams": 1, + "commandName": "pairOneWayController", + "paramsSig": "p1,*p2" + }, + { + "nparams": 1, + "commandName": "advancedRefresh", + "paramsSig": "p1" + }, + { + "commandName": "unpairAllOneWayControllersAndDeleteNode", + "nparams": 0 + }, + { + "commandName": "refreshMemorized1Position", + "nparams": 0 + }, + { + "commandName": "undeploy", + "nparams": 0 + }, + { + "commandName": "up", + "nparams": 0 + }, + { + "commandName": "startIdentify", + "nparams": 0 + }, + { + "commandName": "stopIdentify", + "nparams": 0 + }, + { + "commandName": "open", + "nparams": 0 + }, + { + "commandName": "deploy", + "nparams": 0 + }, + { + "commandName": "keepOneWayControllersAndDeleteNode", + "nparams": 0 + }, + { + "commandName": "sendIOKey", + "nparams": 0 + }, + { + "nparams": 1, + "commandName": "setMemorized1Position", + "paramsSig": "p1" + }, + { + "nparams": 1, + "commandName": "wink", + "paramsSig": "p1" + }, + { + "commandName": "close", + "nparams": 0 + }, + { + "nparams": 1, + "commandName": "setName", + "paramsSig": "p1" + }, + { + "commandName": "identify", + "nparams": 0 + }, + { + "nparams": 1, + "commandName": "setPosition", + "paramsSig": "p1" + }, + { + "nparams": 1, + "commandName": "unpairOneWayController", + "paramsSig": "p1,*p2" + }, + { + "nparams": 1, + "commandName": "setSecuredPosition", + "paramsSig": "p1" + }, + { + "commandName": "my", + "nparams": 0 + }, + { + "commandName": "getName", + "nparams": 0 + } + ], + "uiClass": "ExteriorScreen" + } + }, + { + "deviceURL": "io://****-****-3293/7614902", + "available": true, + "synced": true, + "type": 1, + "states": [ + { + "type": 3, + "name": "core:NameState", + "value": "** **" + }, + { + "type": 3, + "name": "core:SlatsOpenClosedState", + "value": "closed" + }, + { + "type": 1, + "name": "core:SlatsOrientationState", + "value": 100 + }, + { + "type": 1, + "name": "core:SlateOrientationState", + "value": 100 + }, + { + "type": 3, + "name": "core:DiscreteRSSILevelState", + "value": "normal" + }, + { + "type": 1, + "name": "core:RSSILevelState", + "value": 58 + }, + { + "type": 3, + "name": "core:StatusState", + "value": "available" + } + ], + "label": "** **", + "subsystemId": 0, + "attributes": [ + { + "type": 3, + "name": "core:Manufacturer", + "value": "Somfy" + }, + { + "type": 3, + "name": "core:FirmwareRevision", + "value": "5133756X72" + } + ], + "enabled": true, + "controllableName": "io:SimpleBioclimaticPergolaIOComponent", + "definition": { + "states": [ + { + "name": "core:AdditionalStatusState" + }, + { + "name": "core:DiscreteRSSILevelState" + }, + { + "name": "core:RSSILevelState" + }, + { + "name": "core:NameState" + }, + { + "name": "core:StatusState" + }, + { + "name": "core:ManufacturerSettingsState" + }, + { + "name": "core:SlatsOpenClosedState" + }, + { + "name": "core:SlatsOrientationState" + }, + { + "name": "core:SlateOrientationState" + }, + { + "name": "core:Memorized1OrientationState" + }, + { + "name": "core:SecuredOrientationState" + } + ], + "widgetName": "BioclimaticPergola", + "type": "ACTUATOR", + "commands": [ + { + "commandName": "stop", + "nparams": 0 + }, + { + "commandName": "closeSlats", + "nparams": 0 + }, + { + "nparams": 1, + "commandName": "setSecuredOrientation", + "paramsSig": "p1" + }, + { + "commandName": "unpairAllOneWayControllers", + "nparams": 0 + }, + { + "nparams": 1, + "commandName": "setConfigState", + "paramsSig": "p1" + }, + { + "nparams": 1, + "commandName": "pairOneWayController", + "paramsSig": "p1,*p2" + }, + { + "commandName": "unpairAllOneWayControllersAndDeleteNode", + "nparams": 0 + }, + { + "nparams": 1, + "commandName": "setOrientation", + "paramsSig": "p1" + }, + { + "commandName": "refreshMemorized1Orientation", + "nparams": 0 + }, + { + "commandName": "startIdentify", + "nparams": 0 + }, + { + "commandName": "stopIdentify", + "nparams": 0 + }, + { + "commandName": "sendIOKey", + "nparams": 0 + }, + { + "commandName": "openSlats", + "nparams": 0 + }, + { + "nparams": 1, + "commandName": "wink", + "paramsSig": "p1" + }, + { + "commandName": "getName", + "nparams": 0 + }, + { + "nparams": 1, + "commandName": "unpairOneWayController", + "paramsSig": "p1,*p2" + }, + { + "nparams": 1, + "commandName": "advancedRefresh", + "paramsSig": "p1" + }, + { + "nparams": 1, + "commandName": "setName", + "paramsSig": "p1" + }, + { + "commandName": "identify", + "nparams": 0 + }, + { + "commandName": "keepOneWayControllersAndDeleteNode", + "nparams": 0 + }, + { + "nparams": 1, + "commandName": "delayedStopIdentify", + "paramsSig": "p1" + }, + { + "nparams": 1, + "commandName": "setMemorized1Orientation", + "paramsSig": "p1" + }, + { + "commandName": "my", + "nparams": 0 + }, + { + "nparams": 2, + "commandName": "runManufacturerSettingsCommand", + "paramsSig": "p1,p2" + } + ], + "uiClass": "Pergola" + } + }, + { + "deviceURL": "io://****-****-3293/16483707", + "available": true, + "synced": true, + "type": 5, + "states": [], + "label": "** *(**)*", + "subsystemId": 0, + "attributes": [ + { + "type": 3, + "name": "core:Manufacturer", + "value": "Somfy" + } + ], + "enabled": true, + "controllableName": "io:StackComponent", + "definition": { + "states": [], + "widgetName": "IOStack", + "type": "PROTOCOL_GATEWAY", + "commands": [ + { + "nparams": 1, + "commandName": "discoverActuators", + "paramsSig": "p1" + }, + { + "commandName": "joinNetwork", + "nparams": 0 + }, + { + "nparams": 1, + "commandName": "advancedSomfyDiscover", + "paramsSig": "p1" + }, + { + "commandName": "resetNetworkSecurity", + "nparams": 0 + }, + { + "commandName": "shareNetwork", + "nparams": 0 + }, + { + "nparams": 0, + "commandName": "discover1WayController", + "paramsSig": "*p1,*p2" + }, + { + "nparams": 1, + "commandName": "discoverSensors", + "paramsSig": "p1" + }, + { + "commandName": "discoverSomfyUnsetActuators", + "nparams": 0 + } + ], + "uiClass": "ProtocolGateway" + } + }, + { + "deviceURL": "internal://****-****-3293/alarm/0", + "available": true, + "synced": true, + "type": 1, + "states": [ + { + "type": 3, + "name": "core:NameState", + "value": "** **" + }, + { + "type": 3, + "name": "internal:IntrusionDetectedState", + "value": "notDetected" + }, + { + "type": 3, + "name": "internal:CurrentAlarmModeState", + "value": "off" + }, + { + "type": 3, + "name": "internal:TargetAlarmModeState", + "value": "off" + }, + { + "type": 1, + "name": "internal:AlarmDelayState", + "value": 30 + } + ], + "label": "**", + "subsystemId": 0, + "attributes": [], + "enabled": true, + "controllableName": "internal:TSKAlarmComponent", + "definition": { + "states": [ + { + "name": "internal:TargetAlarmModeState" + }, + { + "name": "internal:AlarmDelayState" + }, + { + "name": "core:NameState" + }, + { + "name": "internal:IntrusionDetectedState" + }, + { + "name": "internal:CurrentAlarmModeState" + } + ], + "widgetName": "TSKAlarmController", + "type": "ACTUATOR", + "commands": [ + { + "commandName": "arm", + "nparams": 0 + }, + { + "commandName": "alarmOn", + "nparams": 0 + }, + { + "commandName": "disarm", + "nparams": 0 + }, + { + "nparams": 1, + "commandName": "setTargetAlarmMode", + "paramsSig": "p1" + }, + { + "commandName": "on", + "nparams": 0 + }, + { + "commandName": "refreshAlarmDelay", + "nparams": 0 + }, + { + "commandName": "getName", + "nparams": 0 + }, + { + "commandName": "off", + "nparams": 0 + }, + { + "commandName": "alarmPartial2", + "nparams": 0 + }, + { + "nparams": 1, + "commandName": "setName", + "paramsSig": "p1" + }, + { + "commandName": "alarmOff", + "nparams": 0 + }, + { + "commandName": "alarmPartial1", + "nparams": 0 + }, + { + "nparams": 1, + "commandName": "setIntrusionDetected", + "paramsSig": "p1" + }, + { + "nparams": 1, + "commandName": "setAlarmDelay", + "paramsSig": "p1" + }, + { + "commandName": "refreshCurrentAlarmMode", + "nparams": 0 + }, + { + "commandName": "refreshIntrusionDetected", + "nparams": 0 + } + ], + "uiClass": "Alarm" + } + }, + { + "deviceURL": "io://****-****-3293/5353900", + "available": true, + "synced": true, + "type": 1, + "states": [ + { + "type": 1, + "name": "core:TargetClosureState", + "value": 0 + }, + { + "type": 6, + "name": "core:MovingState", + "value": false + }, + { + "type": 3, + "name": "core:StatusState", + "value": "available" + }, + { + "type": 3, + "name": "core:DiscreteRSSILevelState", + "value": "low" + }, + { + "type": 1, + "name": "core:RSSILevelState", + "value": 30 + }, + { + "type": 1, + "name": "core:Memorized1PositionState", + "value": 90 + }, + { + "type": 3, + "name": "core:NameState", + "value": "** **" + }, + { + "type": 11, + "name": "core:ManufacturerSettingsState", + "value": { + "current_position": 0 + } + }, + { + "type": 1, + "name": "core:ClosureState", + "value": 0 + }, + { + "type": 3, + "name": "core:OpenClosedState", + "value": "open" + }, + { + "type": 1, + "name": "core:DeploymentState", + "value": 0 + } + ], + "label": "** **", + "subsystemId": 0, + "attributes": [ + { + "type": 3, + "name": "core:Manufacturer", + "value": "Somfy" + }, + { + "type": 3, + "name": "core:FirmwareRevision", + "value": "5121525A07" + } + ], + "enabled": true, + "controllableName": "io:VerticalExteriorAwningIOComponent", + "definition": { + "states": [ + { + "name": "core:ManufacturerSettingsState" + }, + { + "name": "core:DiscreteRSSILevelState" + }, + { + "name": "core:RSSILevelState" + }, + { + "name": "core:Memorized1PositionState" + }, + { + "name": "core:TargetClosureState" + }, + { + "name": "core:SecuredPositionState" + }, + { + "name": "core:ClosureState" + }, + { + "name": "core:OpenClosedState" + }, + { + "name": "core:DeploymentState" + }, + { + "name": "core:MovingState" + }, + { + "name": "core:AdditionalStatusState" + }, + { + "name": "core:NameState" + }, + { + "name": "core:StatusState" + } + ], + "widgetName": "PositionableScreen", + "type": "ACTUATOR", + "commands": [ + { + "commandName": "stop", + "nparams": 0 + }, + { + "nparams": 1, + "commandName": "setDeployment", + "paramsSig": "p1" + }, + { + "nparams": 1, + "commandName": "delayedStopIdentify", + "paramsSig": "p1" + }, + { + "nparams": 2, + "commandName": "runManufacturerSettingsCommand", + "paramsSig": "p1,p2" + }, + { + "commandName": "down", + "nparams": 0 + }, + { + "nparams": 1, + "commandName": "setClosure", + "paramsSig": "p1" + }, + { + "commandName": "unpairAllOneWayControllers", + "nparams": 0 + }, + { + "nparams": 1, + "commandName": "setConfigState", + "paramsSig": "p1" + }, + { + "nparams": 1, + "commandName": "pairOneWayController", + "paramsSig": "p1,*p2" + }, + { + "nparams": 1, + "commandName": "advancedRefresh", + "paramsSig": "p1" + }, + { + "commandName": "unpairAllOneWayControllersAndDeleteNode", + "nparams": 0 + }, + { + "commandName": "refreshMemorized1Position", + "nparams": 0 + }, + { + "commandName": "undeploy", + "nparams": 0 + }, + { + "commandName": "up", + "nparams": 0 + }, + { + "commandName": "startIdentify", + "nparams": 0 + }, + { + "commandName": "stopIdentify", + "nparams": 0 + }, + { + "commandName": "open", + "nparams": 0 + }, + { + "commandName": "deploy", + "nparams": 0 + }, + { + "commandName": "keepOneWayControllersAndDeleteNode", + "nparams": 0 + }, + { + "commandName": "sendIOKey", + "nparams": 0 + }, + { + "nparams": 1, + "commandName": "setMemorized1Position", + "paramsSig": "p1" + }, + { + "nparams": 1, + "commandName": "wink", + "paramsSig": "p1" + }, + { + "commandName": "close", + "nparams": 0 + }, + { + "nparams": 1, + "commandName": "setName", + "paramsSig": "p1" + }, + { + "commandName": "identify", + "nparams": 0 + }, + { + "nparams": 1, + "commandName": "setPosition", + "paramsSig": "p1" + }, + { + "nparams": 1, + "commandName": "unpairOneWayController", + "paramsSig": "p1,*p2" + }, + { + "nparams": 1, + "commandName": "setSecuredPosition", + "paramsSig": "p1" + }, + { + "commandName": "my", + "nparams": 0 + }, + { + "commandName": "getName", + "nparams": 0 + } + ], + "uiClass": "ExteriorScreen" + } + }, + { + "deviceURL": "internal://****-****-3293/pod/0", + "available": true, + "synced": true, + "type": 1, + "states": [ + { + "type": 3, + "name": "core:NameState", + "value": "**" + }, + { + "type": 3, + "name": "core:CountryCodeState", + "value": "NL" + }, + { + "type": 1, + "name": "internal:LightingLedPodModeState", + "value": 1 + }, + { + "type": 3, + "name": "internal:BatteryStatusState", + "value": "no" + }, + { + "type": 3, + "name": "core:LocalIPv4AddressState", + "value": "192.168.11.36" + }, + { + "type": 3, + "name": "core:ConnectivityState", + "value": "online" + } + ], + "label": "** **", + "subsystemId": 0, + "attributes": [], + "enabled": true, + "controllableName": "internal:PodV2Component", + "definition": { + "states": [ + { + "name": "core:ConnectivityState" + }, + { + "name": "core:LocalIPv4AddressState" + }, + { + "name": "core:CountryCodeState" + }, + { + "name": "internal:LightingLedPodModeState" + }, + { + "name": "core:CyclicButtonState" + }, + { + "name": "core:NameState" + }, + { + "name": "internal:BatteryStatusState" + } + ], + "widgetName": "Pod", + "type": "ACTUATOR", + "commands": [ + { + "commandName": "deactivateCalendar", + "nparams": 0 + }, + { + "commandName": "refreshPodMode", + "nparams": 0 + }, + { + "commandName": "getName", + "nparams": 0 + }, + { + "commandName": "setPodLedOff", + "nparams": 0 + }, + { + "nparams": 1, + "commandName": "setCalendar", + "paramsSig": "p1" + }, + { + "commandName": "update", + "nparams": 0 + }, + { + "commandName": "setPodLedOn", + "nparams": 0 + }, + { + "commandName": "refreshBatteryStatus", + "nparams": 0 + }, + { + "nparams": 1, + "commandName": "setLightingLedPodMode", + "paramsSig": "p1" + }, + { + "commandName": "activateCalendar", + "nparams": 0 + }, + { + "commandName": "refreshUpdateStatus", + "nparams": 0 + }, + { + "nparams": 1, + "commandName": "setCountryCode", + "paramsSig": "p1" + } + ], + "uiClass": "Pod" + } + }, + { + "deviceURL": "io://****-****-3293/5046564", + "available": true, + "synced": true, + "type": 1, + "states": [ + { + "type": 1, + "name": "core:LightIntensityState", + "value": 0 + }, + { + "type": 3, + "name": "core:OnOffState", + "value": "off" + }, + { + "type": 1, + "name": "core:Memorized1PositionState", + "value": 65 + }, + { + "type": 3, + "name": "core:NameState", + "value": "** **" + }, + { + "type": 3, + "name": "core:StatusState", + "value": "available" + }, + { + "type": 3, + "name": "core:DiscreteRSSILevelState", + "value": "normal" + }, + { + "type": 1, + "name": "core:RSSILevelState", + "value": 60 + } + ], + "label": "** **", + "subsystemId": 0, + "attributes": [ + { + "type": 3, + "name": "core:Manufacturer", + "value": "Somfy" + }, + { + "type": 3, + "name": "core:FirmwareRevision", + "value": "5133033A02" + } + ], + "enabled": true, + "controllableName": "io:DimmableLightIOComponent", + "definition": { + "states": [ + { + "name": "core:AdditionalStatusState" + }, + { + "name": "core:DiscreteRSSILevelState" + }, + { + "name": "core:RSSILevelState" + }, + { + "name": "core:NameState" + }, + { + "name": "core:StatusState" + }, + { + "name": "core:ManufacturerSettingsState" + }, + { + "name": "core:LightIntensityState" + }, + { + "name": "core:OnOffState" + }, + { + "name": "core:Memorized1PositionState" + }, + { + "name": "core:SecuredPositionState" + } + ], + "widgetName": "DimmerLight", + "type": "ACTUATOR", + "commands": [ + { + "nparams": 1, + "commandName": "delayedStopIdentify", + "paramsSig": "p1" + }, + { + "nparams": 2, + "commandName": "runManufacturerSettingsCommand", + "paramsSig": "p1,p2" + }, + { + "commandName": "on", + "nparams": 0 + }, + { + "nparams": 1, + "commandName": "onWithTimer", + "paramsSig": "p1" + }, + { + "commandName": "unpairAllOneWayControllers", + "nparams": 0 + }, + { + "nparams": 1, + "commandName": "setConfigState", + "paramsSig": "p1" + }, + { + "nparams": 1, + "commandName": "pairOneWayController", + "paramsSig": "p1,*p2" + }, + { + "commandName": "unpairAllOneWayControllersAndDeleteNode", + "nparams": 0 + }, + { + "commandName": "sendIOKey", + "nparams": 0 + }, + { + "nparams": 1, + "commandName": "wink", + "paramsSig": "p1" + }, + { + "nparams": 1, + "commandName": "unpairOneWayController", + "paramsSig": "p1,*p2" + }, + { + "commandName": "startIdentify", + "nparams": 0 + }, + { + "commandName": "stopIdentify", + "nparams": 0 + }, + { + "nparams": 1, + "commandName": "setSecuredPosition", + "paramsSig": "p1" + }, + { + "commandName": "my", + "nparams": 0 + }, + { + "commandName": "keepOneWayControllersAndDeleteNode", + "nparams": 0 + }, + { + "commandName": "getName", + "nparams": 0 + }, + { + "nparams": 1, + "commandName": "setMemorized1Position", + "paramsSig": "p1" + }, + { + "commandName": "refreshMemorized1Position", + "nparams": 0 + }, + { + "nparams": 1, + "commandName": "advancedRefresh", + "paramsSig": "p1" + }, + { + "nparams": 1, + "commandName": "setName", + "paramsSig": "p1" + }, + { + "commandName": "identify", + "nparams": 0 + }, + { + "nparams": 1, + "commandName": "setPosition", + "paramsSig": "p1" + }, + { + "nparams": 1, + "commandName": "setOnOff", + "paramsSig": "p1" + }, + { + "commandName": "off", + "nparams": 0 + }, + { + "nparams": 1, + "commandName": "setIntensity", + "paramsSig": "p1" + }, + { + "nparams": 2, + "commandName": "setIntensityWithTimer", + "paramsSig": "p1,p2,*p3" + } + ], + "uiClass": "Light" + } + } + ] +} diff --git a/tests/test_client.py b/tests/test_client.py index 3284d368..9b4bd2be 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -129,6 +129,7 @@ async def test_fetch_events_casting(self, client, fixture_name: str): ("setup_tahoma_siren_rtd.json", 31), ("setup_tahoma_be.json", 15), ("setup_local.json", 3), + ("setup_local_tahoma.json", 8), ], ) @pytest.mark.asyncio