esphome / issues

Issue Tracker for ESPHome
https://esphome.io/
294 stars 38 forks source link

platform:dsmr electricity_failure_log-feature produces too long states #5448

Open nl0pvm opened 10 months ago

nl0pvm commented 10 months ago

The problem

The platform: dsmr electricity_failure_log feature produces in my case the following state that is too long for HomeAssistant: \r\xe0\xeb\xad\x06\x12\xb3\x02(10)(0-0:96.7.19)(210901114546S)(0000084776*s)(210907135544S)(0000518827*s)(210910120404S)(0000252483*s)(210922075039S)(0000001281*s)(210922145242S)(0000000775*s)(211210123432\xb5\x19\x19\x06\x06\x06\x06\x06\x06&6\x96\xa66K\xfe(220302151825W)(0000004292*s)(230325213116W)(0000001124*s)(230407090528S)(0000002288*s)(240119095657W)(0000000258*s) As a result Homeassistant gives the following (useful) error: homeassistant.exceptions.InvalidStateError: Invalid state with length 307. State max length is 255 characters.

Which version of ESPHome has the issue?

2023.12.9

What type of installation are you using?

Home Assistant Add-on

Which version of Home Assistant has the issue?

2023.12.1

What platform are you using?

ESP8266

Board

D1 Mini

Component causing the issue

dsmr

Example YAML snippet

text_sensor: 
  - platform: dsmr
    electricity_failure_log:
     name: Electricity Failure Log

Anything in the logs that might be useful for us?

2024-01-30 08:47:28.757 ERROR (MainThread) [aioesphomeapi.connection] esp31-p1 @ 192.168.0.71: Invalid protobuf message: type=TextSensorStateResponse data=b'\r\xe0\xeb\xad\x06\x12\xb3\x02(10)(0-0:96.7.19)(210901114546S)(0000084776*s)(210907135544S)(0000518827*s)(210910120404S)(0000252483*s)(210922075039S)(0000001281*s)(210922145242S)(0000000775*s)(211210123432\xb5\x19\x19\x06\x06\x06\x06\x06\x06&6\x96\xa66K\xfe(220302151825W)(0000004292*s)(230325213116W)(0000001124*s)(230407090528S)(0000002288*s)(240119095657W)(0000000258*s)': Error parsing message
Traceback (most recent call last):
  File "aioesphomeapi/connection.py", line 891, in aioesphomeapi.connection.APIConnection.process_packet
google.protobuf.message.DecodeError: Error parsing message
2024-01-30 08:47:28.758 WARNING (MainThread) [aioesphomeapi.connection] esp31-p1 @ 192.168.0.71: Connection error occurred: Invalid protobuf message: type=TextSensorStateResponse data=b'\r\xe0\xeb\xad\x06\x12\xb3\x02(10)(0-0:96.7.19)(210901114546S)(0000084776*s)(210907135544S)(0000518827*s)(210910120404S)(0000252483*s)(210922075039S)(0000001281*s)(210922145242S)(0000000775*s)(211210123432\xb5\x19\x19\x06\x06\x06\x06\x06\x06&6\x96\xa66K\xfe(220302151825W)(0000004292*s)(230325213116W)(0000001124*s)(230407090528S)(0000002288*s)(240119095657W)(0000000258*s)': Error parsing message
2024-01-30 08:47:28.758 ERROR (MainThread) [homeassistant] Error doing job: Fatal error: protocol.data_received() call failed.
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/asyncio/selector_events.py", line 1003, in _read_ready__data_received
    self._protocol.data_received(data)
  File "aioesphomeapi/_frame_helper/noise.py", line 163, in aioesphomeapi._frame_helper.noise.APINoiseFrameHelper.data_received
  File "aioesphomeapi/_frame_helper/noise.py", line 326, in aioesphomeapi._frame_helper.noise.APINoiseFrameHelper._handle_frame
  File "aioesphomeapi/connection.py", line 906, in aioesphomeapi.connection.APIConnection.process_packet
  File "aioesphomeapi/connection.py", line 891, in aioesphomeapi.connection.APIConnection.process_packet
google.protobuf.message.DecodeError: Error parsing message
2024-01-30 08:47:32.902 ERROR (MainThread) [aioesphomeapi.connection] esp31-p1 @ 192.168.0.71: Invalid protobuf message: type=TextSensorStateResponse data=b'\r\xe0\xeb\xad\x06\x12\xb3\x02(10)(0-0:96.7.19)(210901114546S)(0000084776*s)(210907135544S)(0000518827*s)(210910120404S)(0000252483*s)(210922075039S)(0000001281*s)(210922145242S)(0000000775*s)(211210123432\xb5\x19\x19\x06\x06\x06\x06\x06\x06&6\x96\xa66K\xfe(220302151825W)(0000004292*s)(230325213116W)(0000001124*s)(230407090528S)(0000002288*s)(240119095657W)(0000000258*s)': Error parsing message
Traceback (most recent call last):
  File "aioesphomeapi/connection.py", line 891, in aioesphomeapi.connection.APIConnection.process_packet
google.protobuf.message.DecodeError: Error parsing message
2024-01-30 08:47:32.903 WARNING (MainThread) [aioesphomeapi.connection] esp31-p1 @ 192.168.0.71: Connection error occurred: Invalid protobuf message: type=TextSensorStateResponse data=b'\r\xe0\xeb\xad\x06\x12\xb3\x02(10)(0-0:96.7.19)(210901114546S)(0000084776*s)(210907135544S)(0000518827*s)(210910120404S)(0000252483*s)(210922075039S)(0000001281*s)(210922145242S)(0000000775*s)(211210123432\xb5\x19\x19\x06\x06\x06\x06\x06\x06&6\x96\xa66K\xfe(220302151825W)(0000004292*s)(230325213116W)(0000001124*s)(230407090528S)(0000002288*s)(240119095657W)(0000000258*s)': Error parsing message
2024-01-30 08:47:32.903 ERROR (MainThread) [homeassistant] Error doing job: Fatal error: protocol.data_received() call failed.
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/asyncio/selector_events.py", line 1003, in _read_ready__data_received
    self._protocol.data_received(data)
  File "aioesphomeapi/_frame_helper/noise.py", line 163, in aioesphomeapi._frame_helper.noise.APINoiseFrameHelper.data_received
  File "aioesphomeapi/_frame_helper/noise.py", line 326, in aioesphomeapi._frame_helper.noise.APINoiseFrameHelper._handle_frame
  File "aioesphomeapi/connection.py", line 906, in aioesphomeapi.connection.APIConnection.process_packet
  File "aioesphomeapi/connection.py", line 891, in aioesphomeapi.connection.APIConnection.process_packet
google.protobuf.message.DecodeError: Error parsing message
2024-01-30 08:47:37.186 ERROR (MainThread) [homeassistant.helpers.entity] Failed to set state for sensor.esp31_p1_electricity_failure_log, fall back to unknown
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1129, in _async_write_ha_state
    hass.states.async_set(
  File "/usr/src/homeassistant/homeassistant/core.py", line 1807, in async_set
    state = State(
            ^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 1384, in __init__
    validate_state(state)
  File "/usr/src/homeassistant/homeassistant/core.py", line 204, in validate_state
    raise InvalidStateError(
homeassistant.exceptions.InvalidStateError: Invalid state with length 307. State max length is 255 characters.

Additional information

No response

nl0pvm commented 10 months ago

additionally, some alike parsing errors occur with:

    identification:
      name: DSMR Identification

giving the following errors:

2024-02-05 13:42:44.006 WARNING (MainThread) [aioesphomeapi.connection] esp31-p1 @ 192.168.0.71: Connection error occurred: Invalid protobuf message: type=TextSensorStateResponse data=b'\r\xbcb\xe9\x1a\x12\x14XMX5LGF00XXXXXXXX\xcc\x06\xd6': Error parsing message
2024-02-05 13:42:44.007 ERROR (MainThread) [homeassistant] Error doing job: Fatal error: protocol.data_received() call failed.
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/asyncio/selector_events.py", line 1003, in _read_ready__data_received
    self._protocol.data_received(data)
  File "aioesphomeapi/_frame_helper/noise.py", line 163, in aioesphomeapi._frame_helper.noise.APINoiseFrameHelper.data_received
  File "aioesphomeapi/_frame_helper/noise.py", line 326, in aioesphomeapi._frame_helper.noise.APINoiseFrameHelper._handle_frame
  File "aioesphomeapi/connection.py", line 906, in aioesphomeapi.connection.APIConnection.process_packet
  File "aioesphomeapi/connection.py", line 891, in aioesphomeapi.connection.APIConnection.process_packet
google.protobuf.message.DecodeError: Error parsing message
github-actions[bot] commented 6 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

nl0pvm commented 5 months ago

The issue has not been resolved yet