Input_number - generic_thermostat - issue

Hello, why does not my code work with “input_number”? thanks


# Configure a default setup of Home Assistant (frontend, api, etc)
default_config:

# Uncomment this if you are using SSL/TLS, running in Docker container, etc.
# http:
#   base_url: example.duckdns.org:8123

# Text to speech
tts:
  - platform: google_translate

group: !include groups.yaml
automation: !include automations.yaml
script: !include scripts.yaml

sensor:
  - platform: mitemp_bt
    mac: '4C:65:A8:DB:E6:00'
    name: capteur1
    force_update: false
    median: 1
    monitored_conditions:
      - temperature
      - battery

input_number:
  heures1:
    name: heures DAY OFF
    initial: 23
    min: 0
    max: 23
    step: 1
    mode: box

  minutes1:
    name: minutes DAY OFF
    initial: 30
    min: 0
    max: 59
    step: 1
    mode: box

  heures2:
    name: heures DAY ON
    initial: 6
    min: 0
    max: 23
    step: 1
    mode: box

  minutes2:
    name: minutes DAY ON
    initial: 0
    min: 0
    max: 59
    step: 1
    mode: box

  heures3:
    name: heures reboot
    initial: 5
    min: 0
    max: 23
    step: 1
    mode: box

  minutes3:
    name: minutes reboot
    initial: 30
    min: 0
    max: 59
    step: 1
    mode: box

  tempday:
    name: temperature jour
    initial: 23
    min: 0
    max: 25
    step: 1
    mode: box

  tempnight:
    name: temperature nuit
    initial: 19
    min: 0
    max: 25
    step: 1
    mode: box
   
climate:
  - platform: generic_thermostat
    name: thermostat
    heater: switch.chauffage
    target_sensor: sensor.capteur1_temperature
    min_temp: 15
    max_temp: 25
    ac_mode: false
    target_temp: "{{ states('input_number.tempnight') | float }}"
    cold_tolerance: 0.5
    hot_tolerance: 0.5
    min_cycle_duration:
      seconds: 5
    initial_hvac_mode: "heat"
    away_temp: 16
    precision: 0.5

automation:
  - alias: mode jour
    trigger:
    - at: "{{ states('input_number.heures2') | int }}:{{ states('input_number.minutes2') | float }}:00"
      platform: time
    action:
    - service: climate.set_temperature
      data:
        temperature: "{{ states('input_number.tempday') | float }}"
        hvac_mode: heat
  - alias: mode nuit
    trigger:
    - at: "{{ states('input_number.heures1') | int }}:{{ states('input_number.minutes2') | float }}:00"
      platform: time
    action:
    - service: climate.set_temperature
      data:
        temperature: "{{ states('input_number.tempnight') | float }}"
        hvac_mode: heat
  - alias: debug hs110
    trigger:
    - event: start
      platform: homeassistant
    action:
    - service: script.turn_on
  - alias: reboot
    trigger:
    - at: "{{ states('input_number.heures3') | int }}:{{ states('input_number.minutes3') | int }}:00"
      platform: time
    action:
    - service: homeassistant.restart

input_number hass

You need to move your automations to automations.yaml or remove the automation: !include automations.yaml line from the top of your config. You also might not be able to use a template for target_temp under generic thermostat (looks like it needs to be a number). You can adjust the target temp in your frontend if you add a thermostat card.

OK, thanks. :grinning: So I need a physical thermostat

Hmm? No, the generic thermostat integration will work, you just need to remove target_temp or make it a number.

ok it’s not possible to enter a template as numeric value.

how to make it a number ?

Just replace the template with a number. So something like

target_temp: 20

my goal is to be able to modify this value from the GUI

That’s what I was talking about earlier with the thermostat card in the frontend. Add a thermostat card for your generic thermostat and you can control the target temp with that. target_temp in the config only sets what the initial target temp is when you add the integration (the docs also say that).