Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- alias: Salon na parterze - Terrarium narożne - Oświetlenie
- description: ""
- trigger:
- - platform: time_pattern
- minutes: /1
- id: every_1_min
- - platform: state
- entity_id:
- - light.shelly_duo_rgbw_id42
- from: unavailable
- id: from_unavailable
- - platform: homeassistant
- event: start
- id: ha_start
- condition: []
- action:
- - variables:
- run_times: |-
- {{
- {
- 1: { "dawn": "06:30:00", "dusk": "18:00:00"},
- 2: { "dawn": "06:30:00", "dusk": "18:00:00"},
- 3: { "dawn": "06:30:00", "dusk": "18:30:00"},
- 4: { "dawn": "06:30:00", "dusk": "19:00:00"},
- 5: { "dawn": "06:30:00", "dusk": "19:30:00"},
- 6: { "dawn": "06:30:00", "dusk": "20:00:00"},
- 7: { "dawn": "06:30:00", "dusk": "20:00:00"},
- 8: { "dawn": "06:30:00", "dusk": "20:00:00"},
- 9: { "dawn": "06:30:00", "dusk": "19:30:00"},
- 10: { "dawn": "06:30:00", "dusk": "19:00:00"},
- 11: { "dawn": "06:30:00", "dusk": "18:30:00"},
- 12: { "dawn": "06:30:00", "dusk": "18:00:00"}
- }
- }}
- dawn_duration_in_minutes: 90
- dusk_duration_in_minutes: 90
- month: "{{ now().month }}"
- dawn_start: "{{ today_at(run_times[month][\"dawn\"]) }}"
- dawn_end: >-
- {{ dawn_start | as_datetime +
- timedelta(minutes=dawn_duration_in_minutes) }}
- dusk_start: "{{ today_at(run_times[month][\"dusk\"]) }}"
- dusk_end: >-
- {{ dusk_start | as_datetime +
- timedelta(minutes=dusk_duration_in_minutes) }}
- - service: input_datetime.set_datetime
- data:
- entity_id: input_datetime.salon_na_parterze_terrarium_narozne_swit_start
- datetime: "{{ dawn_start }}"
- - service: input_datetime.set_datetime
- data:
- entity_id: input_datetime.salon_na_parterze_terrarium_narozne_swit_end
- datetime: "{{ dawn_end }}"
- - service: input_datetime.set_datetime
- data:
- entity_id: input_datetime.salon_na_parterze_terrarium_narozne_zmierzch_start
- datetime: "{{ dusk_start }}"
- - service: input_datetime.set_datetime
- data:
- entity_id: input_datetime.salon_na_parterze_terrarium_narozne_zmierzch_end
- datetime: "{{ dusk_end }}"
- - if:
- - condition: state
- entity_id: switch.shelly_duo_rgbw_id42_automations_on_off
- state: "on"
- - condition: trigger
- id:
- - every_1_min
- then:
- - delay:
- hours: 0
- minutes: 0
- seconds: 2
- milliseconds: 0
- - service: script.salon_na_parterze_terrarium_narozne_zmierzch_swit
- data:
- start: >-
- {{
- states('input_datetime.salon_na_parterze_terrarium_narozne_swit_start')
- }}
- start_value: 0
- end: >-
- {{
- states('input_datetime.salon_na_parterze_terrarium_narozne_swit_end')
- }}
- end_value: 100
- months:
- - "1"
- - "2"
- - "3"
- - "4"
- - "5"
- - "6"
- - "7"
- - "8"
- - "9"
- - "10"
- - "11"
- - "12"
- light: light.shelly_duo_rgbw_id42
- - service: script.salon_na_parterze_terrarium_narozne_zmierzch_swit
- data:
- start: >-
- {{
- states('input_datetime.salon_na_parterze_terrarium_narozne_zmierzch_start')
- }}
- start_value: 100
- end: >-
- {{
- states('input_datetime.salon_na_parterze_terrarium_narozne_zmierzch_end')
- }}
- end_value: 0
- months:
- - "1"
- - "2"
- - "3"
- - "4"
- - "5"
- - "6"
- - "7"
- - "8"
- - "9"
- - "10"
- - "11"
- - "12"
- light: light.shelly_duo_rgbw_id42
- - if:
- - condition: trigger
- id:
- - from_unavailable
- - ha_start
- then:
- - delay:
- hours: 0
- minutes: 0
- seconds: 5
- milliseconds: 0
- - condition: state
- entity_id: switch.shelly_duo_rgbw_id42_automations_on_off
- state: "on"
- - condition: time
- after: input_datetime.salon_na_parterze_terrarium_narozne_swit_end
- before: input_datetime.salon_na_parterze_terrarium_narozne_zmierzch_start
- - service: light.turn_on
- data:
- transition: 60
- kelvin: 6500
- brightness_pct: 100
- target:
- entity_id: light.shelly_duo_rgbw_id42
- - if:
- - condition: trigger
- id:
- - ha_start
- - from_unavailable
- then:
- - delay:
- hours: 0
- minutes: 0
- seconds: 5
- milliseconds: 0
- - condition: state
- entity_id: switch.shelly_duo_rgbw_id42_automations_on_off
- state: "on"
- - condition: time
- after: input_datetime.salon_na_parterze_terrarium_narozne_zmierzch_end
- before: input_datetime.salon_na_parterze_terrarium_narozne_swit_start
- - service: light.turn_off
- data:
- transition: 60
- target:
- entity_id: light.shelly_duo_rgbw_id42
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement