Ich bin mir noch nicht ganz sicher ob ich es richtig Überrissen habe.
Für jeden Wochentag gibt es ein Input Select mit der Auswahl Bob und Anne.
In diesen Bsp. heißen die Input Select, wie die Wochentage, also montag, dienstag, mittwoch, etc.
input_select:
montag:
name: Wer kocht am Montag
options:
- Bob
- Anne
initial: Anne
icon: mdi:cookie
dienstag:
name: Wer kocht am Dienstag
options:
- Bob
- Anne
initial: Anne
icon: mdi:cookie
mittwoch:
name: Wer kocht am Mittwoch
options:
- Bob
- Anne
initial: Anne
icon: mdi:cookie
donnerstag:
name: Wer kocht am Donnerstag
options:
- Bob
- Anne
initial: Anne
icon: mdi:cookie
freitag:
name: Wer kocht am Freiatag
options:
- Bob
- Anne
initial: Anne
icon: mdi:cookie
samstag:
name: Wer kocht am Samstag
options:
- Bob
- Anne
initial: Anne
icon: mdi:cookie
sonntag:
name: Wer kocht am Sonntag
options:
- Bob
- Anne
initial: Anne
icon: mdi:cookie
Mit folgenden Template kannst Du ermitteln, wer heute Küchendienst hat:
{% set wochentag = ["montag", "dienstag", "mittwoch", "donnerstag", "freitag", "samstag", "sonntag"] %}
{% set heute = "input_select." + wochentag[now().weekday()] %}
{{ states(heute) }}
Jetzt kannst Du entweder direkt dieses Template als Bedingung in Deinen Automationen verwebenden:
actions:
- choose:
- conditions:
- condition: template
value_template: |
{% set wochentag = ["montag", "dienstag", "mittwoch", "donnerstag", "freitag", "samstag", "sonntag"] %}
{% set heute = "input_select." + wochentag[now().weekday()] %}
{{ states(heute) == "Bob" }}
sequence:
- action: light.turn_on
metadata: {}
target:
entity_id: light.xyz
data:
rgb_color:
- 255
- 38
- 0
- conditions:
- condition: template
value_template: |
{% set wochentag = ["montag", "dienstag", "mittwoch", "donnerstag", "freitag", "samstag", "sonntag"] %}
{% set heute = "input_select." + wochentag[now().weekday()] %}
{{ states(heute) == "Anne" }}
sequence:
- action: light.turn_on
metadata: {}
target:
entity_id: light.xyz
data:
rgb_color:
- 0
- 249
- 0
Oder Du erstellst Dir einen template Sensor und verwendest diesen als Bedingung
actions:
- choose:
- conditions:
- condition: state
entity_id: sensor.kuchendienst_heute
state:
- Bob
sequence:
- action: light.turn_on
metadata: {}
target:
entity_id: light.xyz
data:
rgb_color:
- 255
- 38
- 0
- conditions:
- condition: state
entity_id: sensor.kuchendienst_heute
state:
- Anne
sequence:
- action: light.turn_on
metadata: {}
target:
entity_id: light.xyz
data:
rgb_color:
- 0
- 249
- 0
Gruß Osorkon