Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[xSAirQ] Fix AirQualityGraph operation #231

Merged
merged 2 commits into from
May 11, 2024

Conversation

leo8a
Copy link
Contributor

@leo8a leo8a commented May 9, 2024

Fixes the AirQualityGraph operation.

2024-05-09 14:36:14.192 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up securitas platform for sensor
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 356, in _async_setup_platform
    await asyncio.shield(awaitable)
  File "/config/custom_components/securitas/sensor.py", line 50, in async_setup_entry
    air_quality: AirQuality = await client.session.get_air_quality_data(
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/securitas/securitas_direct_new_api/apimanager.py", line 502, in get_air_quality_data
    response = await self._execute_request(content, "AirQualityGraph")
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/securitas/securitas_direct_new_api/apimanager.py", line 170, in _execute_request
    raise SecuritasDirectError(
custom_components.securitas.securitas_direct_new_api.exceptions.SecuritasDirectError: ("Cannot read properties of undefined (reading 'total')",
{'errors': [
      {'message': "Cannot read properties of undefined (reading 'total')", 
        'locations': [{'line': 2, 'column': 3}], 
        'path': ['xSAirQ'], 
        'extensions': {'code': 'INTERNAL_SERVER_ERROR'}, 
        'data': {}}], 
  'data': {'xSAirQ': None}}, 
{'app': '{"appVersion": "10.102.0", "origin": "native"}', 
        'User-Agent': 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.5005.124 Safari/537.36 Edg/102.0.1245.41', 
'X-APOLLO-OPERATION-ID': '<X-APOLLO-OPERATION-ID>',
'X-APOLLO-OPERATION-NAME': 'AirQualityGraph', 
'extension': '{"mode":"full"}', 
'auth': '{"loginTimestamp": 1715258167440, 
          "user": "<USER>", 
          "id": "<OWA>", 
          "country": "ES", 
          "lang": "es", 
          "callby": "OWA_10", 
          "hash": "<HAS>"}'},
{'operationName': 'AirQualityGraph', 
 'variables': {'numinst': '5281378', 'zone': 'JZ01'}, 
 'query': 'query AirQualityGraph($numinst: String!, $zone: String!) {\n  xSAirQ(numinst: $numinst, zone: $zone) {\n    res\n    msg\n    graphData {\n      status {\n        avg6h\n        avg6hMsg\n        avg24h\n        avg24hMsg\n        avg7d\n        avg7dMsg\n        avg4w\n        avg4wMsg\n        current\n        currentMsg\n      }\n      daysTotal\n      days {\n        id\n        value\n      }\n      hoursTotal\n      hours {\n        id\n        value\n      }\n      weeksTotal\n      weeks {\n        id\n        value\n      }\n    }\n  }\n}'}

@guerrerotook PTAL whenever you got some free cycles, thanks

@guerrerotook
Copy link
Owner

@leo8a Thanks very much for the PR!

@guerrerotook guerrerotook merged commit 8d52216 into guerrerotook:main May 11, 2024
3 checks passed
@leo8a leo8a deleted the fix-xSAirQ branch May 11, 2024 17:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants