You could move the second trigger to the first automation and use a service template to decide which service to call. So you’d want something like this:
Close. For a numeric state trigger you can look at the trigger variable’s above and below values. If an above trigger fired, then above will have a value and below will be None, and vice versa. So:
Changed the values below and above, because i believe that the first values are not logical.
In addition, I’ve even created a binary_sensor to play with different ways of evaluation and automation:
- platform: mqtt
name: moisture_detection
state_topic: "tele/wemosd1_14/SENSOR"
value_template:
"{% if value_json['ANALOG'].A0 | float < 600 %}
ON
{% else %}
OFF
{% endif %}"
device_class: moisture
Postscript:
The sensor provides a dry value of about 730 and about 300 dipped in water. In potting soil (normally moist) it delivers about 600.
Thought is the whole as a rain sensor to close possibly open roof window - with the current limit value 600, I’ll probably still have to play