Automation for switching on and off a device based on measured temperature

Hi,

I have installed a Aqara Temperature and Humidity Sensor and Single Switch Module T1 via a Conbee 2 stick on my HA.
I have a few variables with which I want to switch on and off a device.

  • sensor.lumi_lumi_weather_temperature: this is the measured temperature in a room.
  • input_number.setpoint: this is a helper with which I want to control the setpoint.

To begin with, I have a simple automation:

alias: control lights
description: Flash lights when measured temp < setpoint
trigger:
  - platform: numeric_state
    entity_id: sensor.lumi_lumi_weather_temperature
    below: 18
condition:
  - condition: state
    entity_id: light.livingroom_1
    state: "on"
action:
  - device_id: bcc2f87788fc0c9fab0c5c3fc45dae85
    domain: light
    entity_id: light.livingroom_1
    type: flash
mode: single

This works. But now I want the below-value to be controlled with the helper. What do I have to change? I don’t get it…
Obviously I also have to add something that switches off the device (above?).

You need a template trigger.

Thanks for your answer.
I solved the problem for now. I’m making use of “Generic thermostatic”. Works fine!