cenobitedk / esphome_multical402

Kamstrup Multical 402 for esphome
29 stars 6 forks source link

Problems after ESPHOME firmware upgrade #8

Closed OMJOB closed 3 months ago

OMJOB commented 3 months ago

Hi !

The Multical 402 reader has worked great for almost 1 year. Normally, I have the attitude of not upgrading something that works. Despite this, I did a firmware upgrade of my ESP8266 d1_mini that reads the Multical meter.

After that I get the error below and wonder if you have any idea what could be causing this.

[11:31:55][D][Multical402:048]: Start update
[11:31:56][D][sensor:093]: 'Energy': Sending state 28.31600 MWh with 3 decimals of accuracy
[11:31:57][D][sensor:093]: 'Volume': Sending state 2032.01001 m3 with 2 decimals of accuracy
[11:31:57][D][sensor:093]: 'TemperatureIn': Sending state 44.62000 °C with 2 decimals of accuracy
[11:31:58][D][sensor:093]: 'TemperatureOut': Sending state 45.36000 °C with 2 decimals of accuracy
[11:31:59][D][sensor:093]: 'TemperatureDiff': Sending state 0.82000 °C with 2 decimals of accuracy
[11:32:00][W][Multical402:163]: Timed out listening for data

As you can see it reads a few values and then times out. I have two district heating meters and a reader on each, after the upgrade both get the same error. It's summertime here right now so I'm using next to no energy, could that be causing this problem?

Thanks in advance.

cenobitedk commented 3 months ago

Hi @OMJOB What version of ESPHome er you running now? I'm running 2024.6.4 which is running fine. From your logs it looks like it's timing out when reading Power from the meter, which is just another registry, so I don't see any particular reason why it's timing out. You could try to increase the TIMEOUT const here: https://github.com/cenobitedk/esphome_multical402/blob/main/kmp.h#L7

However, not that long ago a KMP component was added to the official ESPHome library, you could consider using that instead :) https://esphome.io/components/sensor/kamstrup_kmp.html

OMJOB commented 3 months ago

Hi! I am running ESPHome version: 2024.6.6.

Tried changing from ESP8266 to ESP32 and then I no longer gets a time out but it does not return a line for power, only get 6 rows out of 7.

Tried the official KMP component you recommended and it works on both ESP8266 and ESP32. The value that it returns for power is 0, could that be what caused the old way to fail?

Many thanks for your help.

cenobitedk commented 3 months ago

Actually I think I know what the problem is. If the value is 0 the code will think there's an error. There's more details here: https://github.com/cenobitedk/esphome_multical402/issues/3#issuecomment-1728264115

OMJOB commented 3 months ago

Made the changes to kmp.h and multical402.h as suggested in the link I got.

Tested on an ESP8266 and it now works better but when the value is zero for power I get a time out for power, the other values ​​are returned correctly.

For now, I stick to the official KMP component you recommended, that one returns zero when I have no consumption, which looks better than the value unknown.

Do you want to keep this case open for further troubleshooting or should I close it as I am satisfied with how the official KMP component works?

cenobitedk commented 3 months ago

Thanks for testing and getting back! 🙏

I'll close the issue as the original problem is not specifically tied to the ESPHome version (ref. title) but instead a problem in the code.