Input Select Options to manage Heatpump via Modbus

Hi there,

I have integrated my heatpump via Modbus into HASS. Now I can modify the air and water temperature via dropdown.

I had to define the options in this way because otherweise the heatpump can’t interpret the tempatures correctly:

heizkurve_offset:
    name: Heizkurve Offset
    options:
      - "65533"
      - "65534"
      - "65535"
      - "0"
      - "1"
      - "2"
      - "3"
    icon: mdi:coolant-temperature

65535 equals -1, 65534 -2 and 65533 -3.

Is there a way to show the values -1, -2 and -3 instead of the 655XX values in the dropdown?

Thanks in advance

Yes you can map input_select options to values where the values are to be used (i.e. in an automation).

heizkurve_offset:
    name: Heizkurve Offset
    options:
      - "-3"
      - "-2"
      - "-1"
      - "0"
      - "1"
      - "2"
      - "3"
    icon: mdi:coolant-temperature

Used in a value template:

    value_template: >
      {% set value_list = [ "65533", "65534", "65535", "0", "1", "2", "3" ] %}
      {% set option = states('input_select.heizkurve_offset') + 3 %}
      {% set output = value_list[option] %}
      {{ output }}

Try it in the developer tools template editor.

1 Like

@tom_l tanks for your help. Now im running into following error:

Error executing script. Unexpected error for call_service at pos 1: Error rendering data template: TypeError: can only concatenate str (not “int”) to str

Show your script.

config:

  heizkurve_offset:
    name: Heizkurve Offset
    options:
      - "-3"
      - "-2"
      - "-1"
      - "0"
      - "1"
      - "2"
      - "3"
    icon: mdi:coolant-temperature

automation:

alias: Heizkurve Offset
description: Temperatur Offset der Heizkurve
trigger:
  - platform: state
    entity_id: input_select.heizkurve_offset
condition: []
action:
  - service: modbus.write_register
    data:
      hub: VVMS320
      unit: 1
      address: 30
      value_template: >
        {% set value_list = [ "65533", "65534", "65535", "0", "1", "2", "3" ] %}
        {% set option = states('input_select.heizkurve_offset') + 3 %} {% set
        output = value_list[option] %} {{ output }}
mode: single
action:
  - service: modbus.write_register
    data:
      hub: VVMS320
      unit: 1
      address: 30
      output: >
        {% set value_list = [ "65533", "65534", "65535", "0", "1", "2", "3" ] %}
        {% set option = states('input_select.heizkurve_offset') + 3 %} 
        {% set output =  value_list[option] %} 
        {{ output }}

Same Error: :confused:

  • Heizkurve Offset: Error executing script. Unexpected error for call_service at pos 1: Error rendering data template: TypeError: can only concatenate str (not “int”) to str
action:
  - service: modbus.write_register
    data:
      hub: VVMS320
      unit: 1
      address: 30
      value: >
        {% set value_list = [ "65533", "65534", "65535", "0", "1", "2", "3" ] %}
        {% set option = states('input_select.heizkurve_offset') + 3 %} 
        {% set output =  value_list[option] %} 
        {{ output }}
1 Like

I solved it:

action:
  - service: modbus.write_register
    data:
      hub: VVMS320
      unit: 1
      address: 30
      value: >
        {% set value_list = [ "65533", "65534", "65535", "0", "1", "2", "3" ] %}
        {% set option = states('input_select.heizkurve_offset') | int+3 %}
        {% set output =  value_list[option] %}  {{ output }}

It has to be int+3 :slight_smile:

Oh, duh. Yeah sorry. Misdeed that.