core icon indicating copy to clipboard operation
core copied to clipboard

MODBUS Climate lacks option to set HVAC_Modes

Open stefanschaedeli opened this issue 1 year ago • 26 comments

The problem

I try to manage my Boiler temperature and operation mode with the Climate module, which works great for the temp setting. Unfortunately, I can define the register for and the options of operating modes (the config is not accepted, nor ca I change in the GUI etc.

What version of Home Assistant Core has the issue?

core-2022.10.5

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant Supervised

Integration causing the issue

Modbus TCO

Link to integration documentation on our website

https://www.home-assistant.io/integrations/modbus/

Diagnostics information

No response

Example YAML snippet

- name: "HovalConnect"
  type: tcp
  host: 10.11.11.8
  port: 502

#Climate  
  climates:
    - name: "Hoval Boiler"
      address: 1500
      input_type: holding
      count: 1
      max_temp: 60
      min_temp: 45
      offset: 0
      precision: 1
      scale: 0.1
      target_temp_register: 1497
      temp_step: 1
      temperature_unit: C
      hvac_modes: "standby,Woche 1, Konstant"

Anything in the logs that might be useful for us?

No response

Additional information

It would be enough for me that I can set the modes and chose it from there and use another automation to do the actuall change of the operation mode. I'm just hoping I can get rid of my other "drop down" selector of the operation mode

stefanschaedeli avatar Oct 22 '22 15:10 stefanschaedeli

Hey there @adamchengtkc, @janiversen, @vzahradnik, mind taking a look at this issue as it has been labeled with an integration (modbus) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of modbus can trigger bot actions by commenting:

  • @home-assistant close Closes the issue.
  • @home-assistant rename Awesome new title Change the title of the issue.
  • @home-assistant unassign modbus Removes the current integration label and assignees on the issue, add the integration domain after the command.

(message by CodeOwnersMention)


modbus documentation modbus source (message by IssueLinks)

home-assistant[bot] avatar Oct 22 '22 15:10 home-assistant[bot]

The problem is that there are no standard way of settings the hvac mode. If you know how to do it on your system define an extra register and use that.

janiversen avatar Oct 22 '22 16:10 janiversen

The problem is that there are no standard way of settings the hvac mode. If you know how to do it on your system define an extra register and use that.

Thanks for the feedback, I have the register for that already, but how can I use it in the climate config?

stefanschaedeli avatar Oct 23 '22 09:10 stefanschaedeli

you cannot it is separate. But you can add automation that combines the two.

janiversen avatar Oct 23 '22 09:10 janiversen

Sorry, now I got confused :D How would I combine with automation, I have only one setting which is auto:

` if CONF_HVAC_MODE_REGISTER in config: mode_config = config[CONF_HVAC_MODE_REGISTER] self._hvac_mode_register = mode_config[CONF_ADDRESS] self._attr_hvac_modes = cast(list[HVACMode], []) self._attr_hvac_mode = None self._hvac_mode_mapping: list[tuple[int, HVACMode]] = [] mode_value_config = mode_config[CONF_HVAC_MODE_VALUES] for hvac_mode in HVACMode: if hvac_mode.value in mode_value_config: self._hvac_mode_mapping.append( (mode_value_config[hvac_mode.value], hvac_mode) ) self._attr_hvac_modes.append(hvac_mode) else: # No HVAC modes defined self._hvac_mode_register = None self._attr_hvac_mode = HVACMode.AUTO self._attr_hvac_modes = [HVACMode.AUTO]

`

The code is indicating that I could pass a information about the modes, but it fails back to only having auto.

stefanschaedeli avatar Oct 23 '22 10:10 stefanschaedeli

The modbus integration does not support setting of HVAC_MODE ! so if you want it integrated you need to write some automation and combine the extra register with the modbus climate.

janiversen avatar Oct 23 '22 14:10 janiversen

okey, understood. do you have any example or direction on how the "combin the extra register with modbus climate" ?

stefanschaedeli avatar Oct 23 '22 14:10 stefanschaedeli

no, I have next to none experience with automation scripts, I am a developer.

janiversen avatar Oct 23 '22 14:10 janiversen

#73906 handles this case exactly, it has just been merged.

avishorp avatar Oct 30 '22 20:10 avishorp

#73906 handles this case exactly, it has just been merged.

amazing :D thanks for confirmation :) Do you have any idea in which production release this could be in?

stefanschaedeli avatar Oct 31 '22 06:10 stefanschaedeli

It has been merged to the "next" branch, so I suppose it's going to be in the next version, but I'm not sure.

‫בתאריך יום ב׳, 31 באוק׳ 2022 ב-8:20 מאת ‪stefanschaedeli‬‏ <‪ @.***‬‏>:‬

#73906 https://github.com/home-assistant/core/pull/73906 handles this case exactly, it has just been merged.

amazing :D thanks for confirmation :) Do you have any idea in which production release this could be in?

— Reply to this email directly, view it on GitHub https://github.com/home-assistant/core/issues/80780#issuecomment-1296592414, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJCMMUG6DIFT4Y7HUIQ5JTWF5QK7ANCNFSM6AAAAAARL4QDBA . You are receiving this because you commented.Message ID: @.***>

avishorp avatar Oct 31 '22 07:10 avishorp

It has been merged to the "next" branch, so I suppose it's going to be in the next version, but I'm not sure.

Okey, thanks anyhow :) looking forward for this, thank you for your efforts :) Do you have a "BuyMeACoffee" or something?

stefanschaedeli avatar Oct 31 '22 16:10 stefanschaedeli

wop wop, its in the November release ! :)

Tried it out but get an issue unfortuntely ->

climates: - name: "Hoval Boiler" address: 1500 input_type: holding count: 1 max_temp: 60 min_temp: 45 offset: 0 precision: 1 scale: 0.1 target_temp_register: 1497 temp_step: 0.2 temperature_unit: C hvac_mode_register: address: 1496 values: auto: 1 off: 0 heat: 4

Invalid config for [modbus]: [False] is an invalid option for [modbus]. Check: modbus->modbus->0->climates->0->hvac_mode_register->values->False. (See /config/configuration.yaml, line 61).

stefanschaedeli avatar Nov 03 '22 14:11 stefanschaedeli

I think you need to advise the author of the commit, otherwise he might not be aware of the issue.

janiversen avatar Nov 03 '22 18:11 janiversen

I just checked this section in my configuration and it passes without any problem. Can you attach your entire file? Can you double check that the error is indeed caused by the new section (hvac_mode_register)?

avishorp avatar Nov 03 '22 20:11 avishorp

I just checked this section in my configuration and it passes without any problem. Can you attach your entire file? Can you double check that the error is indeed caused by the new section (hvac_mode_register)?

Thanks for the support: here my config file for the modbus: modbus.yaml.zip

I have only added the follwoing lines to the climate configs: hvac_mode_register: address: 1496 values: off: 0 auto: 1

If I remove thouse, the config runs without errors:

stefanschaedeli avatar Nov 04 '22 08:11 stefanschaedeli

I'm having a similar issue, when i check the config it return this error: Invalid config for [modbus]: [False] is an invalid option for [modbus]. Check: modbus->modbus->0->climates->0->hvac_mode_register->values->False. (See /config/configuration.yaml, line 152).

attached the yaml file which is under /config/modbus/climates folder

On configuration.yaml I have rows with

modbus:
  - type: tcp
    host: 192.168.x.x
    port: 9000
    climates: !include_dir_merge_list modbus/climates
    sensors: !include_dir_merge_list modbus/sensors

1stFloor.yaml.txt

twproject avatar Nov 04 '22 19:11 twproject

@adamchengtkc, @janiversen, @vzahradnik

1 step ahead, 2 step behind I found the problem is on off: parameter. Infact If I remove it, i'm able to compile and the climate quite works. If I had off: I receive the error

Invalid config for [modbus]: [False] is an invalid option for [modbus]. Check: modbus->modbus->0->climates->0->hvac_mode_register->values->False. (See /config/configuration.yaml, line 152).

release HA Home Assistant 2022.11.1 Supervisor 2022.10.2 Operating System 9.3

working code (off is commented):

###############################################    
# 1st Floor
###############################################

  - name: Kitchen
    slave: 11
    address: 02
    target_temp_register: 007
    hvac_mode_register:
      address: 12
      values:
        cool: 7
        heat: 3
        #off: 1
    precision: 1
    max_temp: 30
    min_temp: 15
    temp_step: 0.1
    data_type: int16
    count: 1
    scale: 0.1
    offset: 0

twproject avatar Nov 05 '22 14:11 twproject

@twproject @avishorp

Can confirm the same. Once there is not off mode definition its all fine

maybe the hvac_onoff_register: is required ?

stefanschaedeli avatar Nov 05 '22 15:11 stefanschaedeli

I managed to reproduce. It can be solved by adding quotation marks around the word off :

    hvac_mode_register:
      address: 12
      values:
        "off": 0
        cool: 7
        heat: 3

I will update it in the documentation.

avishorp avatar Nov 05 '22 15:11 avishorp

This need to be corrected, and not only updated in the documentation, please !!

janiversen avatar Nov 05 '22 15:11 janiversen

With "off" it works like a charm. To be clear in documentation probably is better to add "" on all values instead only on "off" ?

twproject avatar Nov 05 '22 15:11 twproject

That will not be accepted. That is not the correct way to use yaml. Find the problem and submit a PR that solves the problem, that is the correct way.

janiversen avatar Nov 05 '22 18:11 janiversen

One easy solution is to use "state_" as in "state_off" which actually is a lot more consistent to what we do e.g. in cover/fan/light. When correcting this please also add off to the example in the documentation.

janiversen avatar Nov 05 '22 18:11 janiversen

That's possible, but it would break the current yaml. I understand there are not much users to this feature yet, but would it be acceptable?

‫בתאריך שבת, 5 בנוב׳ 2022 ב-20:22 מאת ‪jan iversen‬‏ <‪ @.***‬‏>:‬

One easy solution is to use "state_" as in "state_off" which actually is a lot more consistent to what we do e.g. in cover/fan/light. When correcting this please also add off to the example in the documentation.

— Reply to this email directly, view it on GitHub https://github.com/home-assistant/core/issues/80780#issuecomment-1304605629, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJCMMQO5T6JVO5XNXVY523WG2QXDANCNFSM6AAAAAARL4QDBA . You are receiving this because you were mentioned.Message ID: @.***>

avishorp avatar Nov 05 '22 20:11 avishorp

yes that is acceptable.

The current yaml is already broken, since the actual needed yaml do not correspond to the documentation, so this is a bug solve.

janiversen avatar Nov 06 '22 12:11 janiversen

also in documentation example there isn't the parameter slave (it's also not mandatory) but without it you cannot point to the correct slave device.

twproject avatar Nov 07 '22 06:11 twproject

the parameter slave is documented !!!

just look in the documentation:

https://www.home-assistant.io/integrations/modbus/#configuring-platform-common-parameters

janiversen avatar Nov 07 '22 09:11 janiversen

Fixed here: #81747

avishorp avatar Nov 07 '22 21:11 avishorp

@avishorp thanks When you have time I also open this feature request https://community.home-assistant.io/t/add-current-humidity-attribute-on-climate-modbus/486023

twproject avatar Nov 08 '22 09:11 twproject