SHOW:
|
|
- or go back to the newest paste.
1 | motyle_oswietlenie: | |
2 | alias: Motyle - Oświetlenie | |
3 | mode: parallel | |
4 | fields: | |
5 | start: | |
6 | name: Początek | |
7 | - | description: Czas rozpoczęcia ściemniania/rozjaśniania (czas dla którego ma być 100/0%) |
7 | + | description: Czas rozpoczęcia ściemniania/rozjaśniania |
8 | required: true | |
9 | example: "17:30" | |
10 | default: "17:30" | |
11 | selector: | |
12 | time: | |
13 | start_value: | |
14 | name: Wartość początkowa | |
15 | - | description: Czas zakończenia ściemniania/rozjaśniania (czas dla którego ma być 0/100%) |
15 | + | description: Wartość dla rozpoczęcia ściemniania/rozjaśniania |
16 | required: true | |
17 | example: "100" | |
18 | default: "100" | |
19 | selector: | |
20 | number: | |
21 | min: 0 | |
22 | max: 100 | |
23 | unit_of_measurement: "%" | |
24 | step: 1 | |
25 | mode: slider | |
26 | end: | |
27 | name: Koniec | |
28 | description: Czas zakończenia ściemniania/rozjaśniania | |
29 | required: true | |
30 | - | mode: |
30 | + | |
31 | - | name: Tryb |
31 | + | |
32 | - | description: Tryb działania skryptu |
32 | + | |
33 | time: | |
34 | - | example: darken |
34 | + | end_value: |
35 | - | default: darken |
35 | + | name: Wartość końcowa |
36 | description: Wartość dla zakończenia ściemniania/rozjaśniania | |
37 | required: true | |
38 | example: "0" | |
39 | - | - label: Przyciemnianie |
39 | + | default: "0" |
40 | - | value: darken |
40 | + | |
41 | - | - label: Rozjaśnianie |
41 | + | number: |
42 | - | value: lighten |
42 | + | min: 0 |
43 | max: 100 | |
44 | unit_of_measurement: "%" | |
45 | step: 1 | |
46 | mode: slider | |
47 | light: | |
48 | name: Światło | |
49 | description: Światło do sterowania | |
50 | required: true | |
51 | example: light.motyle_oswietlenie | |
52 | default: light.motyle_oswietlenie | |
53 | selector: | |
54 | entity: | |
55 | domain: light | |
56 | months: | |
57 | name: Miesiące | |
58 | description: Miesiące w których ma działać skrypt | |
59 | required: true | |
60 | example: "[1, 2, 3, 4, 9, 10, 11, 12]" | |
61 | default: "[1, 2, 3, 4, 9, 10, 11, 12]" | |
62 | selector: | |
63 | select: | |
64 | multiple: true | |
65 | mode: list | |
66 | options: | |
67 | - label: Styczeń | |
68 | value: "1" | |
69 | - label: Luty | |
70 | value: "2" | |
71 | - label: Marzec | |
72 | value: "3" | |
73 | - label: Kwiecień | |
74 | value: "4" | |
75 | - label: Maj | |
76 | value: "5" | |
77 | - label: Czerwiec | |
78 | value: "6" | |
79 | - label: Lipiec | |
80 | value: "7" | |
81 | - | end_int: "{{ end.split(':')[0] | int * 60 + end.split(':')[1] | int }}" |
81 | + | |
82 | - | time_int: "{{ now().hour * 60 + now().minute }}" |
82 | + | |
83 | - | start_value: "{{ (mode != 'darken') | iif(0, 100) }}" |
83 | + | |
84 | - | end_value: "{{ (mode != 'darken') | iif(100, 0) }}" |
84 | + | |
85 | - | current_value: "{{ start_value + ((time_int - start_int) / (end_int - start_int)) * (end_value - start_value) }}" |
85 | + | |
86 | value: "10" | |
87 | - label: Listopad | |
88 | value: "11" | |
89 | - label: Grudzień | |
90 | value: "12" | |
91 | sequence: | |
92 | - variables: | |
93 | two_days: "{{ start >= end }}" | |
94 | start_int: "{{ start.split(':')[0] | int * 60 + start.split(':')[1] | int }}" | |
95 | end_int: "{{ end.split(':')[0] | int * 60 + end.split(':')[1] | int + iif(two_days, 1440, 0) }}" | |
96 | time_int: "{{ now().hour * 60 + now().minute + iif(two_days and (now().hour * 60 + now().minute <= end_int - 1440), 1440, 0) }}" | |
97 | start_value_int: "{{ start_value | int }}" | |
98 | end_value_int: "{{ end_value | int }}" | |
99 | current_value: "{{ start_value_int + ((time_int - start_int) / (end_int - start_int)) * (end_value_int - start_value_int) }}" | |
100 | - if: | |
101 | - condition: template | |
102 | value_template: "{{ start_int <= time_int <= end_int }}" | |
103 | - condition: template | |
104 | value_template: "{{ now().month | string in months }}" | |
105 | then: | |
106 | - service: light.turn_on | |
107 | data: | |
108 | transition: 5 | |
109 | brightness_pct: "{{ min(max(current_value | float, 0), 100) }}" | |
110 | kelvin: 6500 | |
111 | target: | |
112 | entity_id: "{{ light }}" | |
113 |