For my robomower i want it to mow for 45 minutus when it havent mowed yesterday (with the stock app schedule bacause of tome options), also mow now when there is a rainchange more than 10% tomorow.
-Can someone tell me if this is right,or do i need an % karakter in it?
-also, the triggers, does it go off when there all true, or just 1 of them?
i cant test it easy, can someone conform if this is right?
Thanks in advance
alias: Grasmaaien
description: ''
trigger:
- event: sunset
platform: sun
- at: '20:30'
platform: time
- entity_id: sensor.br_rainchance_1d
from: '10'
platform: state
condition:
- condition: template
value_template: " {% set last_run = state_attr('landroid_cloud.start',\
\ 'last_triggered') %}\n {{ last_run is none or (now().date() - last_run.date()).days\
\ >= 1 }}"
- condition: and
conditions:
- condition: not
conditions:
- condition: state
entity_id: sensor.landroid_maaike_error
state: Rain delay
action:
- data: {}
service: landroid_cloud.start
- timeout: '45'
wait_template: ''
- data: {}
service: landroid_cloud.home
Triggers are events (things that happen.) If you have more than one trigger, any one of them happening can cause the automation’s actions to run. So in your post, they are “sun setting”, “clock reaching 20:30”, “sensor.br_rainchance_1d's state changing from '10' to some other value.”
Conditions test the current state of the system. They are evaluated when one of the triggers “fires.” If true then the actions run. If not, then the actions don’t run.
So, think about when you want the actions to run. Then create a trigger for each of those events.
Next, think about what the state of the system must be for the actions to run when one of the triggers “fires.”
So putting that together, the actions run if the condition(s) is/are true when one of the trigger events occurs.
If you need an “and” function on a trigger you may need to try a template.
trigger:
platform: template
value_template: >
{{ is_state('switch.living_room', 'on')
and is_state('switch.house', 'off')
and not is_state('sensor.motion', 'off')
and is_state_attr('climate.thermostat', 'preset_mode', 'away')
}}
This gives a few examples of ands with ‘not’ and added attributes.
My point was that the consequences of a bug in an automation that controls damage-inflicting devices are potentially greater than, say, a buggy automation that controls lighting. It doesn’t have to be a robotic mower, a remotely-operated garage door can have undesirable consequences or even a thermostat (that fails to heat an unoccupied vacation home in the dead of winter). Some automations just need extra care to handle various edge-cases to ensure they don’t cause costly (or even tragic) incidents.
I simplified a bit of this for you. I think you really need to work out the exact syntax of what you want this to do. Triggers are (or) by nature FYI. It’s best to wear out unwanted triggers in Conditions, not in overly complicated trigger templates. I have had people help me through that mistake plenty of times. Maybe consider a {% if … %} {% else %} {% endif %} structure for one condition template that incorporates the previous mowing state and your rain trigger.
This is a tag on from my last post. This is not code but more a map of what I would do.
Notice, for safety sake I added an input boolean that would allow you to create a rain delay or yard work delay ect of your own.
Also, if you get on/off state information from you mower, again for safety, I would creat a second automation that tests to make sure that the turn off command ran. A lot can happen in 45 minutes.
trigger ‘21:16:00’
condition: is_state(mower, on)
action: mower home