kodebach / hacs-idm-heatpump

HACS integration for IDM heat pumps
MIT License
26 stars 2 forks source link

Write support request thread #50

Open kodebach opened 1 year ago

kodebach commented 1 year ago

Please use this issue to report any additional sensors you'd like to have write support for.

Currently supported sensors:

Currently supported sensors for zone module (Z = 0..9, index of zone module) rooms (R = 0..7, index of room):

AndyNew2 commented 1 year ago

Very cool, thanks a lot. Will try beta 0.5.0 beta2 as soon as possible. I am away till end of the week, so will take a while. However very good work, thanks a lot.

Colleoni commented 1 year ago

Testing the code right now, everything seems to correctly work. Thank you very much for this improvement, I think you did a great improvement that will be helpful for a lot of people.

As a suggestion, a good think will be to create a little guide to correctly setup everything (aliases, script and automation), at the moment all the useful information is splitted between 2 different issues

kodebach commented 1 year ago

I will try to improve the README a bit to include some basics about the sensors and services the integration provides. However the "correct" configuration very much depends on what you're trying to achieve and the devices you're using. I cannot describe every possible scenario. For questions about correctly configuring the integration for your setup, please use the now enabled Discussions tab or the Home Assistant Community Forum to get help from others. Things like the difference between 0.0 and {{ 0.0 }} in Home Assistant templates are not specific to this integration, I'll defer to the general Home Assistant documentation for that. But I will include the expected data types in the service documentation, so users are aware.

Note: I'll hide these two comments to keep the issue chain clean, since they aren't directly related to the issue topic (requests for new writable sensors).

AndyNew2 commented 11 months ago

Writing works perfectly, I think we can close this issue.

kodebach commented 11 months ago

From #69:

Done in v0.7.0:

Still open (units unknown):

kodebach commented 8 months ago

From #93

buster3 commented 7 months ago

Hello, thanks for the integration. I would love to get write support for

kodebach commented 2 months ago

@buster3 I released v0.9.0-beta.1 (see #128) please test, if writing works for the sensors you needed.

AndyNew2 commented 2 months ago

I played a little bit. I think you forgot to add supported_features for the RoomMode in the sensor_address.py.

I think you need to add following line in the 0.9.0 beta 6:

around line 540 in the file sensor_address.py: enum=RoomMode, address=ZONE_OFFSETS[self.index] + ROOMOFFSETS[room] + 5, name=f"zone{self.index+1}room{room+1}_mode", force_single=True,

it should be:

                    enum=RoomMode,
                    address=ZONE_OFFSETS[self.index] + ROOM_OFFSETS[room] + 5,
                    name=f"zone_{self.index+1}_room_{room+1}_mode",
                    supported_features=SensorFeatures.SET_ROOM_MODE,
                    force_single=True,

Without that change, you can't select any entity in the service write room mode...

AndyNew2 commented 2 months ago

Further correction needed, otherwise no selection possible: change to: enum=RoomMode, address=ZONE_OFFSETS[self.index] + ROOMOFFSETS[room] + 5, name=f"zone{self.index+1}room{room+1}_mode", device_class=SensorDeviceClass.ENUM, supported_features=SensorFeatures.SET_ROOM_MODE, force_single=True,

After that roommode entities could be selected, however a write still not works. The issue is now the enum definitioin itself. Here is my Python knowledge at the end. I have no idea to define proper an enum. It seems it could not resolve the Enum values in text to the number. However I do not see a defnition for the strings either. In C or C++ you would solve that completely differently but I know Python has some self-refelction tricks, but I suffer the syntax. Could you please have a look. I got following error message, when I try now to write this ZoneModule RoomModes:

2024-09-10 09:03:00.244 ERROR (MainThread) [homeassistant.helpers.script.websocket_api_script] websocket_api script: Error executing script. Unexpected error for call_service at pos 1: 'eco' Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 525, in _async_step await getattr(self, handler)() File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 763, in _async_call_service_step response_data = await self._async_run_long_action( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 726, in _async_run_long_action return await long_task ^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/core.py", line 2761, in async_call response_data = await coro ^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/core.py", line 2804, in _execute_service return await target(service_call) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/idm_heatpump/sensor.py", line 236, in handle_set_room_mode value = RoomMode[raw_value]


  File "/usr/local/lib/python3.12/enum.py", line 814, in __getitem__
    return cls._member_map_[name]
           ~~~~~~~~~~~~~~~~^^^^^^
KeyError: 'eco'
AndyNew2 commented 2 months ago

Found that fault as well. It is just a lower upper case issue. The enum is defined in all upper case. So it is not "eco" but "ECO". That was easy to change and the write works. What I do not understand: I tried to get now everything aligned, but can't really:

  1. OFF seems to be automatically translated to "Aus" Where is this coming from? This automatic conversions often confuses more than it helps. How can I define the text for Off?
  2. AUTO is not AUTO but AUTOMATIC. Makes sense but was another typo in the scripts and translations defintions.
  3. For some reason all other values are shown in HA as the original ENUM value, but ununderstandable in lower case. Even it was defined in upper case and is expected in upper case for writing. This confuses me totally. I have no idea, when I check the values for the room mode I see: "Aus" for "OFF" "automatic" for "AUTOMATIC" "eco" for "ECO" "normal" for "NORMAL" ...

Maybe you could help me to understand that better....

AndyNew2 commented 2 months ago

sorry all the comments from today should relate to issue #93. Just move the comments. The final comment in issue #93 holds a zip file with all the fixes.

kodebach commented 2 months ago

From https://github.com/kodebach/hacs-idm-heatpump/issues/142

Jueff commented 2 months ago

more registers to add to service set_temperature

1401 Raumsolltemperatur Heizen Normal HK A 1403 Raumsolltemperatur Heizen Normal HK B 1405 Raumsolltemperatur Heizen Normal HK C 1407 Raumsolltemperatur Heizen Normal HK D 1409 Raumsolltemperatur Heizen Normal HK E 1411 Raumsolltemperatur Heizen Normal HK F 1413 Raumsolltemperatur Heizen Normal HK G 1415 Raumsolltemperatur Heizen Eco HK A 1417 Raumsolltemperatur Heizen Eco HK B 1419 Raumsolltemperatur Heizen Eco HK C 1421 Raumsolltemperatur Heizen Eco HK D 1423 Raumsolltemperatur Heizen Eco HK E 1425 Raumsolltemperatur Heizen Eco HK F 1427 Raumsolltemperatur Heizen Eco HK G