Cannot get climate automation

Jeez, I have been trying to get automation (my 1st one so I’m also learning) to work.
I have a generic thermostat entity (is that the right term, a widget on the dashboard to set temp) and a group of entities for a smart TRV. The group includes a slider to set the desired temp. The group is really for diagnostics but I want my thermostat to “send” its setting to the slider (which in turn sends an mqtt message to the TRV). All works bar the thermostat send to slider. The HA log file says:

WARNING (MainThread) [homeassistant.components.input_number] Invalid value: 0.0 (range 10.0 - 23.0)

Irrespective of whatever value I use on the circular dial on the generic thermostat. What on earth is wrong?

# configuration.yaml
climate:
  - platform: generic_thermostat
    name: Lounge
    heater: switch.danfoss_rxz3_rf_relay_switching_unit_switch_2
    target_sensor: sensor.lounge_temperature
# sensors.yaml -- my own file and I have the !include directive that works.
  sensor:
        - platform: mqtt
          state_topic: "/energenie/eTRV/Report/Temperature/8008"
          name: "Lounge Temperature"
          unit_of_measurement: "°C"
          force_update: true
          expire_after: 660

        - platform: mqtt
          state_topic: "/energenie/eTRV/Report/TargetTemperature/8008"
          name: "Lounge Target Rcvd"
          unit_of_measurement: "°C"

        - platform: mqtt
          state_topic: "/energenie/eTRV/Report/Voltage/8008"
          name: "Lounge TRV Voltage"
          unit_of_measurement: V
          force_update: true

        - platform: mqtt
          state_topic: "/energenie/eTRV/Command/ValveState/8008"
          name: "command_valvestate_8008"

        - platform: mqtt
          state_topic: "/energenie/eTRV/Command/Temperature/8008"
          name: "command_temperature_8008"

        - platform: statistics
          name: lounge_etrv_stats
          entity_id: sensor.lounge_temperature
          max_age:
            minutes: 25

  binary_sensor:
        - platform: mqtt
          state_topic: "/energenie/eTRV/Report/Diagnostics/8008"
          name: "Lounge TRV Motor current below expectation"
          value_template: '{{ value_json["Motor current below expectation"] }}'
          payload_on: true
          payload_off: false

        - platform: mqtt
          state_topic: "/energenie/eTRV/Report/Diagnostics/8008"
          name: "Lounge TRV Motor current always high"
          value_template: '{{ value_json["Motor current always high"] }}'
          payload_on: true
          payload_off: false


        - platform: mqtt
          state_topic: "/energenie/eTRV/Report/Diagnostics/8008"
          name: "Lounge TRV Motor taking too long"
          value_template: '{{ value_json["Motor taking too long"] }}'
          payload_on: true
          payload_off: false


        - platform: mqtt
          state_topic: "/energenie/eTRV/Report/Diagnostics/8008"
          name: "Lounge TRV discrepancy between air and pipe sensors"
          value_template: '{{ value_json["discrepancy between air and pipe sensors"] }}'
          payload_on: true
          payload_off: false

        - platform: mqtt
          state_topic: "/energenie/eTRV/Report/Diagnostics/8008"
          name: "Lounge TRV air sensor out of expected range"
          value_template: '{{ value_json["air sensor out of expected range"] }}'
          payload_on: true
          payload_off: false

        - platform: mqtt
          state_topic: "/energenie/eTRV/Report/Diagnostics/8008"
          name: "Lounge TRV pipe sensor out of expected range"
          value_template: '{{ value_json["pipe sensor out of expected range"] }}'
          payload_on: true
          payload_off: false

        - platform: mqtt
          state_topic: "/energenie/eTRV/Report/Diagnostics/8008"
          name: "Lounge TRV Low Power Mode Enabled"
          value_template: '{{ value_json["low power mode is enabled"] }}'
          payload_on: true
          payload_off: false


        - platform: mqtt
          state_topic: "/energenie/eTRV/Report/Diagnostics/8008"
          name: "Lounge TRV no target temperature has been set by host"
          value_template: '{{ value_json["no target temperature has been set by host"] }}'
          payload_on: true
          payload_off: false

        - platform: mqtt
          state_topic: "/energenie/eTRV/Report/Diagnostics/8008"
          name: "Lounge TRV valve may be sticking"
          value_template: '{{ value_json["valve may be sticking"] }}'
          payload_on: true
          payload_off: false

        - platform: mqtt
          state_topic: "/energenie/eTRV/Report/Diagnostics/8008"
          name: "Lounge TRV valve exercise was successful"
          value_template: '{{ value_json["valve exercise was successful"] }}'
          payload_on: true
          payload_off: false

        - platform: mqtt
          state_topic: "/energenie/eTRV/Report/Diagnostics/8008"
          name: "Lounge TRV valve exercise was unsuccessful"
          value_template: '{{ value_json["valve exercise was unsuccessful"] }}'
          payload_on: true
          payload_off: false

        - platform: mqtt
          state_topic: "/energenie/eTRV/Report/Diagnostics/8008"
          name: "Lounge TRV driver micro has suffered a watchdog reset and needs data refresh"
          value_template: '{{ value_json["driver micro has suffered a watchdog reset and needs data refresh"] }}'
          payload_on: true
          payload_off: false

        - platform: mqtt
          state_topic: "/energenie/eTRV/Report/Diagnostics/8008"
          name: "Lounge TRV driver micro has suffered a noise reset and needs data refresh"
          value_template: '{{ value_json["driver micro has suffered a noise reset and needs data refresh"] }}'
          payload_on: true
          payload_off: false

        - platform: mqtt
          state_topic: "/energenie/eTRV/Report/Diagnostics/8008"
          name: "Lounge TRV battery voltage has fallen below 2.2V and valve has been opened"
          value_template: '{{ value_json["battery voltage has fallen below 2p2V and valve has been opened"] }}'
          payload_on: true
          payload_off: false

        - platform: mqtt
          state_topic: "/energenie/eTRV/Report/Diagnostics/8008"
          name: "Lounge TRV request for heat messaging is enabled"
          value_template: '{{ value_json["request for heat messaging is enabled"] }}'
          payload_on: true
          payload_off: false

        - platform: mqtt
          state_topic: "/energenie/eTRV/Report/Diagnostics/8008"
          name: "Lounge TRV request for heat"
          value_template: '{{ value_json["request for heat"] }}'
          payload_on: true
          payload_off: false

#
# 
# THIS IS THE ENTITY I AM TRYING TO SET
#
#
 input_number:
        lounge_temp:
          name: Lounge Temperature Target
          min: 10
          max: 23
          step: 1
          unit_of_measurement: "°C"
          mode: slider
          initial: 18
          icon: mdi:thermometer-lines

  input_select:
        lounge_trv_state:
          name: Lounge TRV Valve State
          options:
            - Closed
            - Normal
            - Open

  automation 8008:
    - alias: Temp slider
      initial_state: true
      hide_entity: true
      trigger:
        platform: state
        entity_id: input_number.lounge_temp
      action:
        service: mqtt.publish
        data_template:
          topic: '/energenie/eTRV/Command/Temperature/8008'
          retain: true
          payload: "{{ states('input_number.lounge_temp') | int }}"

  script:
        send_report_voltage_lounge:
          sequence:
            - service: script.send_trv_command
              data:
                id: '8008'
                command: 'Voltage'

        send_report_diagnostics_lounge:
          sequence:
            - service: script.send_trv_command
              data:
                id: '8008'
                command: 'Diagnostics'

        send_exercise_lounge:
          sequence:
            - service: script.send_trv_command
              data:
                id: '8008'
                command: 'Exercise'

        send_identity_lounge:
          sequence:
            # This is written using the Script Syntax
            - service: script.send_trv_command
              data:
                id: '8008'
                command: 'Identify'

#script:
        send_trv_command:
          sequence:
            - service: mqtt.publish
              data_template:
                topic: '/energenie/eTRV/Command/{{command}}/{{id}}'
                payload: 'ON'

  group:
        lounge_trv:
          name: Lounge
          #control: hidden
          entities:
            - sensor.lounge_temperature
            - input_number.lounge_temp
            - sensor.lounge_target_rcvd
            - input_select.lounge_trv_state
#            - switch.lounge_trv_low_power_mode
            - script.send_report_diagnostics_lounge
            - script.send_exercise_lounge
            - script.send_identity_lounge
            - script.send_report_voltage_lounge
            - sensor.lounge_trv_voltage

        lounge_diagnostics:
          control: hidden
          entities:
            - binary_sensor.lounge_trv_motor_current_below_expectation
            - binary_sensor.lounge_trv_motor_current_always_high
            - binary_sensor.lounge_trv_motor_taking_too_long
            - binary_sensor.lounge_trv_discrepancy_between_air_and_pipe_sensors
            - binary_sensor.lounge_trv_air_sensor_out_of_expected_range
            - binary_sensor.lounge_trv_pipe_sensor_out_of_expected_range
            - binary_sensor.lounge_trv_low_power_mode_enabled
            - binary_sensor.lounge_trv_no_target_temperature_has_been_set_by_host
            - binary_sensor.lounge_trv_valve_may_be_sticking
            - binary_sensor.lounge_trv_valve_exercise_was_successful
            - binary_sensor.lounge_trv_valve_exercise_was_unsuccessful
            - binary_sensor.lounge_trv_driver_micro_has_suffered_a_watchdog_reset_and_needs_data_refresh
            - binary_sensor.lounge_trv_driver_micro_has_suffered_a_noise_reset_and_needs_data_refresh
            - binary_sensor.lounge_trv_battery_voltage_has_fallen_below_2_2v_and_valve_has_been_opened
            - binary_sensor.lounge_trv_request_for_heat_messaging_is_enabled
            - binary_sensor.lounge_trv_request_for_heat

# automations.yaml    
- alias: 'Lounge temp automate'
  trigger:
    platform: state
    entity_id: climate.Lounge
  action:
    service: input_number.set_value
    entity_id: input_number.lounge_temp   #-- This is the entity from above in my sensors.yaml
    data_template:
      #
      # Automation works in the sense that when I change the thermostat temp
      # this automation runs. 
      # However , 
      # This line, just sends 0.0 every time   ??.
      value: "{{ states.to_state.temperature   | float }}"  ## Also tried to_state.state , didnt work either.

As I say, it all works, ALMOST.
The thermostat correctly turns on the boiler if needed.
The slider in the group of sensors works and set the TRV via mqtt
All TRV readings are correct
Just cannot for love or moeny, get the thermostat to send its value to the input_number entity.

temperature is an attribute of the climate component. Your automation can access the attribute like this:

      value: "{{ trigger.to_state.attributes.temperature | float }}"

A few other observations:

  • All entity_id’s in Home Assistant are in lower case. Your automation refers to entity_id: climate.Lounge using a capital L.
  • The error message will return if climate.lounge's temperature is set to a value outside of the input_select’s range (10-23). You’ll need to decide how you want the automation’s template to handle that situation.
1 Like

@123 , ffs, I’ve only spent a whole weekend trying to get this working fiddling around , using different files, different services, different entity types, and all I needed was .attributes . I did try states.to_states.temperature but missing the .attributes.

I have also put a min_temp and max_temp on the thermostat so that tunes to the mqtt topics I use to control the TRV.

Finally, all IDs changed to lowercase.

!! THANK YOU !!

Where would I go to find all the sexy stuff that can go inbetween {{ and }}

The Templating documentation, especially the description of the Trigger State object.

1 Like

Perfect.
I was looking in the wrong place - integrations - but that link is great especially the architecture diagram and explanations. Penny dropping now. Mamy thanks again.