Change room temperature on leaving zone

Hi, I am fairly new to HA. I’ve created my own room temp control using a basic Sonoff (esphome) to control radiator valves. A AM2302 temp sensor was build into the Sonoff basic. Automation rules open/close valves when comparing room temp with helper variables, set via sliders. It works well.

But the ultimate goal was to change the radiator target temperature automatically to a lower value when leaving home.

Setting up an automation rule triggered by leaving zone is understood. However, in the automation action I would like to change the variable input_number.temp_living_room to a lower value.

Go to developer tools and try to make a service call on your input_number

Use the service “input_number.set_value”

Docs have examples of automations:

Have you thought about making a generic thermostat for each room and then having an away temperature set for when you are out of the room?

Yes I have :grinning_face_with_smiling_eyes: but would not know where to start.

What is a thermostat?: a temperature sensor with an output indicator that tells you if your sensor is below or above a settable target value, right? Sensor temperature, Target temperature, boolean on/off I would have thought. The on/off is my sonoff controlled radiator valve. Sensor temperature is the integrated temp sensor on my sonoff switch and target temperature is my helper variable.

But I noted that when I dropped a thermostat card in the lovelace interface, I could not link them to my helper variable. Yet it did automatically find blue LEDs on my wall light switches (which are dimmable), so I thought they need a specific hardware device.

It’s more that you would need to set up a generic Thermostat in the actual Home Assistant configuration, it’s not just a frontend thing. Here for example is one of mine:

  - platform: generic_thermostat
    name: Lower House
    heater: switch.house_boiler
    target_sensor: sensor.average_house_temperature
    min_temp: 14
    max_temp: 25
      minutes: 15
    initial_hvac_mode: "heat"
    away_temp: 16.5
    cold_tolerance: 0.3
    hot_tolerance: 0.3
      minutes: 5
    precision: 0.1

In your case

    heater: switch.house_boiler
    target_sensor: sensor.average_house_temperature

would be your directed to your sonoff.

I’ve read the sections automation and service but does not show an example.
In developer tools ->services I found but I don’t know what the syntax under data would be. The examples show automations, but do I not have to set up a service first?

service: input_number.set_value
data: {}

I did not get much wiser from the page

Ok. That is a tad frightening. I’d seen that you can edit the HA config file directly. I’ll have a look at that tomorrow night. Thanks very much pointing me in the right direction.

Thanks. I think I figured it out. I thought you create a service under developer tools → services. You actually create it under the automation.

alias:  Leaving home
description: Turn radiators off when leaving home
  - platform: zone
    entity_id: person.frank_cook
    zone: zone.home
    event: leave
  - condition: time
    after: '08:00'
    before: '10:00'
  - service: input_number.set_value
      entity_id: input_number.temp_living_room
      value: 10
  - service: input_number.set_value
      entity_id: input_number.temp_dining_room
      value: 10
mode: single