toreamun / amshan-homeassistant

Home Assistant integrasjon for strømmålere (AMS/HAN/P1). Integrasjonen støter både streaming (serieport/TCP-IP) og MQTT (Tibber Pulse, energyintelligence.se etc)
MIT License
146 stars 9 forks source link

Could not decode meter message #53

Closed efauske closed 1 year ago

efauske commented 1 year ago

The sensor for current consumption keeps dropping out (unavailable), and the logs are flooded with errors saying it cannot decode meter message. I'm using a Tibber Pulse.

Version of the custom_component

2022.10.2

Configuration

Where can I find the yaml configurations??

Describe the bug

The debug log is full of warnings from amshan that it cannot decode meter message. It seems that the same meter messages are repeated thoughout the warnings.

It seems it cannot receive all consumption calls, because accumulated consumption calculated from consumption reported from the Tibber Pulse is far lower than actual consumption from Elvia app.


## Debug log

2022-12-10 13:52:41.315 WARNING (MainThread) [custom_components.amshan.sensor] Could not decode meter message: 44656275673a2043617020766f6c7461676520637269746963616c21
2022-12-10 13:53:24.094 WARNING (MainThread) [custom_components.amshan.sensor] Could not decode meter message: 44656275673a205769466920707320656e61626c6564
2022-12-10 13:53:58.252 WARNING (MainThread) [custom_components.amshan.sensor] Could not decode meter message: 44656275673a2043617020766f6c74616765206c6f7721
2022-12-10 13:54:11.165 WARNING (MainThread) [custom_components.amshan.sensor] Could not decode meter message: 44656275673a2043617020766f6c7461676520637269746963616c21
2022-12-10 13:54:53.565 WARNING (MainThread) [custom_components.amshan.sensor] Could not decode meter message: 44656275673a205769466920707320656e61626c6564
2022-12-10 13:55:26.394 WARNING (MainThread) [custom_components.amshan.sensor] Could not decode meter message: 44656275673a2043617020766f6c74616765206c6f7721
2022-12-10 13:55:41.875 WARNING (MainThread) [custom_components.amshan.sensor] Could not decode meter message: 44656275673a2043617020766f6c7461676520637269746963616c21
efauske commented 1 year ago

I restarted HA yesterday, and it worked without errors for a while, but now they are back. It is the same messages in the log as before.

johanko commented 1 year ago

Same here 34 entries in log last 8 hours with same id's, which makes gaps in data/metrics:

2022-12-15 21:56:26.287 WARNING (MainThread) [custom_components.amshan.sensor] Could not decode meter message: 48656c6c6f
2022-12-15 21:56:26.621 WARNING (MainThread) [custom_components.amshan.sensor] Could not decode meter message: 44656275673a205265626f6f7420726561736f6e2035
kimmilde commented 1 year ago

Same here, been for a while, but now the data stream "stops".

The values freezes. I have to restart HA to get the sensors up running again.

Need more debugging

robertjoramo commented 1 year ago

I get a similar error, but I get it an insane amount of times. But data seems to flow as expected from the sensor. No stop in data stream as far as I can tell

This error originated from a custom integration.

Logger: custom_components.amshan.sensor
Source: custom_components/amshan/sensor.py:537
Integration: AMS HAN meter (documentation, issues)
First occurred: 09:55:07 (4741 occurrences)
Last logged: 10:00:12

Could not decode meter message: 44656275673a20556e6b6e6f776e20636f6d6d616e64202744656275673a20556e6b6e6f776e20636f6d6d616e64202744656275673a20556e6b6e6f776e20636f6d6d616e64202744656275673a20556e6b6e6f776e20636f6d6d616e64202744656275673a20556e6b6e6f776e20636f6d6d616e64202744656275673a20556e6b6e6f776e20636f6d6d616e64202744656275673a20556e6b6e6f776e20636f6d6d616e6420276e6b6e6f776e20636f6d6d616e64202744656275673a20556e6b6e6f776e20636f6d6d616e64202744656275673a20556e6b6e6f776e20636f6d6d616e64202744656275673a20556e6b6e6f776e20636f6d6d616e64202744656275673a2027272727272727
Could not decode meter message: 44656275673a20556e6b6e6f776e20636f6d6d616e64202744656275673a20556e6b6e6f776e20636f6d6d616e64202744656275673a20556e6b6e6f776e20636f6d6d616e64202744656275673a20556e6b6e6f776e20636f6d6d616e64202744656275673a20556e6b6e6f776e20636f6d6d616e64202744656275673a20556e6b6e6f776e20636f6d6d616e64202744656275673a20556e6b6e6f776e20636f6d6d616e64202744656275673a20556e6b6e6f776e20636f6d6d616e64202744656275673a20556e6b6e6f776e20636f6d6d616e64202744656275673a20556e6b6e6f776e20636f6d6d616e64202744656275673a20556e6b6e6f776e20636f6d6d616e64202744656275673a20556e6b6e6f776e20636f6d6d616e64202744656275673a20556e6b6e6f776e20636f6d6d616e64202744656275673a20556e6b6e6f776e20636f6d6d616e64202744656275673a20556e6b6e6f776e20636f6d6d616e64202744656275673a20556e6b6e6f776e20636f6d6d616e64202744656275673a20556e6b6e6f776e20636f6d6d616e64202744656275673a20556e6b6e6f776e20636f6d6d616e64202744656275673a20556e6b6e6f776e20636f6d6d616e64202744656275673a20556e6b6e6f776e20636f6d6d616e64202744656275673a20556e6b6e6f776e20636f6d6d616e64202744656275673a20
Could not decode meter message: 44656275673a20556e6b6e6f776e20636f6d6d616e64202744656275673a20556e6b6e6f776e20636f6d6d616e64202744656275673a20556e6b6e6f776e20636f6d6d616e64202744656275673a20556e6b6e6f776e20636f6d6d616e64202744656275673a2043617020766f6c74616765206c6f772127272727
Could not decode meter message: 44656275673a20556e6b6e6f776e20636f6d6d616e64202744656275673a20556e6b6e6f776e20636f6d6d616e64202744656275673a20556e6b6e6f776e20636f6d6d616e64202744656275673a20556e6b6e6f776e20636f6d6d616e64202744656275673a20556e6b6e6f776e20636f6d6d616e64202744656275673a20556e6b6e6f776e20636f6d6d616e64202744656275673a20556e6b6e6f776e20636f6d6d616e64202744656275673a20556e6b6e6f776e20636f6d6d616e64202744656275673a205769466920707320656e61626c65642727272727272727
Could not decode meter message: 44656275673a20556e6b6e6f776e20636f6d6d616e64202744656275673a20556e6b6e6f776e20636f6d6d616e64202744656275673a20556e6b6e6f776e20636f6d6d616e64202744656275673a20556e6b6e6f776e20636f6d6d616e64202744656275673a20556e6b6e6f776e20636f6d6d616e64202744656275673a20556e6b6e6f776e20636f6d6d616e64202744656275673a20556e6b6e6f776e20636f6d6d616e64202744656275673a20556e6b6e6f776e20636f6d6d616e64202744656275673a20556e6b6e6f776e20636f6d6d616e64202744656275673a20556e6b6e6f776e20636f6d6d616e64202744656275673a20556e6b6e6f776e20636f6d6d616e64202744656275673a20556e6b6e6f776e20636f6d6d616e64202744656275673a20556e6b6e6f776e20636f6d6d616e64202744656275673a20556e6b6e6f776e20636f6d6d616e64202744656275673a20556e6b6e6f776e20636f6d6d616e64202744656275673a20556e6b6e6f776e20636f6d6d616e642027616e64202744656275673a20556e6b6e6f776e20636f6d6d616e64202744656275673a20556e6b6e6f776e20636f6d6d616e64202744656275673a20556e6b6e6f776e20636f6d6d616e64202744656275673a20556e6b6e6f776e20636f6d6d616e64202744656275673a2027272727272727272727272727272727
efauske commented 1 year ago

If you compare the hourly usage in HA to the official data from the grid provider, are they identical?

I'm seeing lower reported usage in HA compared to the grid provider in periods where the amshan are reporting errors like the above.

robertjoramo commented 1 year ago

Yes, they appear to be identical. I got that error all day yesterday as well, but the data on power usage is correct.

It could be different data that is giving the error. My log file is growing almost 1gb a day with these errors, I can get up to 30 error messages pr second.

efauske commented 1 year ago

HA has reported usage of 4 kwh for each of the last two hours yesterday, but Elvia says that I've used 4.4 kwh and 4.1 kwh in those two hours (where I had some error messages), so there is a gap on my end.

toreamun commented 1 year ago

2022-12-10 13:52:41.315 WARNING (MainThread) [custom_components.amshan.sensor] Could not decode meter message: 44656275673a2043617020766f6c7461676520637269746963616c21 2022-12-10 13:53:24.094 WARNING (MainThread) [custom_components.amshan.sensor] Could not decode meter message: 44656275673a205769466920707320656e61626c6564 2022-12-10 13:53:58.252 WARNING (MainThread) [custom_components.amshan.sensor] Could not decode meter message: 44656275673a2043617020766f6c74616765206c6f7721 2022-12-10 13:54:11.165 WARNING (MainThread) [custom_components.amshan.sensor] Could not decode meter message: 44656275673a2043617020766f6c7461676520637269746963616c21 2022-12-10 13:54:53.565 WARNING (MainThread) [custom_components.amshan.sensor] Could not decode meter message: 44656275673a205769466920707320656e61626c6564 2022-12-10 13:55:26.394 WARNING (MainThread) [custom_components.amshan.sensor] Could not decode meter message: 44656275673a2043617020766f6c74616765206c6f7721 2022-12-10 13:55:41.875 WARNING (MainThread) [custom_components.amshan.sensor] Could not decode meter message: 44656275673a2043617020766f6c7461676520637269746963616c21

The 7 messages above can be decoded as: Debug: Cap voltage critical! Debug: WiFi ps enabled Debug: Cap voltage low! Debug: Cap voltage critical! Debug: WiFi ps enabled Debug: Cap voltage low! Debug: Cap voltage critical!

The Pulse is having trouble with its power. The Pulse runs on power from the HAN port charged into a capasitor. For some reason, the Pulse draws more current than your meter can deliver. Either you meter delivers less than normal, or the Pulse draws more current than normal.

efauske commented 1 year ago

This can perhaps also explain why some measurements are missed, if the Pulse is having issues with power supply.

Do anyone know if it is possible to supply external power to the pulse? If the problem persists, then perhaps another device should be considered?

toreamun commented 1 year ago

I get a similar error, but I get it an insane amount of times. But data seems to flow as expected from the sensor. No stop in data stream as far as I can tell

Could not decode meter message: 44656275673a20556e6b6e6f776e20636f6d6d616e64202744656275673a20556e6b6e6f776e20636f6d6d616e64202744656275673a20556e6b6e6f776e20636f6d6d616e64202744656275673a20556e6b6e6f776e20636f6d6d616e64202744656275673a20556e6b6e6f776e20636f6d6d616e64202744656275673a20556e6b6e6f776e20636f6d6d616e64202744656275673a20556e6b6e6f776e20636f6d6d616e6420276e6b6e6f776e20636f6d6d616e64202744656275673a20556e6b6e6f776e20636f6d6d616e64202744656275673a20556e6b6e6f776e20636f6d6d616e64202744656275673a20556e6b6e6f776e20636f6d6d616e64202744656275673a2027272727272727

The messages you are receiving is of this kind: Debug: Unknown command 'Debug: Unknown command 'Debug: Unknown command 'Debug: Unknown command 'Debug: Unknown command 'Debug: Unknown command 'Debug: Unknown command 'Debug: Unknown command 'Debug: Unknown command 'Debug: Unknown command 'Debug: Unknown command 'Debug: Unknown command 'Debug: Unknown command 'Debug: Unknown command 'Debug: Unknown command 'Debug: Unknown command 'and 'Debug: Unknown command 'Debug: Unknown command 'Debug: Unknown command 'Debug: Unknown command 'Debug:

This indicate that the Pulse is receiving unknown commands on is mqtt_topic_sub topic. Make sure you configure Pulse with different topics for mqtt_topic and mqtt_topic_sub. Please do not send anything to mqtt_topic_sub if you want to avoid unexpected behaviour. It could be smart to avoid wildcard (ending with #) topics to avoid mistakes.

robertjoramo commented 1 year ago

This indicate that the Pulse is receiving unknown commands on is mqtt_topic_sub topic. Make sure you configure Pulse with different topics for mqtt_topic and mqtt_topic_sub. Please do not send anything to mqtt_topic_sub if you want to avoid unexpected behaviour. It could be smart to avoid wildcard (ending with #) topics to avoid mistakes.

Ahh. Probably user error when setting it up then. No way to change mqtt_topic_sub without doing the entire setup process again I suspect?

toreamun commented 1 year ago

This can perhaps also explain why some measurements are missed, if the Pulse is having issues with power supply.

The Pulse gets trouble with the power if to many commands is sent to its mqtt_topic_sub topic. Make sure you select a unused topic name and no wildcard (#) for mqtt_topic_sub.

The hardware of Pulse is a ESP32. This chip has different power save modes (see https://lastminuteengineers.com/esp32-sleep-modes-power-consumption/). One of the messages (Debug: WiFi ps enabled) indicate this, and I can see it in the client details of my wifi dashboard that power save is enabled for my Pulse. The wifi sleep period is then be dependant of the DTIM beacon interval of your Wifi network. To conserve power, the ESP32 deactivates the Wi-Fi module between two DTIM beacon intervals and automatically wakes up before the next beacon arrival. Data is buffered by the AP in this period. By setting a low value of DTIM and beacon interval, you can effectively keep your devices awake indefinitely so they never go into sleep mode when idling. Too long may be bad for other devices.

efauske commented 1 year ago

Thanks for the details @toreamun ! Will look into it :)

cortado commented 1 year ago

får også denne feilen , med følgende i loggen:

Logger: custom_components.amshan.sensor Source: custom_components/amshan/sensor.py:537 Integration: AMS HAN meter (documentation, issues) First occurred: 20:05:36 (38 occurrences) Last logged: 20:45:12

Could not decode meter message: 44656275673a20576946692070732064697361626c65 Could not decode meter message: 44656275673a205769466920707320656e61626c6564

@toreamun Mulig å legge ut en liste i readme, eller wiki som viser hva de ulike kodene betyr?

kimmilde commented 1 year ago

I connected pulse to an external power supply and never had a error after that

efauske commented 1 year ago

I connected pulse to an external power supply and never had a error after that

Which power supply are you using? Powerbank or a more permanent solution?

kimmilde commented 1 year ago

I connected pulse to an external power supply and never had a error after that

Which power supply are you using? Powerbank or a more permanent solution?

I used a longer network cable and placed the pulse in my server rack connected to a normal usb/phone Charger. Actually I am using an old iPhone Charger (1A) to the usb port in pulse

efauske commented 1 year ago

I connected pulse to an external power supply and never had a error after that

Which power supply are you using? Powerbank or a more permanent solution?

I used a longer network cable and placed the pulse in my server rack connected to a normal usb/phone Charger. Actually I am using an old iPhone Charger (1A) to the usb port in pulse

I see, thanks for the information.

I think we have enough information in this ticket for others to identify the issue and know that the solution is to provide the Pulse with more power using an external power source of some kind.

cortado commented 1 year ago

Now running on external power, still getting errors:

Logger: custom_components.amshan.sensor Source: custom_components/amshan/sensor.py:537 Integration: AMS HAN meter (documentation, issues) First occurred: 18:45:56 (26 occurrences) Last logged: 18:50:12

Could not decode meter message: 44656275673a20576946692070732064697361626c65 Could not decode meter message: 44656275673a205769466920707320656e61626c6564