-
Notifications
You must be signed in to change notification settings - Fork 0
/
lights.yaml
108 lines (107 loc) · 3.32 KB
/
lights.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# Shelly Bulb
- platform: mqtt
name: "Shelly Bulb Color Mode"
schema: template
effect_list:
- "Off"
- Meteor Shower
- Gradual Change
- Breath
- Flash
- On/Off Gradual
- Red/Green Change
state_topic: "shellies/shellybulb-123456/color/0/status"
command_topic: "shellies/shellybulb-123456/color/0/set"
command_on_template: >
{
"turn": "on",
"mode": "color",
{%- if red is defined and green is defined and blue is defined -%}
"red": {{ red }},
"green": {{ green }},
"blue": {{ blue }},
{%- endif -%}
{%- if white_value is defined -%}
"white": {{ white_value }},
{%- endif -%}
{%- if brightness is defined -%}
"gain": {{ (brightness/255*100)|int }},
{%- endif -%}
{%- if effect is defined -%}
{%- if effect == 'Meteor Shower' -%}
"effect": 1
{%- elif effect == 'Gradual Change' -%}
"effect": 2
{%- elif effect == 'Breath' -%}
"effect": 3
{%- elif effect == 'Flash' -%}
"effect": 4
{%- elif effect == 'On/Off Gradual' -%}
"effect": 5
{%- elif effect == 'Red/Green Change' -%}
"effect": 6
{%- else -%}
"effect": 0
{%- endif -%}
{%- else -%}
"effect": 0
{%- endif -%}
}
command_off_template: >
{
"turn": "off",
"mode": "color",
"effect": 0
}
qos: 1
state_template: '{% if value_json.ison == true and value_json.mode == "color" %}on{% else %}off{% endif %}'
brightness_template: '{{ (value_json.gain/100*255)|int }}'
red_template: '{{ value_json.red }}'
green_template: '{{ value_json.green }}'
blue_template: '{{ value_json.blue }}'
white_value_template: '{{ value_json.white }}'
effect_template: >
{%- if value_json.effect == 1 -%}
Meteor Shower
{%- elif value_json.effect == 2 -%}
Gradual Change
{%- elif value_json.effect == 3 -%}
Breath
{%- elif value_json.effect == 4 -%}
Flash
{%- elif value_json.effect == 5 -%}
On/Off Gradual
{%- elif value_json.effect == 6 -%}
Red/Green Change
{%- else -%}
Off
{%- endif -%}
retain: false
- platform: mqtt
name: "Shelly Bulb White Mode"
schema: template
state_topic: "shellies/shellybulb-123456/color/0/status"
command_topic: "shellies/shellybulb-123456/color/0/set"
command_on_template: >
{
"turn": "on",
"mode": "white",
{%- if color_temp is defined -%}
"temp": {{ (1000000/(((float(color_temp)-153)/354*180)+153)-35) | int }},
{%- endif -%}
{%- if brightness is defined -%}
"brightness": {{ (brightness/255*100) | int }},
{%- endif -%}
"effect": 0
}
command_off_template: >
{
"turn": "off",
"mode": "white",
"effect": 0
}
qos: 1
state_template: '{% if value_json.ison == true and value_json.mode == "white" %}on{% else %}off{% endif %}'
brightness_template: '{{ (value_json.brightness/100*255) | int }}'
color_temp_template: "{{ (1000000/(((float(value_json.temp)-3000)/3500*4500)+2000)) | int }}"
retain: false