Need help with a binary sensor

Hi there,
I need some help with an awning.
I have a weather station, and I want to close the awning when it’s raining or there is much wind.
With wind I didn’t have problem, but with the sensor of rain is binary and I am not able to turn on it. I have tried On-Off, True -False, 0-1…
code:
platform: state
entity_id: binary_sensor.is_raining
for: ‘00:00:05’
to: ‘True’

Thanks in advance.

Please format code with the </> button.

Look for 'on' and 'off' — lower-case. See the example here.

Thanks for the response.
I have read the document, I think that I tried with on-off lowercase.
Anyway, It has stopped raining, but I will give a try :grinning:

What does dev-tools —> states say?

My knowledge in HA are limited, you meant this?


thanks

So your sensor currently has a state of “off”, meaning it’s going to be set to “on” when it’s raining.

So your going to need

platform: state
entity_id: binary_sensor.is_raining
to: 'on'
for: '00:00:05'

Now, I have this

platform: state
entity_id: binary_sensor.is_raining
for: ‘00:01:00’
to: ‘on’
from: ‘off’
But I live in Spain south, I don’t know when it’ll rain again :grinning:
Thanks

Okay, well to test your automation you can change the state of your sensor to “on” In developer tools.

As mentioned above too, the </> button will format your code tidily so it can be read. Lovelace is very sensitive to formatting and posting code as you have could prevent people reaching out to help you if your code was more complex than the 4 lines you’ve posted today.

This was!

platform: state
entity_id: binary_sensor.is_raining
to: 'on'
for: '00:01:00'

Thanks a lot

2 Likes