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

Warmwasser push does not work #50

Closed
StijnVdd opened this issue Nov 25, 2024 · 8 comments
Closed

Warmwasser push does not work #50

StijnVdd opened this issue Nov 25, 2024 · 8 comments

Comments

@StijnVdd
Copy link

StijnVdd commented Nov 25, 2024

Describe the bug
I've been playing around with the translations, when I observed an error when selecting the warmwasser push options. As that version is unstable, I installed version 1.0.3 again and I have the same error

Logger: homeassistant.components.automation.warm_water_push
Source: components/automation/__init__.py:743
integration: Automation (documentation, issues)
First occurred: 13:58:29 (2 occurrences)
Last logged: 14:00:00

While executing automation automation.warm_water_push
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/automation/__init__.py", line 743, in async_trigger
    return await self.action_script.async_run(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1801, in async_run
    return await asyncio.shield(create_eager_task(run.async_run()))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 464, in async_run
    await self._async_step(log_exceptions=False)
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 528, in _async_step
    self._handle_exception(
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 558, in _handle_exception
    raise exception
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 526, in _async_step
    await getattr(self, handler)()
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 764, in _async_call_service_step
    response_data = await self._async_run_long_action(
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 727, in _async_run_long_action
    return await long_task
           ^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2802, in async_call
    response_data = await coro
                    ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/core.py", line 2845, in _execute_service
    return await target(service_call)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 1007, in entity_service_call
    single_response = await _handle_entity_call(
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 1079, in _handle_entity_call
    result = await task
             ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/select/__init__.py", line 188, in async_handle_select_option
    await self.async_select_option(option)
  File "/config/custom_components/weishaupt_modbus/entities.py", line 475, in async_select_option
    await self.set_translate_val(option)
  File "/config/custom_components/weishaupt_modbus/entities.py", line 283, in set_translate_val
    await mbo.setvalue(val)
  File "/config/custom_components/weishaupt_modbus/modbusobject.py", line 267, in setvalue
    await self._modbus_client.write_register(
  File "/usr/local/lib/python3.12/site-packages/pymodbus/client/base.py", line 162, in async_execute
    packet = self.framer.buildPacket(request)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/pymodbus/framer/socket_framer.py", line 105, in buildPacket
    data = message.function_code.to_bytes(1, 'big') + message.encode()
                                                      ^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/pymodbus/register_write_message.py", line 50, in encode
    packet += struct.pack(">H", self.value)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
struct.error: 'H' format requires 0 <= number <= 65535

To Reproduce
Select any option in the select.warmwasser_push entity

Expected behavior
The selection amount of minutes to be 'pushed' to the heat pump

@StijnVdd StijnVdd changed the title Warmwasse push does not work Warmwasser push does not work Nov 25, 2024
@OStrama
Copy link
Owner

OStrama commented Nov 25, 2024

Please try 1.0.4pre. At least on my production system Ww Push works

@StijnVdd
Copy link
Author

Hi,

Version 1.0.4pre does work, the WW push does what it is supposed to do. Thanks a lot!

I installed 1.0.4pre and despite the selection of 'old-namestyle' the integration created new devices and entities.

I then deleted everything, and added the integration again. Now all the entities are in English (which I honestly prefer over the german ones) and everything is translated into English.

I'm not sure if this is intentional or rather a coincidence as my browser and thus my profile are set to English on my PC (dutch on my mobile phone). If my browser would be set to German, would it than add German entitties?

I do notice the state of some entities is a bit off.
example: heat_pump_operation shows in the developer console
image

but in the device overview:
image

Should I open a new issue for this as the original one is indeed fixed.

@MadOne
Copy link
Collaborator

MadOne commented Nov 26, 2024

Hi,

homeassistant has its own language selection. I think this is the one that counts. (but not 100% sure)
image

Fallback (if no file for the selected language exists) is strings.json.(german).
@OStrama i think we should change this to englisch btw.

Your screenshots are ok. I'll explain:

The entity Heat pump Operation (friendly name "Heat Pump operation" has the value hp_betrieb_19

hp_betrieb_19 (translation key) has the english translation of "Heating Mode)

@StijnVdd
Copy link
Author

so this means that inside automations and scripts, I need to use hp_betrieb_19. This makes it a bit hard to read the automation or troubleshoot. Is there a possibility to, for example, add an attribute to the entity that houses the English translation of hp_betrieb_19? That way I can use this attribute in the automations and scripts.

@MadOne
Copy link
Collaborator

MadOne commented Nov 26, 2024

We could rewrite thentranslation keys to meaningfull names.

hp_betrieb_heating_mode.

I used the numbers cause it was quicker. This has to be done in: hpconst.py, strings.json, de.json, en.json and your files.

@StijnVdd
Copy link
Author

I like your idea!

That would indeed make it more user friendly.

@MadOne
Copy link
Collaborator

MadOne commented Nov 26, 2024

Pull requests welcome ;)

@MadOne
Copy link
Collaborator

MadOne commented Nov 26, 2024

I will close this here.

Further discussion of translation feater should be in #30

@MadOne MadOne closed this as completed Nov 26, 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