Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Readings only work once #37

Closed
1 task done
IngmarVerheij opened this issue Nov 9, 2022 · 14 comments · Fixed by #40
Closed
1 task done

Readings only work once #37

IngmarVerheij opened this issue Nov 9, 2022 · 14 comments · Fixed by #40
Labels
bug Something isn't working

Comments

@IngmarVerheij
Copy link

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

@IngmarVerheij IngmarVerheij added the bug Something isn't working label Nov 9, 2022
@golles
Copy link
Owner

golles commented Nov 10, 2022

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
Copy link
Author

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

@IngmarVerheij
Copy link
Author

@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
Copy link
Owner

golles commented Nov 12, 2022

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
Copy link
Author

@golles
Copy link
Owner

golles commented Nov 13, 2022

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
Copy link

freijn commented Nov 14, 2022

@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
Copy link

freijn commented Nov 14, 2022

@IngmarVerheij
Copy link
Author

IngmarVerheij commented Nov 14, 2022

@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
Copy link

freijn commented Nov 14, 2022

@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
Copy link
Author

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

@golles golles reopened this Nov 14, 2022
@golles
Copy link
Owner

golles commented Nov 14, 2022

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
Copy link
Author

IngmarVerheij commented Nov 14, 2022

@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 golles linked a pull request Nov 14, 2022 that will close this issue
@golles
Copy link
Owner

golles commented Nov 14, 2022

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants