jcwillox/hass-template-climate

set_temperature action does not work

Opened this issue · 5 comments

The problem

This is my config:

climate:
  - platform: climate_template
    unique_id: 76c49564-3347-4a48-8732-cf88ee6729ff
    name: Diesel Heater

    min_temp: 5
    max_temp: 30

    # get current temp.
    current_temperature_template: "{{ states('sensor.temperature_inside') }}"

    # get current humidity.
    current_humidity_template: "{{ states('sensor.humidity_inside') }}"

    # get target temperature.
    target_temperature_template: "{{ states('input_number.dieselheatertemperature') }}"

    set_temperature:
      service: input_number.set_value
      data:
        entity_id: input_number.dieselheatertemperature
        value: "{{ temperature }}"

Whenever I change the target temperature in the frontend, I get the following error:

Logger: homeassistant.helpers.script.diesel_heater
Source: helpers/script.py:1783
First occurred: 21:37:59 (17 occurrences)
Last logged: 22:06:45

Diesel Heater: Error executing script. Invalid data for call_service at pos 1: must contain at least one of entity_id, device_id, area_id.

Does anybody know, why? Thanks in advance :)

What version of Template Climate has the issue?

0.6.1

What version of Home Assistant are you running?

2023.12.3

What type of installation are you running?

Home Assistant OS

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

I just wonder, why in set_temperature You're setting value of input number? This component internally gets current temperature from input_number (current_temperature_template) and when You change this number, it calls set_temperature to apply changes to device. And You're trying to set that input_number again, so it goes into loop. In set_temperature You have to call script or any other device action that sets new temperature target.

ps: I'm not sure, but I think Your error is related to this (minus sign):
set_temperature:
- service: input_number.set_value

It seems that you are using the input_number.set_value service wrong. The following config works for me:

climate:
  - platform: climate_template
    name: Home Blower Heater
    modes:
      - "off"
      - "fan_only"
      - "heat"
    min_temp: 0
    max_temp: 35
    precision: 0.1
    temp_step: 0.1
    current_temperature_template: "{{ states('sensor.qingping_air_monitor_temperature') }}"
    target_temperature_template: "{{ states('input_number.blower_temperature') }}"
    set_hvac_mode:
      service: script.blower_heater_mode
      data: {}
    set_temperature:
      service: input_number.set_value
      target:
        entity_id: input_number.blower_temperature
      data:
        value: "{{ temperature }}"

It seems that you are using the input_number.set_value service wrong. The following config works for me:

climate:
  - platform: climate_template
    name: Home Blower Heater
    modes:
      - "off"
      - "fan_only"
      - "heat"
    min_temp: 0
    max_temp: 35
    precision: 0.1
    temp_step: 0.1
    current_temperature_template: "{{ states('sensor.qingping_air_monitor_temperature') }}"
    target_temperature_template: "{{ states('input_number.blower_temperature') }}"
    set_hvac_mode:
      service: script.blower_heater_mode
      data: {}
    set_temperature:
      service: input_number.set_value
      target:
        entity_id: input_number.blower_temperature
      data:
        value: "{{ temperature }}"

Does the "off" state in the code turn off your heater? No need for additional code to map a switch to off?

where do I find this script ? script.blower_heater_mode

where do I find this script ? script.blower_heater_mode

You write it yourself. I assume that this script reads the climate.home_blower_heater state and does something to actually change modes.