Skip to content

Require a sensor ID to be set before querying the server #22

Description

@Flix6x

A sensor ID is missing according to the server, but the Integration is not logging which sensor name we were trying to post data to.

Full error log:

2025-04-10 12:48:25.533 ERROR (MainThread) [root] 
        status: 422
        headers: <CIMultiDictProxy('Server': 'gunicorn', 'Date': 'Thu, 10 Apr 2025 10:48:25 GMT', 'Content-Type': 'application/json', 'Content-Length': '210', 'Vary': 'Cookie')>
        payload: {'message': {'json': {'sensor': ['Could not parse sensor ea1.1000-01.required-but-unused-field:fm1.None.']}}, 'result': 'Rejected', 'status': 'UNPROCESSABLE_ENTITY'}.
        
2025-04-10 12:48:25.534 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved (None)
Traceback (most recent call last):
  File "/usr/local/lib/python3.13/site-packages/flexmeasures_client/client.py", line 149, in request
    ) = await self.request_once(
        ^^^^^^^^^^^^^^^^^^^^^^^^
    ...<7 lines>...
    )
    ^
  File "/usr/local/lib/python3.13/site-packages/flexmeasures_client/client.py", line 224, in request_once
    polling_step, reauth_once, url = await check_response(
                                     ^^^^^^^^^^^^^^^^^^^^^
        self, response, polling_step, reauth_once, url
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/usr/local/lib/python3.13/site-packages/flexmeasures_client/response_handling.py", line 68, in check_response
    response.raise_for_status()
    ~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/usr/local/lib/python3.13/site-packages/aiohttp/client_reqrep.py", line 1161, in raise_for_status
    raise ClientResponseError(
    ...<5 lines>...
    )
aiohttp.client_exceptions.ClientResponseError: 422, message='UNPROCESSABLE ENTITY', url='https://ems.seita.energy/api/v3_0/sensors/data'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/lib/python3.13/site-packages/flexmeasures_client/s2/control_types/FRBC/frbc_tunes.py", line 213, in send_actuator_status
    await self._fm_client.post_measurements(
    ...<5 lines>...
    )
  File "/usr/local/lib/python3.13/site-packages/flexmeasures_client/client.py", line 290, in post_measurements
    _response, status = await self.request(
                        ^^^^^^^^^^^^^^^^^^^
    ...<2 lines>...
    )
    ^
  File "/usr/local/lib/python3.13/site-packages/flexmeasures_client/client.py", line 167, in request
    raise ConnectionError(
        "Error occurred while communicating with the API."
    ) from exception
ConnectionError: Error occurred while communicating with the API.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions