OK, you’d like to have details. I implemented a kind of state machine. Rolladen.Zustand can be one of several values:
- Manuell - every cover automation checks at least this is not set or a special value, otherwise it does nothing.
- Rolladen.Nacht
- Rolladen.Tag
- Rolladen.Morgensonne
- Rolladen.Mittagssonne
In my template.yaml there are definitions for the right time:
- trigger:
- platform: time
at: '00:00:01'
- platform: state
entity_id:
- input_datetime.rolladen_auf_werktag
- input_datetime.rolladen_auf_feiertag
sensor:
- name: 'rolladen_heute_auf'
unique_id: "sensor.rolladen_heute_auf"
state: >-
{{ today_at(max(states('input_datetime.rolladen_auf_werktag')
if is_state('binary_sensor.workday_sensor','on')
else states('input_datetime.rolladen_auf_feiertag')
, as_timestamp(as_datetime(state_attr("sun.sun", "next_rising"))-timedelta(minutes=5)
) | timestamp_custom('%H:%M:%S')
))
}}
device_class: timestamp
- trigger:
- platform: time
at: '00:00:01'
- platform: state
entity_id:
- input_datetime.Rolladen_zu_max
sensor:
- name: 'rolladen_heute_zu'
unique_id: "sensor.rolladen_heute_zu"
state: >-
{{ today_at(min(states('input_datetime.rolladen_zu_max')
, (as_timestamp(as_datetime(state_attr("sun.sun", "next_setting"))+timedelta(minutes=5)
) ) | timestamp_custom('%H:%M:%S')
))
}}
device_class: timestamp
These times are shown in a dashboard where the input fields can be changed, also of course the rolladen state. There is also a short explanation of the basic rules for the times.
An automation triggered at rolladen_heute_zu runs skript rolladen_alle_zu (which calls skript rolladen_EG_zu and rolladen_OG_zu which activate several scenes, one for each room) - and activates State Auto.Nacht.
An automation triggered at rolladen_bedingt_auf very similar to previous if the forecast says cloud percentage is above 20 or temperature not above 25. It decides if next state is Rolladen.Tag (end state before night, call rolladen_alle_auf) or if several covers at the front shall be kept at Schlitz (open about 20 percent, depending on the cover) and activate state Auto.Morgensonne.
An automation triggered at 11:30 executed in state Auto.Morgensonne opens the cover of the kitchen, sets bathroom cover to Schlitz and actives state Auto.Mittagssonne.
An automation triggered at 13:30 exectuted in state Auto.Mittagssonne opens living room covers.
There is also an automation closing the living room cover if the time is before 4pm and the cover is above 50percent, but that doesn’t really matter here.
So all this does protection for direct sun, but if the temperature for today is maybe above 27 degree I’d like to let’s say at 11:00 just directly go to state Auto.Tag without opening any cover and set bathroom cover to Schlitz.
All this already exists, only the condition for heat today is missing. It would be fine to evaluate it once a day at 11:00 (sun on the bathroom starts in the afternoon). The weather.forecast_home has cloud percentage, current temperature - but you can’t directly get the value for today’s forecast as shown on the card.
But I’d like to have my cover automations transparent for the family. And for me. I don’t want to have a wonder-value boolean which says if today is heat or not. I’d want to look at the weather dashboard card with daily prediction values, see that the predicted temperature for today is above 27 and directly know why my automation should do one action or the other if activated in that moment.