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

power current unavailable, when cooling is active #126

Closed
AndyNew2 opened this issue Jul 1, 2024 · 21 comments
Closed

power current unavailable, when cooling is active #126

AndyNew2 opened this issue Jul 1, 2024 · 21 comments

Comments

@AndyNew2
Copy link

AndyNew2 commented Jul 1, 2024

Easy to reproduce and fix isse:
When the iDM heatpump is in cooling mode, the reported "power current" - "Momentanleistung" is actually negative.
Due to current checks in the integration, the negative values are ignored and a "Unavailable" or "Unbekannt" is shown instead.
Easy to fix:

Just remove following line:
File sensor_addresses.py
Around line 997 (when address is set to 1790)
Remove the line with " min_value=0,"
Save it, and restart Home Assistant.

After that the negative power current is shown.

@simowNgithub
Copy link

@kodebach is it a general issue? for me „momentanleistung“ is always dead after starting any idm process… heating… cooling…

image

kodebach added a commit that referenced this issue Sep 1, 2024
these seem to be negative when cooling instead of heating

close #126
@kodebach
Copy link
Owner

kodebach commented Sep 1, 2024

@buster3 @simowNgithub I released v0.9.0-beta.1 (see #128) please test, if the issue is fixed.

@simowNgithub
Copy link

simowNgithub commented Sep 3, 2024

@buster3 @simowNgithub I released v0.9.0-beta.1 (see #128) please test, if the issue is fixed.

Thx a lot! I tried to install with hacs beta the v0.9.0-beta.2 download, but the download always fails. Older versions / non-beta versions are working. Is there something special to implement? I‘m using the latest HA versions.

@kodebach
Copy link
Owner

kodebach commented Sep 3, 2024

I tried to install with hacs beta the v0.9.0-beta.2 download, but the download always fails.

see #132

@simowNgithub
Copy link

I tried to install with hacs beta the v0.9.0-beta.2 download, but the download always fails.

see #132

Installation worked now. But the version fails with following logs:

Logger: homeassistant.setup
Quelle: setup.py:334
Erstmals aufgetreten: 17:03:19 (1 Vorkommnisse)
Zuletzt protokolliert: 17:03:19

Setup failed for custom integration 'idm_heatpump': Unable to import component: No module named 'pymodbus.register_read_message'
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/setup.py", line 334, in _async_setup_component
    component = await integration.async_get_component()
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/loader.py", line 1027, in async_get_component
    self._component_future.result()
  File "/usr/src/homeassistant/homeassistant/loader.py", line 1007, in async_get_component
    comp = await self.hass.async_add_import_executor_job(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/loader.py", line 1067, in _get_component
    ComponentProtocol, importlib.import_module(self.pkg_path)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/util/loop.py", line 200, in protected_loop_func
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/importlib/__init__.py", line 90, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 995, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "/config/custom_components/idm_heatpump/__init__.py", line 32, in <module>
    from .coordinator import IdmHeatpumpDataUpdateCoordinator
  File "/config/custom_components/idm_heatpump/coordinator.py", line 11, in <module>
    from .idm_heatpump import IdmHeatpump
  File "/config/custom_components/idm_heatpump/idm_heatpump.py", line 13, in <module>
    from pymodbus.register_read_message import ReadInputRegistersResponse
ModuleNotFoundError: No module named 'pymodbus.register_read_message'

@kodebach
Copy link
Owner

kodebach commented Sep 3, 2024

I will investigate further

@kodebach
Copy link
Owner

kodebach commented Sep 3, 2024

Please try 0.9.0-beta.4

@simowNgithub
Copy link

Please try 0.9.0-beta.4

Logger: homeassistant.setup
Quelle: setup.py:334
Erstmals aufgetreten: 22:23:57 (1 Vorkommnisse)
Zuletzt protokolliert: 22:23:57

Setup failed for custom integration 'idm_heatpump': Unable to import component: No module named 'pymodbus.pdu.register_read_message'; 'pymodbus.pdu' is not a package
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/setup.py", line 334, in _async_setup_component
    component = await integration.async_get_component()
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/loader.py", line 1027, in async_get_component
    self._component_future.result()
  File "/usr/src/homeassistant/homeassistant/loader.py", line 1007, in async_get_component
    comp = await self.hass.async_add_import_executor_job(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/loader.py", line 1067, in _get_component
    ComponentProtocol, importlib.import_module(self.pkg_path)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/util/loop.py", line 200, in protected_loop_func
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/importlib/__init__.py", line 90, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 995, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "/config/custom_components/idm_heatpump/__init__.py", line 32, in <module>
    from .coordinator import IdmHeatpumpDataUpdateCoordinator
  File "/config/custom_components/idm_heatpump/coordinator.py", line 11, in <module>
    from .idm_heatpump import IdmHeatpump
  File "/config/custom_components/idm_heatpump/idm_heatpump.py", line 13, in <module>
    from pymodbus.pdu.register_read_message import ReadInputRegistersResponse
ModuleNotFoundError: No module named 'pymodbus.pdu.register_read_message'; 'pymodbus.pdu' is not a package

@kodebach
Copy link
Owner

kodebach commented Sep 4, 2024

Seems there was a version conflict of the pymodbus library with the modbus integration in Home Assistant. The library seems to have breaking changes constantly, very annoying. I hope 0.9.0-beta.5 works.

@simowNgithub
Copy link

Seems there was a version conflict of the pymodbus library with the modbus integration in Home Assistant. The library seems to have breaking changes constantly, very annoying. I hope 0.9.0-beta.5 works.

Yes, you're right. You see this on the release notes of other integrations, everyone is changing his python modbus stuff...

I tried beta.5 but still:

Quelle: setup.py:334
Erstmals aufgetreten: 13:09:54 (1 Vorkommnisse)
Zuletzt protokolliert: 13:09:54

Setup failed for custom integration 'idm_heatpump': Unable to import component: No module named 'pymodbus.register_read_message'
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/setup.py", line 334, in _async_setup_component
    component = await integration.async_get_component()
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/loader.py", line 1027, in async_get_component
    self._component_future.result()
  File "/usr/src/homeassistant/homeassistant/loader.py", line 1007, in async_get_component
    comp = await self.hass.async_add_import_executor_job(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/loader.py", line 1067, in _get_component
    ComponentProtocol, importlib.import_module(self.pkg_path)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/util/loop.py", line 200, in protected_loop_func
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/importlib/__init__.py", line 90, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 995, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "/config/custom_components/idm_heatpump/__init__.py", line 33, in <module>
    from .coordinator import IdmHeatpumpDataUpdateCoordinator
  File "/config/custom_components/idm_heatpump/coordinator.py", line 11, in <module>
    from .idm_heatpump import IdmHeatpump
  File "/config/custom_components/idm_heatpump/idm_heatpump.py", line 12, in <module>
    from pymodbus.register_read_message import ReadInputRegistersResponse
ModuleNotFoundError: No module named 'pymodbus.register_read_message'

@kodebach
Copy link
Owner

kodebach commented Sep 4, 2024

Ok, another attempt with 0.9.0-beta.6.

It seems that there was not just a version conflict, but also the updated release workflow (#102) did not correctly put the requirements.txt into manifest.json.

@simowNgithub
Copy link

Ok, another attempt with 0.9.0-beta.6.

It seems that there was not just a version conflict, but also the updated release workflow (#102) did not correctly put the requirements.txt into manifest.json.

seems to work now, i will share feedback after some days in usage 👍 thx for releasing 🫶🏻

@simowNgithub
Copy link

@kodebach sorry, bad news, when starting the heating process the power value still stop working.

image

@kodebach
Copy link
Owner

kodebach commented Sep 5, 2024

Do you see any error messages in the Home Assistant logs? If not could you please try enabling Debug Logging for the integration and then attaching the file here.

Without the min_value restriction any value sent from the heat pump should be visible in Home Assistant, so it seems there is another issue.

@AndyNew2
Copy link
Author

AndyNew2 commented Sep 5, 2024

Very annoying for everybody is the pymodbus implementation in HA seems getting constantly worse instead improving. All helpful means of reset and stability workarounds seemed to get removed by the crazy spanish maintainer of pymodbus. Maybe we should complain?
I did no longer update HA because of pymodbus to avoid conflicts. I had to change every script about 3 - 4 times this year, alwas because of pymodbus. Since he announced to remove the restart feature, I have no longer a idea to keep modbusTCP stable. I tried to explain the maintainer, but seems he did not understand....

@AndyNew2
Copy link
Author

AndyNew2 commented Sep 5, 2024

@kodebach Just for my understanding, your integration is build on the pyMobus implementation of HA or you have your own modbus implementation?

@AndyNew2
Copy link
Author

AndyNew2 commented Sep 5, 2024

@simowNgithub Your power value seems to stop always after a while, when the heatpump works, correct? It do not matter if positive or negative? If that is the case, I would propose to raise another issue, or kodebach splits this one into a further issue.
I do not have that problem. I just get unavailable, when the heatpump is in cooling mode, because the value gets negative. Your issue actually seems different, can you confirm?

@kodebach
Copy link
Owner

kodebach commented Sep 6, 2024

Just for my understanding, your integration is build on the pyMobus implementation of HA or you have your own modbus implementation?

The integration uses the https://github.com/pymodbus-dev/pymodbus library, HA also uses it for the generic modbus integration.

@kodebach
Copy link
Owner

kodebach commented Sep 6, 2024

Very annoying for everybody is the pymodbus implementation in HA seems getting constantly worse instead improving.

I wouldn't say that. Functionally the library works fine AFAICT. However, pymodbus does use an odd versioning scheme that is likely the cause of most issues.

Most libraries that use X.Y.Z versions use the Semantic Versioning rules. Which makes depending on the library really easy. As long as you don't switch from X to X+1 everything works fine, switching Y to Y+1 or Z to Z+1 is never an issue.

Pymodbus uses a different scheme. To quote their README:

Our releases is defined as X.Y.Z, and we have strict rules what to release when:

Z, No API changes! bug fixes and smaller enhancements.
Y, API changes, bug fixes and bigger enhancements.
X, Major changes in API and/or method to use pymodbus

With this scheme you can only go from Z to Z+1 without issues. It's their choice, but personally, I'd never use a scheme like that, because it is to subjective. What is a "smaller enhancement" and when is it a "bigger enhancement"? What is an "API change" and what is a "major API change"?

AFAICT they only decided on this scheme, or only explained it last month (pymodbus-dev/pymodbus@dfef372), which explains why everybody had trouble with updates.

@AndyNew2
Copy link
Author

AndyNew2 commented Sep 6, 2024

@kodebach Yes that is the one, I suffered many times this year. The guys ID is janiversen and seems to develop the pymodbus in the wrong direction.

I do not talk about HA integration or sematic versioning. I talk about modbusTCP functionality he broke several times this year and many users complaint. By the way he is good in removing issues by just closing them but not solving...

  1. When using native modbus integration in HA, you need to define at least on entity. This was not the case last year and was the first breaking change. I use your integration for reading and juse use the native one for writing a few registers when needed. This can't be understood by that guy...
  2. Now after restart, you have to wait a little time. Before pymodbus synchronized that themselves, now gone...
  3. restart will disappear in Nov. I have no idea how to ensure a modbus write workes, because we know IDMs modbusTCP connection are not as reliable as we wanted it to be. A simple restart before write solved the issue till now....

I am quite annoyed (as other users), this guy alsways states, it is against the spec. blabla... I had a few discussions with him and others as well. It ends like, please do it yourself....
Of course he could say so, but why did he put effort in breaking a good working library by changing it? For me crazy. He ignores, modbusTCP devices are not always working against spec, The previous pymodbus implementation gave you workarounds like the restart, which will disappear in Nov. this year.... Oh my good....

@kodebach
Copy link
Owner

kodebach commented Sep 6, 2024

@simowNgithub I created #134 for your issue. @AndyNew2 I created #133 for your off-topic issue. If the original issue still happens in the current beta version, please reopen this issue.

@kodebach kodebach closed this as completed Sep 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants