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

Support reading of multiple values at once. #29

Closed TheChatty closed 1 year ago

TheChatty commented 1 year ago

Did you read the instructions?

The request

I simply tried to read multiple values and it worked. I documented it here.

Additional information

No response

golles commented 1 year ago

Thank you for sharing, this would be a really nice improvement

golles commented 1 year ago

In the current implementation, the sensors are defined in const.py https://github.com/golles/ha-kamstrup_403/blob/main/custom_components/kamstrup_403/const.py#L30-L320 And the protocol is defined in https://github.com/golles/ha-kamstrup_403/blob/main/custom_components/kamstrup_403/kamstrup.py

TheChatty commented 1 year ago

At the moment __init__.py loops through all sensors defined in SENSORS.items() and calls readvar for each one.

The new way would be to pass SENSORS.items() down to new function readvars which prepares a single request for all sensors. The new request would look like:

3F 10 <numSensors> <codeOfSens1> <codeOfSens2> <codeOfSens3> ...

And the single response needs to be taken apart matched to each sensor:

3F 10 <codeOfSens1> <respSens1> <codeOfSens2> <respSens2> <codeOfSens2> ...

See this example for how to request 7 sensors at once and how to decipher the response.

golles commented 1 year ago

Thanks, my previous comment was supposed to go to #31 (sorry for that)

For now, I marked this as a nice to have in #30. If I won't make it in that PR, I'll do it in the next one

github-actions[bot] commented 1 year ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

github-actions[bot] commented 1 year ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

golles commented 1 year ago

PR for this feature is available, see #56

Please, if you have time, test this branch: 29-support-reading-of-multiple-values-at-once

golles commented 1 year ago

FYI: This feature has been released in version 2.1.0