Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- motyle_oswietlenie:
- alias: Motyle - Oświetlenie
- mode: parallel
- fields:
- start:
- name: Początek
- description: Czas rozpoczęcia ściemniania/rozjaśniania
- required: true
- example: "17:30"
- default: "17:30"
- selector:
- time:
- start_value:
- name: Wartość początkowa
- description: Wartość dla rozpoczęcia ściemniania/rozjaśniania
- required: true
- example: "100"
- default: "100"
- selector:
- number:
- min: 0
- max: 100
- unit_of_measurement: "%"
- step: 1
- mode: slider
- end:
- name: Koniec
- description: Czas zakończenia ściemniania/rozjaśniania
- required: true
- example: "19:10"
- default: "19:10"
- selector:
- time:
- end_value:
- name: Wartość końcowa
- description: Wartość dla zakończenia ściemniania/rozjaśniania
- required: true
- example: "0"
- default: "0"
- selector:
- number:
- min: 0
- max: 100
- unit_of_measurement: "%"
- step: 1
- mode: slider
- light:
- name: Światło
- description: Światło do sterowania
- required: true
- example: light.motyle_oswietlenie
- default: light.motyle_oswietlenie
- selector:
- entity:
- domain: light
- months:
- name: Miesiące
- description: Miesiące w których ma działać skrypt
- required: true
- example: "[1, 2, 3, 4, 9, 10, 11, 12]"
- default: "[1, 2, 3, 4, 9, 10, 11, 12]"
- selector:
- select:
- multiple: true
- mode: list
- options:
- - label: Styczeń
- value: "1"
- - label: Luty
- value: "2"
- - label: Marzec
- value: "3"
- - label: Kwiecień
- value: "4"
- - label: Maj
- value: "5"
- - label: Czerwiec
- value: "6"
- - label: Lipiec
- value: "7"
- - label: Sierpień
- value: "8"
- - label: Wrzesień
- value: "9"
- - label: Październik
- value: "10"
- - label: Listopad
- value: "11"
- - label: Grudzień
- value: "12"
- sequence:
- - variables:
- two_days: "{{ start >= end }}"
- start_int: "{{ start.split(':')[0] | int * 60 + start.split(':')[1] | int }}"
- end_int: "{{ end.split(':')[0] | int * 60 + end.split(':')[1] | int + iif(two_days, 1440, 0) }}"
- time_int: "{{ now().hour * 60 + now().minute + iif(two_days and (now().hour * 60 + now().minute <= end_int - 1440), 1440, 0) }}"
- start_value_int: "{{ start_value | int }}"
- end_value_int: "{{ end_value | int }}"
- current_value: "{{ start_value_int + ((time_int - start_int) / (end_int - start_int)) * (end_value_int - start_value_int) }}"
- - if:
- - condition: template
- value_template: "{{ start_int <= time_int <= end_int }}"
- - condition: template
- value_template: "{{ now().month | string in months }}"
- then:
- - service: light.turn_on
- data:
- transition: 5
- brightness_pct: "{{ min(max(current_value | float, 0), 100) }}"
- kelvin: 6500
- target:
- entity_id: "{{ light }}"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement