kodebach / hacs-idm-heatpump

HACS integration for IDM heat pumps
MIT License
20 stars 1 forks source link

Connection temperature sensors #34

Closed stefanschae closed 8 months ago

stefanschae commented 9 months ago

I have successfully integrated the IDM heat pump into Home Assistant via kodebach/hacs-idm-heatpump. However, I am missing the entities for the temperature sensors of the individual room control.

kodebach commented 9 months ago

Yes, that is a currently known limitation. I originally didn't add those sensors, because I didn't need them and didn't have a setup to test them anyway.

I might have time to add them in the next few days. However, two limitations upfront:

  1. The values will still be read-only, see #10 for details. So no fancy automations or using thermostat controls from Home Assistant.
  2. AFAIK there is no way of getting the names of the individual rooms from the heat pump (at least not via Modbus). That means the sensors would initially just be labelled "Zonenmodul 1 Raum 1 Raumtemperatur", "Zonenmodul 1 Raum 2 Raumtemperatur", etc. I also don't know of a way to mass rename entities in Home Assistant (at least not an arbitrary subset of a device). So you'd have to manually rename all sensors (that you want to use) or remember the numbers for all your rooms.
stefanschae commented 9 months ago

Thank you very much for your quick reply and your efforts in this case! Maybe I could be helpful in testing. I'd really appreciate it if you could find the time to add it! Regarding your limitations: No problem from my side. My use case would be to add automations based on the temperature of each room. If I understand you correctly, would this be possible? Thanks again!

One more thing: I am also missing the heating unit (Heizstab) for my Hygenic module to be able to see the energy usage in HA. Would it be possible to add this too?

kodebach commented 9 months ago

My use case would be to add automations based on the temperature of each room. If I understand you correctly, would this be possible?

Yes, that should be possible.

I am also missing the heating unit (Heizstab) for my Hygenic module to be able to see the energy usage in HA. Would it be possible to add this too?

AFAICT the Modbus interface doesn't really provide any information on electrical energy used other than current power usage ("Aktuelle Leistungsaufnahme"). If you're just interested in the amount of energy that went into your hot water, you may be able to use "Wärmemenge Warmwasser". However, that is kWh of heat energy (output) not electrical energy (input).

AndyNew2 commented 9 months ago

Just wanting to join the temperature sensors value. Good enough to see the values, no writing needed. That can be done through IDM App anyway. I need the temperature from the rooms to control other devices.

stefanschae commented 9 months ago

@AndyNew2 Same here. @kodebach: I have followed your tip regarding "Wärmemenge Warmwasser". It is an absolute figure added to the amount from the beginning. It is not possible to display the actual amount. Anyway, I'd love to see the temperature of my IDM heat pump. Thanks in advance!

kodebach commented 9 months ago

It took a little longer for me to find the time to implement it, but there is now support for the zone modules and individual rooms.

Since I cannot test it myself, I released the update as a beta version. Please update and report back, whether everything works as expected.

Please note: For now the integration adds entities for all possible heating circuits, zone modules and rooms. This creates over 500 entities, most of will always be Unavailable for most people. For a future version I plan to add a configuration option, so you can tell Home Assistant which circuits and rooms you are actually using.


How to update

To update to the beta version, you have to perform a few more steps than normally necessary:

  1. Open HACS in Home Assistant
  2. Select "Integrations" and then "IDM heat pump"
  3. In the top right corner open the drop down menu and select "Redownload"
  4. Enable "Show beta versions", wait for dialog to refresh, select and download the new version.
kodebach commented 9 months ago

I have followed your tip regarding "Wärmemenge Warmwasser". It is an absolute figure added to the amount from the beginning.

Yes, Home Assistant calls this a sensor with state class total_increasing. You can use an additional derivative sensor configured via YAML to get the rate of change. Possibly utility meter can help as well. There are probably other ways to do it as well. If you need more help, I'd suggest you ask on the Home Assistant forum. I'm sure there are other people who have done similar things for e.g. their electricity meter.

AndyNew2 commented 9 months ago

Hi, very good, thanks for support. I downloaded the beta and will try and report...

AndyNew2 commented 9 months ago

Hmm, seems not to work. I have loads of this entries in my log: 2023-09-30 19:48:38.126 ERROR (MainThread) [custom_components.idm_heatpump] Failed to fetch registers for group 2030: Exception Response(132, 4, IllegalAddress) 2023-09-30 19:48:38.129 ERROR (MainThread) [custom_components.idm_heatpump] Failed to fetch registers for group 2037: Exception Response(132, 4, IllegalAddress) 2023-09-30 19:48:38.130 ERROR (MainThread) [custom_components.idm_heatpump] Failed to fetch registers for group 2044: Exception Response(132, 4, IllegalAddress) 2023-09-30 19:48:38.131 ERROR (MainThread) [custom_components.idm_heatpump] Failed to fetch registers for group 2051: Exception Response(132, 4, IllegalAddress) 20

AndyNew2 commented 9 months ago

Can I send you the full log via E-Mail? I guess the groups are important for you?

AndyNew2 commented 9 months ago

Command back. It actually works. I see values in the updated integration. These errors are probably assigned to the non existing zones. Probably it would make sens to limit the number of zones and the max number of rooms per zones to limit these error messages and reducing the number of unneeded entities?

AndyNew2 commented 9 months ago

Checked the values, Looks promising. The values matches my Pro Display. Interesting to see to have a better resolution than in Pro. It rounds to 20.0 - 20.5 - 21.0 ... Your values are better and Pro seems always rounding up. So 20.1 --> 20.5 in Pro-Display. But nothing to change for you, great work.

kodebach commented 9 months ago

The errors are somewhat expected, yes. Some of them will be because of missing zone modules and non-existent rooms, others because the IDM Navigator doesn't seem to have a very stable modbus implementation and terminates the connection somewhat randomly.

I'll add configuration options before moving the update out of beta, so we can hopefully avoid some of these errors.

stefanschae commented 9 months ago

Updated and tested! Works great. Received 608 entities. The allocation to the correct rooms takes some time but it’s worth ist. Thank you so much!

Am 30.09.2023 um 19:05 schrieb Klemens Böswirth @.***>:

It took a little longer for me to find the time to implement it, but there is now support for the zone modules and individual rooms.

Since I cannot test it myself, I released the update as a beta version. Please update and report back, whether everything works as expected.

Please note: For now the integration adds entities for all possible heating circuits, zone modules and rooms. This creates over 500 entities, most of will always be Unavailable for most people. For a future version I plan to add a configuration option, so you can tell Home Assistant which circuits and rooms you are actually using.

How to update

To update to the beta version, you have to perform a few more steps than normally necessary:

Open HACS in Home Assistant Select "Integrations" and then "IDM heat pump" In the top right corner open the drop down menu and select "Redownload" Enable "Show beta versions", wait for dialog to refresh, select and download the new version. — Reply to this email directly, view it on GitHub https://github.com/kodebach/hacs-idm-heatpump/issues/34#issuecomment-1741815207, or unsubscribe https://github.com/notifications/unsubscribe-auth/BCWN65GSF6MH2A4EVHNE6GLX5BGN7ANCNFSM6AAAAAA47RP5XA. You are receiving this because you authored the thread.

kodebach commented 8 months ago

I just released v0.3.0-beta2. Now there are configuration options to select the used heat circuits, zone modules and rooms. This should reduce the errors produced by the integration, because of non-existent addresses.

Please backup before updating. While I'm fairly certain no data should be lost with the update, I cannot fully test it since I do not have the zone modules available. Especially if you renamed lots of entities like @stefanschae, a backup just in case may be a good idea.

AndyNew2 commented 8 months ago

Cool, will try and report...

AndyNew2 commented 8 months ago

Kodebach: Time to say "Thank you". That is great work. It seems it had been a little bit more effort than assumed to have this configurable zonemoduls and rooms. This implementation works great and removes all error logs on my integration. No longer "failed to fetch ...".

One question and one remark:

  1. Question: What does this status relay on room 9 to be selectable for each ZoneModule. I didn't activate it, since I am not aware of this status. What is linked to that relay?
  2. Remark on the heatcircuits: You made also the heatcircuits (Heizkreise) selectable. Very good, that is a win for me as well, since I have A and C and nothing else. However I noticed an unintented change, that will apply to all users, having current release installed: sensor.idm_warmepumpe_aktive_betriebsart_heizkreis_a becomes to sensor.idm_warmepumpe_aktive_betriebsart_heizkreis_a_2 That happens to all selected heatcircuits and its aligned entities. That means all heatcircuit related entities become unvalid and needs changing to XXXX_2. I don't think that was intended... Maybe an unknown automatism?
kodebach commented 8 months ago

What does this status relay on room 9 to be selectable for each ZoneModule. I didn't activate it, since I am not aware of this status. What is linked to that relay?

The Modbus documentation from IDM just calls it that. There is also a mention of output "A9". Some other docs I found said that the zone module supports 8 rooms and one extra room with less control. I assume this is just an extra relay inside the zone module. What you would use that for, I'm not sure. I just added to option to enable it (separate from the rest since it is the only sensor available for room 9)

However I noticed an unintented change, that will apply to all users, having current release installed [...] That means all heatcircuit related entities become unvalid and needs changing to XXXX_2.

~Yes, I noticed that too. I haven't found out why it happens though. I'll see if I can fix that before moving the release out of beta.~ EDIT: Fixed in v0.3.0-beta3.

kodebach commented 8 months ago

Of course... The moment I write the comment, I figure out what the issue is with the XXXX_2 entities. Should be fixed in v0.3.0-beta3 (just released). You'll have to delete the XXXX_2 entities manually, if you had v0.3.0-beta2 installed.

AndyNew2 commented 8 months ago

Updated to beta3. Nearly perfect ;-) Thanks again, that was quick! Just noticed a few glitches, don't know, if that is aligned to me, or you see it similar. It seems it affects only heatcircuilt C and it seems it is mixed up with E. But only in two cases, all other heatcircuit related values are OK.

Name: IDM_Wärmepumpe: Heizgrenze HK B but entity: sensor.idm_warmepumpe_heizgrenze_hk_c --> no longer valid Name: IDM_Wärmepumpe: Heizgrenze HK C but entity: sensor.idm_warmepumpe_heizgrenze_hk_e --> valid but seems mixed up

Name: IDM_Wärmepumpe: Sollvorlauftemperatur HK B (Konstant-HK) but entity: sensor.idm_warmepumpe_sollvorlauftemperatur_hk_c_konstant_hk --> no longer valid Name: IDM_Wärmepumpe: Sollvorlauftemperatur HK C (Konstant-HK) but entity: sensor.idm_warmepumpe_sollvorlauftemperatur_hk_e_konstant_hk --> valid but seems mixed up

kodebach commented 8 months ago

Ah no the issue here is that in versions before v0.3.0-beta the addresses for these values were incorrect. The values are now correct and you can safely rename the two entities to fix the issue.

The change was here https://github.com/kodebach/hacs-idm-heatpump/commit/aa57d8bb5b1c0cfe1cd39e8fc1cbc9877193c34b. Before enabling circuits E, F, G this worked fine, but read incorrect values. Specifically the entities named B read the values for C and the ones named C read the values for E. With the extra circuits enabled, I noticed the error, because E tried to read values for H, which doesn't exist. Now everything reads the correct values.

Because of the way user-visible entity names and hidden unique_ids are matched up in Home Assistant this means that you now see a wrong name. But that's only because Home Assistant tries to preserve the name. Which is normally a good thing, but not if the original name was wrong. I don't think I can fix that in the integration. So you'll have to rename the two entities. Note: I tested on a clean Home Assistant install and new users do get the correct names, so I think it's better to keep it this way.

kodebach commented 8 months ago

I added a section about this name confusion to the release notes. For anyone reading it here:

In the entity ids mentioned in the comment above (https://github.com/kodebach/hacs-idm-heatpump/issues/34#issuecomment-1752127347) simply replace _c with _b and _e with _c to correct the issue.

AndyNew2 commented 8 months ago

Don't worry, once I figured out how to change entity names, will do and report. No issue. Thanks for support.

kodebach commented 8 months ago

Oh that's easy:

AndyNew2 commented 8 months ago

Yes worked as described. Now all entities are fine. Just another notice: sensor.idm_warmepumpe_parallelverschiebung_hk_c has a unit %, but it should have °C Just spotted that, hopefully an easy change...

kodebach commented 8 months ago

has a unit %, but it should have °C

Fixed in v0.3.0-beta4

AndyNew2 commented 8 months ago

Just tried beta4, however no success: Do I need to upgrade HA? 2023-10-17 18:49:13.383 ERROR (MainThread) [custom_components.idm_heatpump] error Traceback (most recent call last): File "/config/custom_components/idm_heatpump/coordinator.py", line 31, in _async_update_data return await self.heatpump.async_get_data() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/idm_heatpump/idm_heatpump.py", line 147, in async_get_data groups = await asyncio.gather( ^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/idm_heatpump/idm_heatpump.py", line 129, in _fetch_sensors data[sensor.name] = sensor.decode(decoder) ^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/idm_heatpump/sensor_addresses.py", line 211, in decode return self.enum(value) ^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/enum.py", line 712, in call return cls.new(cls, value) ^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/enum.py", line 1128, in new raise ve_exc ValueError: 52429 is not a valid RoomMode 2023-10-17 18:49:13.398 WARNING (MainThread) [homeassistant.config_entries] Config entry 'IDM_Wärmepumpe' for idm_heatpump integration not ready yet; Retrying in background 2023-10-17 18:49:28.735 ERROR (MainThread) [custom_components.idm_heatpump] error Traceback (most recent call last): File "/config/custom_components/idm_heatpump/coordinator.py", line 31, in _async_update_data return await self.heatpump.async_get_data() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/idm_heatpump/idm_heatpump.py", line 147, in async_get_data groups = await asyncio.gather( ^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/idm_heatpump/idm_heatpump.py", line 129, in _fetch_sensors data[sensor.name] = sensor.decode(decoder) ^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/idm_heatpump/sensor_addresses.py", line 211, in decode

kodebach commented 8 months ago

Hm, seems the heat pump is sending the value 52429 for one of the "Betriebsart Raum" sensors, but my code only expects the value 0-4 (those are defined in the Modbus documentation from IDM I have).

I think you should be able to downgrade back to beta3 via the update procedure described in https://github.com/kodebach/hacs-idm-heatpump/issues/34#issuecomment-1741815207 (just select beta3 instead of the newest version). Until I have time to fix the problem, I'm afraid beta4 won't work for you.

To fix the issue, it would be helpful, if you could post a list of the values that you've seen for your "Betriebsart Raum" sensors. Maybe I can figure out why such a completely wrong value is read... Oh and maybe compare what Home Assistant says with would you see in the official IDM interfaces and tell me if it doesn't match.

AndyNew2 commented 8 months ago

Yes I noticed this earlier, but this is not really relevant for me. Since my heating is still off, this value means currently not operational. I will try and find out for you. Of course I was able to downgrade and that solves the issue..

AndyNew2 commented 8 months ago

Very crazy checked the documentation, you are right, but it is the same for the "Parallelverschiebung HK A" they stating the unit % but this is wrong. How can I find the values I actually receive, since the beta3 works without that message?

kodebach commented 8 months ago

Since you said your heating is currently off, I probably just need to set "value unavailable" for any unknown values. So no need for you to do anything for now.

AndyNew2 commented 8 months ago

That will work anyway and is a good idea to make your implementation robust. It shall not stop if a few unexpected values are received. What is confusing, I am now back to beta 3 and all Values seems valid. Since the display is "Aus" for these roomsensors. Or did beta 3 implement everything not expected as "Aus"? That would explain it. If you want, you can make a beta 5, which logs the values and I try the different modes and provide you with the values. But anyhow, these modes are not so important, so your first idea maybe a reasonable way forward.

kodebach commented 8 months ago

v0.3.0-beta5 has been released. I hope that fixes the issue with unknown values. If you encounter an incorrectly reported value, please enable debug logging, wait for the integration to refresh the sensor values and report back with the logs.

AndyNew2 commented 8 months ago

just tried beta5, works fine. Everything looks good, will report in more detail later...

AndyNew2 commented 8 months ago

What I just spottet: There are a few internal Parameters missing in the iDM integration. B2 Durchflußsensor Heizung B71 Heißgastemperatur 1 B86 Kondensationsdruck 1

These are all quite important parameters, always good to have a view on and see wrong developments. Could you add them to the integration? Shall I create an issue for this?

kodebach commented 8 months ago

See #42 regarding the missing parameters

AndyNew2 commented 8 months ago

I tested beta5 in more detail. I think we can finish the beta and release it. Seems everything works well. I noticed I have two rooms returning unvalid values for the room mode. It is always one of the last sensors on a zonemodule. Seems the datalines are not good enough. This affects luckily only the room mode and seems not to affect anything else. Your current implementation by showing "Unbekannt" is good enough. In case the sensor recovers it would show the proper value...

2023-10-19 20:44:07.220 DEBUG (MainThread) [custom_components.idm_heatpump] decoded registers 1870 2023-10-19 20:44:07.270 DEBUG (MainThread) [custom_components.idm_heatpump] got registers 2000 2023-10-19 20:44:07.270 DEBUG (MainThread) [custom_components.idm_heatpump] got decoder 2000 2023-10-19 20:44:07.271 DEBUG (MainThread) [custom_components.idm_heatpump] Couldn't read value for zone_1_room_4_mode Traceback (most recent call last): File "/config/custom_components/idm_heatpump/sensor_addresses.py", line 215, in decode return self.enum(value) ^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/enum.py", line 712, in call return cls.new(cls, value) ^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/enum.py", line 1128, in new raise ve_exc ValueError: 52429 is not a valid RoomMode 2023-10-19 20:44:07.272 DEBUG (MainThread) [custom_components.idm_heatpump] decoded registers 2000 2023-10-19 20:44:07.320 DEBUG (MainThread) [custom_components.idm_heatpump] got registers 2065 2023-10-19 20:44:07.321 DEBUG (MainThread) [custom_components.idm_heatpump] got decoder 2065 2023-10-19 20:44:07.321 DEBUG (MainThread) [custom_components.idm_heatpump] Couldn't read value for zone_2_room_4_mode Traceback (most recent call last): File "/config/custom_components/idm_heatpump/sensor_addresses.py", line 215, in decode return self.enum(value) ^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/enum.py", line 712, in call return cls.new(cls, value) ^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/enum.py", line 1128, in new raise ve_exc ValueError: 52429 is not a valid RoomMode 2023-10-19 20:44:07.323 DEBUG (MainThread) [custom_components.idm_heatpump] decoded registers 2065 2023-10-19 20:44:07.371 DEBUG (MainThread) [custom_components.idm_heatpump] got registers 2130 2023-10-19 20:44:07.371 DEBUG (MainThread) [custom_components.idm_heatpump] got decoder 2130 2023-10-19 20:44:07.372 DEBUG (MainThread) [custom_components.idm_heatpump] decoded registers 2130 2023-10-19 20:44:07.421 DEBUG (MainThread) [custom_components.idm_heatpump] got registers 2195 2023-10-19 20:44:07.422 DEBUG (MainThread) [custom_components.idm_heatpump] got decoder 2195 2023-10-19 20:44:07.422 DEBUG (MainThread) [custom_components.idm_heatpump] decoded registers 2195

kodebach commented 8 months ago

Actually, one last attempt: Could you please add the following to your configuration.yaml in Home Assistant:

logger:
  default: critical
  logs:
    pymodbus: debug
    custom_components.idm_heatpump: debug

Note: This disables basically all log messages from anything but pymodbus and this integration, which are set to log absolutely everything. That should make it possible to see, what was actually sent between Home Assistant and the heat pump.

Then restart Home Assistant, wait until the the integration as loaded the values and download the full logs from Settings -> System -> Logs. You can upload the file here by dragging it into the comment box (don't copy paste, it's gonna be long...). But before you upload, please make sure the file doesn't contain any personal information, the file will be public after all. Afterwards, you should restore your configuration.yaml.

If this doesn't work, the only option would to ask IDM about the 52429 value, which could actually mean something. It seems consistent and is rather specific, it's 0xCCCD in hex and 1100 1100 1100 1101 in binary. That doesn't really seem random...

AndyNew2 commented 8 months ago

Don't worry too much about my mode values. I am quite sure they are corrupted. I have 5 Zonemoduls and 2 of them delivers that value for the last member of their chain. There might have been done installations wrong (terminator wrongly configured) or something else. I had a lot of difficulties during installation with the affected services. I am happy getting the needed values.

However I still can do what you proposed and give you the result, will take a while, maybe tonight. However I am pretty sure these values means nothing and are just corrupted.

kodebach commented 8 months ago

What does the official IDM interface show for these items? As long as you don't see any real values in the IDM interface, that the integration isn't showing it's probably not an issue in the integration.

However I still can do what you proposed and give you the result, will take a while, maybe tonight. However I am pretty sure these values means nothing and are just corrupted.

Up to you. I won't have time to work on this before Sunday anyway. I also agree with you that it can be released out of beta in the current state. So if you don't want to investigate further, I'll just release it as-is.

AndyNew2 commented 8 months ago

No worry. I will support you. Here is the desired log. home-assistant_2023-10-20T12-46-22.707Z.log

kodebach commented 8 months ago

I had a quick look at the logs. The values are the same throughout the log, but are different for each sensor and different from previous 52429 value. So they probably are garbage values.

I released v0.3.0 with no changes from v0.3.0-beta5.