golles / ha-kamstrup_403

Custom component that integrates the Kamstrup 403 heating system into Home Assistant. This component does also support a few other heating systems
MIT License
70 stars 10 forks source link

Readings only work once #37

Closed IngmarVerheij closed 1 year ago

IngmarVerheij commented 1 year ago

Did you read the instructions?

The problem

The sensor values are read succesfull, but only once.

I have two ways to solve this 1) Reload the integration 2) Move the head away from the IR port, and then back. then the sensor values are read again, but only once

What version of this integration has the issue?

2.0.0

What version of Home Assistant Core has the issue?

2022.11.2

Home Assistant log

2022-11-09 21:29:59.535 DEBUG (MainThread) [custom_components.kamstrup_403] Start update
2022-11-09 21:29:59.752 DEBUG (MainThread) [custom_components.kamstrup_403] New value for sensor 60, value: 11.24 GJ
2022-11-09 21:30:00.979 DEBUG (MainThread) [custom_components.kamstrup_403] New value for sensor 80, value: 0.6000000000000001 kW
2022-11-09 21:30:02.187 DEBUG (MainThread) [custom_components.kamstrup_403] New value for sensor 86, value: 64.57000000000001 °C
2022-11-09 21:30:03.387 DEBUG (MainThread) [custom_components.kamstrup_403] New value for sensor 87, value: 29.91 °C
2022-11-09 21:30:04.599 DEBUG (MainThread) [custom_components.kamstrup_403] New value for sensor 89, value: 34.660000000000004 K
2022-11-09 21:30:05.818 DEBUG (MainThread) [custom_components.kamstrup_403] New value for sensor 74, value: 17.0 l/h
2022-11-09 21:30:07.035 DEBUG (MainThread) [custom_components.kamstrup_403] New value for sensor 68, value: 80.95 m³
2022-11-09 21:30:08.254 DEBUG (MainThread) [custom_components.kamstrup_403] New value for sensor 97, value: 5366.0 m³xC
2022-11-09 21:30:09.473 DEBUG (MainThread) [custom_components.kamstrup_403] New value for sensor 110, value: 2617.0 m³xC
2022-11-09 21:30:10.045 INFO (Recorder) [homeassistant.components.sensor.recorder] Compiling initial sum statistics for sensor.kamstrup_403_heat_energy_e1, zero point set to 11.24
2022-11-09 21:30:10.045 INFO (Recorder) [homeassistant.components.sensor.recorder] Compiling initial sum statistics for sensor.kamstrup_403_volume, zero point set to 80.94
2022-11-09 21:30:10.045 INFO (Recorder) [homeassistant.components.sensor.recorder] Compiling initial sum statistics for sensor.kamstrup_403_hourcounter, zero point set to 8365.0
2022-11-09 21:30:10.691 DEBUG (MainThread) [custom_components.kamstrup_403] New value for sensor 113, value: 2.0 
2022-11-09 21:30:11.900 DEBUG (MainThread) [custom_components.kamstrup_403] New value for sensor 1004, value: 8365.0 h
2022-11-09 21:30:12.901 DEBUG (MainThread) [custom_components.kamstrup_403] Finished update, 0/11 readings failed
2022-11-09 21:30:12.901 DEBUG (MainThread) [custom_components.kamstrup_403] Finished fetching kamstrup_403 data in 13.366 seconds (success: True)
2022-11-09 21:33:12.001 DEBUG (MainThread) [custom_components.kamstrup_403] Start update
2022-11-09 21:33:12.202 DEBUG (MainThread) [custom_components.kamstrup_403] New value for sensor 60, value: None None
2022-11-09 21:33:13.203 DEBUG (MainThread) [custom_components.kamstrup_403] New value for sensor 80, value: None None
2022-11-09 21:33:14.204 DEBUG (MainThread) [custom_components.kamstrup_403] New value for sensor 86, value: None None
2022-11-09 21:33:15.205 DEBUG (MainThread) [custom_components.kamstrup_403] New value for sensor 87, value: None None
2022-11-09 21:33:16.208 DEBUG (MainThread) [custom_components.kamstrup_403] New value for sensor 89, value: None None
2022-11-09 21:33:17.210 DEBUG (MainThread) [custom_components.kamstrup_403] New value for sensor 74, value: None None
2022-11-09 21:33:18.212 DEBUG (MainThread) [custom_components.kamstrup_403] New value for sensor 68, value: None None
2022-11-09 21:33:19.212 DEBUG (MainThread) [custom_components.kamstrup_403] New value for sensor 97, value: None None
2022-11-09 21:33:20.213 DEBUG (MainThread) [custom_components.kamstrup_403] New value for sensor 110, value: None None
2022-11-09 21:33:21.214 DEBUG (MainThread) [custom_components.kamstrup_403] New value for sensor 113, value: None None
2022-11-09 21:33:22.216 DEBUG (MainThread) [custom_components.kamstrup_403] New value for sensor 1004, value: None None
2022-11-09 21:33:23.217 ERROR (MainThread) [custom_components.kamstrup_403] Finished update, No readings from the meter. Please check the IR connection
2022-11-09 21:33:23.217 DEBUG (MainThread) [custom_components.kamstrup_403] Finished fetching kamstrup_403 data in 11.217 seconds (success: True)

Additional information

This is on a Kamstrup Multical 603

golles commented 1 year ago

I'm aware of this issue, @freijn has also reported this to me and together with him we have tried a few things without success. So, sadly, I've no idea why it is going wrong at the moment. What doesn't help is that I don't have this issue. For me, everything has been running fine for over 24h

IngmarVerheij commented 1 year ago

@freijn what's your setup? I'm running this on a Multical 603.

IngmarVerheij commented 1 year ago

@golles Is there a way to force an initialization of the head on a read?

I'm getting the impression the IR transmitted keeps emitting a signal, which explains why moving the head away/re-initialising temporarily interrupts the signal.

golles commented 1 year ago

Hi @IngmarVerheij Would you be able to check out the add_diagnostics branch or add a custom_components/kamstrup_403/diagnostics.py manually with the following content: https://github.com/golles/ha-kamstrup_403/pull/36/files#diff-56cc7535ea9be5ea2af564f56fe2bb35e1f0a8e79744ada2f4c256370bfe48ce

After a restart, you should be able to get a diagnostic file from the integration, please sent that file, more info

IngmarVerheij commented 1 year ago

@golles Yup! See attached two logfiles (success and fail)

config_entry-kamstrup_403-66febb359ac7a27e5899da3c439ed745.json (1).txt config_entry-kamstrup_403-66febb359ac7a27e5899da3c439ed745.json.txt

golles commented 1 year ago

Thanks, I see you're running HA in Home Assistant OS in a VM, is that correct? Maybe that is a hint to the cause...

I'm running Home Assistant Container

freijn commented 1 year ago

@Golles, I am running in a VM as well on a nuc.

@Ingmar in the previous version the change of the scan freq was also a way I could get it to run again. a reload makes it stopped ( after a yaml change you reload). A disable and enable makes it works again as well.

To me, (just a wild guess!) on the first install, some config is not read. Then after a disable/enable or time change the config is read and its working again. Once working it is stable and working till the next reload happens.

freijn commented 1 year ago

My Diagnostics files

config_entry-kamstrup_403-a20b7a07942b3d15121047cf82860ed8.jsonFAIL.txt config_entry-kamstrup_403-a20b7a07942b3d15121047cf82860ed8.jsonOK.txt

IngmarVerheij commented 1 year ago

@freijn then our results differ slightly.

There's no difference between a Reload or a Disable/Enable of the integration. During the first run I can read the sensor values, all consequent runs result in "No readings from the meter. Please check the IR connection"

freijn commented 1 year ago

@IngmarVerheij Are you in for a test ?

in the custom component /kamstrup403 file __init__.py you find :

from .const import (
    DEFAULT_BAUDRATE,
    DEFAULT_SCAN_INTERVAL,
    DEFAULT_TIMEOUT,
    DOMAIN,
    NAME,
    PLATFORMS,
    VERSION,
)

Add this below this array

DEFAULT_TIMEOUT = 2

so you should get :

from .const import (
    DEFAULT_BAUDRATE,
    DEFAULT_SCAN_INTERVAL,
    DEFAULT_TIMEOUT,
    DOMAIN,
    NAME,
    PLATFORMS,
    VERSION,
)

DEFAULT_TIMEOUT = 2

Restart and let us know if you see any difference ?

I did 3 restarts and all are ok :-)

IngmarVerheij commented 1 year ago

I can confirm that adding the line to init.py resolves the issue. Thanks, champs!

golles commented 1 year ago

Awesome news and many thanks @freijn for your investigation.

@IngmarVerheij could you also test with DEFAULT_TIMEOUT values 1.0 and 0.5? I'm very curious what these do for you.

I've re-opened the issue as I need to implement a fix 😀. I'm considering setting a default of maybe 1.0 and then make it configurable for the user, like with the scan interval.

IngmarVerheij commented 1 year ago

@golles See results below:

2.0: Success! 1.0: Success, for a while... then fails 0.5: Success, for a while 0.2 (default setting): Failed 0: Failed

golles commented 1 year ago

Released! https://github.com/golles/ha-kamstrup_403/releases/tag/2.0.1