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

Latest version seems to break if more then only a few values are requsted #60

Closed lexusburn closed 1 year ago

lexusburn commented 1 year ago

Did you read the instructions?

The problem

I request these values from 602:

With version 2.0.2 all is working fine. After update to version 2.1.0 i've got no values anymore. Then i pried to remove the addon and reinstall. Now it's working with the 2-3 default values. After enabling the values mentioned above, i've got no updates anymore and this error:

Logger: custom_components.kamstrup_403 Source: custom_components/kamstrup_403/init.py:83 Integration: Kamstrup 403 (documentation, issues) First occurred: 17:33:50 (5 occurrences) Last logged: 17:49:23

Error reading multiple [60, 80, 86, 87, 89, 74, 68, 97, 110, 113, 1004] Exception: bytearray index out of range Finished update, No readings from the meter. Please check the IR connection

What version of this integration has the issue?

2.1.0

What version of Home Assistant Core has the issue?

core-2023.1.4

Home Assistant log

No response

Diagnostics

No response

Additional information

No response

golles commented 1 year ago

Please attach logs (from the log file) and diagnostic file

lexusburn commented 1 year ago

This the only kamstrup 403 related part from debug log: 2023-01-15 21:18:02.556 ERROR (MainThread) [custom_components.kamstrup_403] Error reading multiple [60, 80, 86, 87, 89, 74, 68, 97, 110, 113, 1004] Exception: bytearray index out of range 2023-01-15 21:18:02.560 WARNING (MainThread) [homeassistant.config_entries] Config entry '/dev/ttyUSB1' for kamstrup_403 integration not ready yet; Retrying in background

diagnostic file is attached: config_entry-kamstrup_403-beb8cec9d4d8aeec4e8f1219236a5f15.json.txt

golles commented 1 year ago

Please enable all logs for this component and restart: https://github.com/golles/ha-kamstrup_403#collect-logs This should give more logging

lexusburn commented 1 year ago

removed most of the not kamstrup related stuff. You will find all related stuff here:

2023-01-15 21:34:41.383 WARNING (SyncWorker_4) [homeassistant.loader] We found a custom integration kamstrup_403 which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2023-01-15 21:34:41.449 INFO (MainThread) [homeassistant.setup] Setup of domain logger took 0.0 seconds
2023-01-15 21:34:41.449 INFO (MainThread) [homeassistant.bootstrap] Setting up frontend: {'frontend'}
2023-01-15 21:34:41.457 INFO (MainThread) [homeassistant.setup] Setting up device_automation
2023-01-15 21:34:41.458 INFO (MainThread) [homeassistant.setup] Setup of domain device_automation took 0.0 seconds
2023-01-15 21:34:41.496 INFO (MainThread) [homeassistant.setup] Setting up lovelace
2023-01-15 21:34:41.498 INFO (MainThread) [homeassistant.setup] Setting up http
2023-01-15 21:34:41.502 INFO (MainThread) [homeassistant.setup] Setup of domain lovelace took 0.0 seconds
2023-01-15 21:34:41.513 INFO (MainThread) [homeassistant.setup] Setup of domain http took 0.0 seconds
2023-01-15 21:34:41.517 INFO (MainThread) [homeassistant.setup] Setting up api
2023-01-15 21:34:41.520 INFO (MainThread) [homeassistant.setup] Setup of domain api took 0.0 seconds
2023-01-15 21:34:41.520 INFO (MainThread) [homeassistant.setup] Setting up auth
2023-01-15 21:34:41.522 INFO (MainThread) [homeassistant.setup] Setup of domain auth took 0.0 seconds
2023-01-15 21:34:41.524 INFO (MainThread) [homeassistant.setup] Setting up config
2023-01-15 21:34:41.528 INFO (MainThread) [homeassistant.setup] Setting up diagnostics
2023-01-15 21:34:41.532 INFO (MainThread) [homeassistant.setup] Setting up repairs
2023-01-15 21:34:41.533 INFO (MainThread) [homeassistant.setup] Setup of domain repairs took 0.0 seconds
2023-01-15 21:34:41.690 INFO (MainThread) [homeassistant.setup] Setup of domain config took 0.2 seconds
2023-01-15 21:34:41.691 INFO (MainThread) [homeassistant.setup] Setup of domain diagnostics took 0.2 seconds
2023-01-15 21:34:41.699 INFO (MainThread) [homeassistant.setup] Setting up file_upload
2023-01-15 21:34:41.699 INFO (MainThread) [homeassistant.setup] Setup of domain file_upload took 0.0 seconds
2023-01-15 21:34:41.724 INFO (MainThread) [homeassistant.setup] Setting up image_upload
2023-01-15 21:34:41.725 INFO (MainThread) [homeassistant.setup] Setting up websocket_api
2023-01-15 21:34:41.726 INFO (MainThread) [homeassistant.setup] Setup of domain websocket_api took 0.0 seconds
2023-01-15 21:34:41.743 INFO (MainThread) [homeassistant.setup] Setting up search
2023-01-15 21:34:41.743 INFO (MainThread) [homeassistant.setup] Setup of domain search took 0.0 seconds
2023-01-15 21:34:42.333 INFO (MainThread) [homeassistant.setup] Setting up analytics
2023-01-15 21:34:42.353 INFO (MainThread) [homeassistant.setup] Setup of domain image_upload took 0.6 seconds
2023-01-15 21:34:42.355 INFO (MainThread) [homeassistant.setup] Setting up person
2023-01-15 21:34:42.356 INFO (MainThread) [homeassistant.setup] Setup of domain analytics took 0.0 seconds
2023-01-15 21:34:42.371 INFO (MainThread) [homeassistant.setup] Setup of domain person took 0.0 seconds
2023-01-15 21:34:42.373 INFO (SyncWorker_8) [homeassistant.loader] Loaded hassio from homeassistant.components.hassio
2023-01-15 21:34:42.377 INFO (MainThread) [homeassistant.setup] Setting up onboarding
2023-01-15 21:34:42.378 INFO (MainThread) [homeassistant.setup] Setup of domain onboarding took 0.0 seconds
2023-01-15 21:34:42.390 INFO (MainThread) [homeassistant.setup] Setting up frontend
2023-01-15 21:34:42.395 INFO (MainThread) [homeassistant.setup] Setup of domain frontend took 0.0 seconds
2023-01-15 21:34:42.396 INFO (MainThread) [homeassistant.bootstrap] Setting up recorder: {'recorder'}
2023-01-15 21:34:42.397 INFO (MainThread) [homeassistant.setup] Setting up recorder
2023-01-15 21:34:42.405 INFO (MainThread) [homeassistant.components.http] Now listening on port 8123
2023-01-15 21:34:42.434 INFO (MainThread) [homeassistant.setup] Setup of domain recorder took 0.0 seconds
2023-01-15 21:34:42.435 INFO (MainThread) [homeassistant.bootstrap] Setting up stage 1: {'cloud', 'webhook', 'bluetooth', 'api', 'ssdp', 'http', 'dhcp', 'usb', 'network', 'websocket_api', 'zeroconf'}
2023-01-15 21:34:42.439 INFO (MainThread) [homeassistant.setup] Setting up webhook
2023-01-15 21:34:42.440 INFO (MainThread) [homeassistant.setup] Setup of domain webhook took 0.0 seconds
2023-01-15 21:34:42.584 INFO (MainThread) [homeassistant.setup] Setting up dhcp
2023-01-15 21:34:42.585 INFO (MainThread) [homeassistant.setup] Setup of domain dhcp took 0.0 seconds
2023-01-15 21:34:42.600 INFO (MainThread) [homeassistant.setup] Setting up usb
2023-01-15 21:34:42.600 INFO (MainThread) [homeassistant.setup] Setup of domain usb took 0.0 seconds
2023-01-15 21:34:42.602 INFO (MainThread) [homeassistant.setup] Setting up network
2023-01-15 21:34:42.605 INFO (MainThread) [homeassistant.setup] Setup of domain network took 0.0 seconds
2023-01-15 21:34:42.615 INFO (SyncWorker_10) [homeassistant.loader] Loaded google_assistant from homeassistant.components.google_assistant
2023-01-15 21:34:42.616 INFO (SyncWorker_1) [homeassistant.loader] Loaded camera from homeassistant.components.camera
2023-01-15 21:34:42.690 INFO (MainThread) [homeassistant.setup] Setting up bluetooth
2023-01-15 21:34:42.771 INFO (MainThread) [homeassistant.setup] Setting up zeroconf
2023-01-15 21:34:42.805 INFO (MainThread) [homeassistant.setup] Setting up ssdp
2023-01-15 21:34:42.807 INFO (MainThread) [homeassistant.setup] Setup of domain zeroconf took 0.0 seconds
2023-01-15 21:34:43.258 INFO (MainThread) [homeassistant.setup] Setting up cloud
2023-01-15 21:34:43.294 INFO (MainThread) [homeassistant.components.zeroconf] Starting Zeroconf broadcast
2023-01-15 21:34:43.316 INFO (MainThread) [homeassistant.setup] Setup of domain bluetooth took 0.6 seconds
2023-01-15 21:34:43.334 INFO (MainThread) [homeassistant.setup] Setup of domain cloud took 0.1 seconds
2023-01-15 21:34:43.353 INFO (MainThread) [homeassistant.setup] Setup of domain ssdp took 0.5 seconds
2023-01-15 21:34:43.364 INFO (MainThread) [homeassistant.bootstrap] Setting up stage 2: {'logbook', 'system_health', 'scene', 'deconz', 'search', 'counter', 'tag', 'hacs', 'panel_custom', 'auto_backup', 'default_config', 'tasmota', 'webrtc', 'group', 'alert', 'application_credentials', 'alarm_control_panel', 'input_datetime', 'forecast_solar', 'co2signal', 'ios', 'timer', 'input_text', 'powercalc', 'utility_meter', 'auth', 'device_automation', 'wemo', 'my', 'input_number', 'scheduler', 'intent_script', 'ui_lovelace_minimalist', 'light', 'diagnostics', 'influxdb', 'repairs', 'schedule', 'automation', 'template', 'homeassistant_alerts', 'energy', 'person', 'nina', 'switch', 'media_source', 'mqtt', 'media_player', 'switch_as_x', 'google', 'dlna_dmr', 'owntracks', 'zwave_js', 'alexa_media', 'cupertino', 'unifi', 'radio_browser', 'input_button', 'pyscript', 'alarmo', 'notify', 'unifiprotect', 'input_select', 'apple_tv', 'device_tracker', 'garmin_connect', 'met', 'kamstrup_403', 'map', 'stream', 'mobile_app', 'onboarding', 'ffmpeg', 'denonavr', 'tod', 'panasonic_viera', 'synology_dsm', 'blueprint', 'file_upload', 'trace', 'alexa', 'sensor', 'ipp', 'config', 'proximity', 'cover', 'input_boolean', 'heos', 'persistent_notification', 'analytics', 'shelly', 'tts', 'select', 'binary_sensor', 'hardware', 'nuki_ng', 'sun', 'tado', 'lovelace', 'eufy_security', 'none', 'history', 'script', 'image_upload', 'browser_mod', 'zone', 'xiaomi_aqara', 'esphome', 'lifx', 'min_max'}
2023-01-15 21:34:43.375 INFO (MainThread) [homeassistant.setup] Setting up scene
2023-01-15 21:34:43.376 INFO (MainThread) [homeassistant.components.scene] Setting up scene.homeassistant
2023-01-15 21:34:43.383 INFO (MainThread) [homeassistant.setup] Setting up counter
2023-01-15 21:34:43.385 INFO (MainThread) [homeassistant.setup] Setting up tag
2023-01-15 21:34:43.386 INFO (MainThread) [homeassistant.setup] Setting up panel_custom
2023-01-15 21:34:43.386 INFO (MainThread) [homeassistant.setup] Setup of domain panel_custom took 0.0 seconds
2023-01-15 21:34:43.388 INFO (MainThread) [homeassistant.setup] Setting up group
2023-01-15 21:34:43.392 INFO (SyncWorker_9) [homeassistant.loader] Loaded manual from homeassistant.components.manual
2023-01-15 21:34:43.392 INFO (MainThread) [homeassistant.setup] Setting up input_datetime
2023-01-15 21:34:43.393 INFO (MainThread) [homeassistant.setup] Setting up timer
2023-01-15 21:34:43.397 INFO (MainThread) [homeassistant.setup] Setting up input_text
2023-01-15 21:34:43.398 INFO (MainThread) [homeassistant.setup] Setting up input_number
2023-01-15 21:34:43.400 INFO (MainThread) [homeassistant.setup] Setting up intent_script
2023-01-15 21:34:43.401 INFO (MainThread) [homeassistant.setup] Setup of domain intent_script took 0.0 seconds
2023-01-15 21:34:43.402 INFO (MainThread) [homeassistant.setup] Setting up light
2023-01-15 21:34:43.408 INFO (MainThread) [homeassistant.setup] Setting up schedule
2023-01-15 21:34:43.411 INFO (MainThread) [homeassistant.setup] Setting up homeassistant_alerts
2023-01-15 21:34:43.412 INFO (MainThread) [homeassistant.setup] Setup of domain homeassistant_alerts took 0.0 seconds

2023-01-15 21:34:43.427 INFO (MainThread) [homeassistant.setup] Setting up kamstrup_403
2023-01-15 21:34:43.427 INFO (MainThread) [homeassistant.setup] Setup of domain kamstrup_403 took 0.0 seconds

2023-01-15 21:34:43.492 DEBUG (MainThread) [custom_components.kamstrup_403] Set up entry, with scan_interval of 3600 seconds and timeout of 1.0 seconds

2023-01-15 21:35:05.292 DEBUG (MainThread) [custom_components.kamstrup_403] Register command 60
2023-01-15 21:35:05.292 DEBUG (MainThread) [custom_components.kamstrup_403] Register command 80
2023-01-15 21:35:05.292 DEBUG (MainThread) [custom_components.kamstrup_403] Register command 86
2023-01-15 21:35:05.293 DEBUG (MainThread) [custom_components.kamstrup_403] Register command 87
2023-01-15 21:35:05.293 DEBUG (MainThread) [custom_components.kamstrup_403] Register command 89
2023-01-15 21:35:05.294 DEBUG (MainThread) [custom_components.kamstrup_403] Register command 74
2023-01-15 21:35:05.294 DEBUG (MainThread) [custom_components.kamstrup_403] Register command 68
2023-01-15 21:35:05.297 DEBUG (MainThread) [custom_components.kamstrup_403] Register command 97
2023-01-15 21:35:05.298 DEBUG (MainThread) [custom_components.kamstrup_403] Register command 110
2023-01-15 21:35:05.298 DEBUG (MainThread) [custom_components.kamstrup_403] Register command 113
2023-01-15 21:35:05.299 DEBUG (MainThread) [custom_components.kamstrup_403] Register command 1004

2023-01-15 21:35:07.104 ERROR (MainThread) [custom_components.kamstrup_403] Error reading multiple [60, 80, 86, 87, 89, 74, 68, 97, 110, 113, 1004] 
Exception: bytearray index out of range
2023-01-15 21:35:07.106 DEBUG (MainThread) [custom_components.kamstrup_403] Finished fetching kamstrup_403 data in 1.051 seconds (success: False)
2023-01-15 21:35:07.108 WARNING (MainThread) [homeassistant.config_entries] Config entry '/dev/ttyUSB1' for kamstrup_403 integration not ready yet; Retrying in background

2023-01-15 21:35:47.062 DEBUG (MainThread) [custom_components.kamstrup_403] Set up entry, with scan_interval of 3600 seconds and timeout of 1.0 seconds
2023-01-15 21:35:47.078 INFO (MainThread) [custom_components.hacs] Loading removed repositories
2023-01-15 21:35:47.085 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry /dev/ttyUSB1 for sensor
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 382, in async_setup
    result = await component.async_setup_entry(hass, self)
  File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 573, in async_setup_entry
    return await component.async_setup_entry(entry)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 166, in async_setup_entry
    raise ValueError("Config entry has already been setup!")
ValueError: Config entry has already been setup!
2023-01-15 21:35:47.567 DEBUG (MainThread) [custom_components.kamstrup_403] Start update
2023-01-15 21:35:47.693 ERROR (MainThread) [custom_components.kamstrup_403] Finished update, No readings from the meter. Please check the IR connection
2023-01-15 21:35:47.706 DEBUG (MainThread) [custom_components.kamstrup_403] Finished fetching kamstrup_403 data in 0.139 seconds (success: True)
golles commented 1 year ago

Are you sure your serial device is on /dev/ttyUSB1? It is really not recommended to use these devices, please have a look at https://github.com/golles/ha-kamstrup_403#configuration-is-done-in-the-ui

lexusburn commented 1 year ago

I'm using the your add-on now with version 2.0.2 and /dev/ttyUSB1 like i've done for months before the latest update.

And it's working fine with 2.0.2 again.

StevenLooman commented 1 year ago

I am guessing the 602 (and possibly other meters) return a maximum of N (to be determined?) values per request. Or perhaps it returns in two or more responses, when more than N values are requested.

Addition: I also have a 602 and only reading the Heat Energy (E1) sensor, which works without any problems.

golles commented 1 year ago

I only have 7 sensors enabled, the defaults and the gas sensor. That works fine on a 403. I'll do some tests later this week with more sensors to see if I can reproduce the issue and see what I can do.

lexusburn commented 1 year ago

Good Idea @StevenLooman. I will try to find the magic number.

With only the default activated properties it worked fine.

lexusburn commented 1 year ago

Ok, had a quick test: 6 sensors and 2 properties on diag are working fine. If i have 7 sensors (and the 2 diag props) enabled, it fails.

And after disabling one of the diag properties and can use one sensor more.

I would like to say that @StevenLooman is right. It fails on requesting more then 8 sensors or response changes in this case.

janneho commented 1 year ago

Found this from documetation, so 8 is max.

kuva

golles commented 1 year ago

Found this from documetation, so 8 is max.

Thanks, I haven't had time to fix it yet but this helps!

golles commented 1 year ago

My spare time was a bit sparse, but I did just manage to quickly draft something working (in my prod HA). Would anyone be able to test this branch? @lexusburn maybe, as you reported the issue?

PR: #66 Branch: 60-latest-version-seems-to-break-if-more-then-only-a-few-values-are-requsted

lexusburn commented 1 year ago

@golles your fix works find for me.

I've tried it and had enabled 18 different values for a test and it works fine. :-)

Thank you for the fix! :-)

golles commented 1 year ago

Awesome and thanks for the swift feedback :-) If you don't mind, I'd like to keep the ticket open until the PR has been merged, I want to improve the code a little bit and see if I can get the coverage check to pass as well. Shouldn't be more than a couple of days.

StevenLooman commented 1 year ago

Found this from documetation, so 8 is max.

kuva

Where can we find this documentation, @janneho?

janneho commented 1 year ago

Sorry, i thought that i added link. Multical 601 KMP

StevenLooman commented 1 year ago

Sorry, i thought that i added link. Multical 601 KMP

Thank you!