Automation to trigger only once upon entity state change below threshold


I have a sensor created via plant integration (senstor.st_bedroom_moisture). I would like to trigger automation once moisture value falls below some thresold.

I have tried creating automations with trigger being state and template:

platform: state
  - sensor.st_bedroom_moisture
id: anthurium_andraenum_kitchen
to: "11"
enabled: true


platform: numeric_state
entity_id: sensor.sansevieria_sypialnia_moisture
id: sansevieria_sypialnia
  hours: 0
  minutes: 0
  seconds: 1
enabled: true
below: 11

Automation triggers when value changes to 11 - but then it keeps triggering every now and then.

I have tried to trigger it based on numeric_state. Unfortunately the moisture value I get is not a number. And I did not manage to convert it to float to use it as a trigger for this automation.

Would you have some ideas how to handle my problem?

Thanks in advance,



Use a template sensor to convert the value to a number. But are you sure it does not work? I would think the numeral_state condition would work anyhow. Or maybe set a unit_of_measurement though customizations if the unit is missing. But I think this is what solves it, as long as it will behave like a number:

Use a threshold sensor with a big enough hysteresis.For instance a threshold sensor with lower bound 13 and hysteresis 2 will turn on below 11, but won’t go off until it is above 15 again. You can create one in the helper section:

P.S. I would create a “moist” sensor with an upper bound by the way. The idea is the same, but you can use the device_class to get helpful icons.

Thanks, worked perfectly fine.

1 Like