10
10
ATTR_BRIGHTNESS ,
11
11
ATTR_BRIGHTNESS_PCT ,
12
12
ATTR_COLOR_NAME ,
13
- ATTR_COLOR_TEMP ,
13
+ ATTR_COLOR_TEMP_KELVIN ,
14
14
ATTR_EFFECT ,
15
15
ATTR_FLASH ,
16
16
ATTR_HS_COLOR ,
17
- ATTR_KELVIN ,
18
17
ATTR_PROFILE ,
19
18
ATTR_RGB_COLOR ,
20
19
ATTR_RGBW_COLOR ,
35
34
SERVICE_TURN_ON ,
36
35
)
37
36
from homeassistant .core import HomeAssistant
38
- from homeassistant .loader import bind_hass
39
37
40
38
from tests .common import MockToggleEntity
41
39
42
40
43
- @bind_hass
44
- def turn_on (
45
- hass : HomeAssistant ,
46
- entity_id : str = ENTITY_MATCH_ALL ,
47
- transition : float | None = None ,
48
- brightness : int | None = None ,
49
- brightness_pct : float | None = None ,
50
- rgb_color : tuple [int , int , int ] | None = None ,
51
- rgbw_color : tuple [int , int , int , int ] | None = None ,
52
- rgbww_color : tuple [int , int , int , int , int ] | None = None ,
53
- xy_color : tuple [float , float ] | None = None ,
54
- hs_color : tuple [float , float ] | None = None ,
55
- color_temp : int | None = None ,
56
- kelvin : int | None = None ,
57
- profile : str | None = None ,
58
- flash : str | None = None ,
59
- effect : str | None = None ,
60
- color_name : str | None = None ,
61
- white : bool | None = None ,
62
- ) -> None :
63
- """Turn all or specified light on."""
64
- hass .add_job (
65
- async_turn_on ,
66
- hass ,
67
- entity_id ,
68
- transition ,
69
- brightness ,
70
- brightness_pct ,
71
- rgb_color ,
72
- rgbw_color ,
73
- rgbww_color ,
74
- xy_color ,
75
- hs_color ,
76
- color_temp ,
77
- kelvin ,
78
- profile ,
79
- flash ,
80
- effect ,
81
- color_name ,
82
- white ,
83
- )
84
-
85
-
86
41
async def async_turn_on (
87
42
hass : HomeAssistant ,
88
43
entity_id : str = ENTITY_MATCH_ALL ,
@@ -94,8 +49,7 @@ async def async_turn_on(
94
49
rgbww_color : tuple [int , int , int , int , int ] | None = None ,
95
50
xy_color : tuple [float , float ] | None = None ,
96
51
hs_color : tuple [float , float ] | None = None ,
97
- color_temp : int | None = None ,
98
- kelvin : int | None = None ,
52
+ color_temp_kelvin : int | None = None ,
99
53
profile : str | None = None ,
100
54
flash : str | None = None ,
101
55
effect : str | None = None ,
@@ -116,8 +70,7 @@ async def async_turn_on(
116
70
(ATTR_RGBWW_COLOR , rgbww_color ),
117
71
(ATTR_XY_COLOR , xy_color ),
118
72
(ATTR_HS_COLOR , hs_color ),
119
- (ATTR_COLOR_TEMP , color_temp ),
120
- (ATTR_KELVIN , kelvin ),
73
+ (ATTR_COLOR_TEMP_KELVIN , color_temp_kelvin ),
121
74
(ATTR_FLASH , flash ),
122
75
(ATTR_EFFECT , effect ),
123
76
(ATTR_COLOR_NAME , color_name ),
@@ -129,17 +82,6 @@ async def async_turn_on(
129
82
await hass .services .async_call (DOMAIN , SERVICE_TURN_ON , data , blocking = True )
130
83
131
84
132
- @bind_hass
133
- def turn_off (
134
- hass : HomeAssistant ,
135
- entity_id : str = ENTITY_MATCH_ALL ,
136
- transition : float | None = None ,
137
- flash : str | None = None ,
138
- ) -> None :
139
- """Turn all or specified light off."""
140
- hass .add_job (async_turn_off , hass , entity_id , transition , flash )
141
-
142
-
143
85
async def async_turn_off (
144
86
hass : HomeAssistant ,
145
87
entity_id : str = ENTITY_MATCH_ALL ,
@@ -160,43 +102,6 @@ async def async_turn_off(
160
102
await hass .services .async_call (DOMAIN , SERVICE_TURN_OFF , data , blocking = True )
161
103
162
104
163
- @bind_hass
164
- def toggle (
165
- hass : HomeAssistant ,
166
- entity_id : str = ENTITY_MATCH_ALL ,
167
- transition : float | None = None ,
168
- brightness : int | None = None ,
169
- brightness_pct : float | None = None ,
170
- rgb_color : tuple [int , int , int ] | None = None ,
171
- xy_color : tuple [float , float ] | None = None ,
172
- hs_color : tuple [float , float ] | None = None ,
173
- color_temp : int | None = None ,
174
- kelvin : int | None = None ,
175
- profile : str | None = None ,
176
- flash : str | None = None ,
177
- effect : str | None = None ,
178
- color_name : str | None = None ,
179
- ) -> None :
180
- """Toggle all or specified light."""
181
- hass .add_job (
182
- async_toggle ,
183
- hass ,
184
- entity_id ,
185
- transition ,
186
- brightness ,
187
- brightness_pct ,
188
- rgb_color ,
189
- xy_color ,
190
- hs_color ,
191
- color_temp ,
192
- kelvin ,
193
- profile ,
194
- flash ,
195
- effect ,
196
- color_name ,
197
- )
198
-
199
-
200
105
async def async_toggle (
201
106
hass : HomeAssistant ,
202
107
entity_id : str = ENTITY_MATCH_ALL ,
@@ -206,8 +111,7 @@ async def async_toggle(
206
111
rgb_color : tuple [int , int , int ] | None = None ,
207
112
xy_color : tuple [float , float ] | None = None ,
208
113
hs_color : tuple [float , float ] | None = None ,
209
- color_temp : int | None = None ,
210
- kelvin : int | None = None ,
114
+ color_temp_kelvin : int | None = None ,
211
115
profile : str | None = None ,
212
116
flash : str | None = None ,
213
117
effect : str | None = None ,
@@ -225,8 +129,7 @@ async def async_toggle(
225
129
(ATTR_RGB_COLOR , rgb_color ),
226
130
(ATTR_XY_COLOR , xy_color ),
227
131
(ATTR_HS_COLOR , hs_color ),
228
- (ATTR_COLOR_TEMP , color_temp ),
229
- (ATTR_KELVIN , kelvin ),
132
+ (ATTR_COLOR_TEMP_KELVIN , color_temp_kelvin ),
230
133
(ATTR_FLASH , flash ),
231
134
(ATTR_EFFECT , effect ),
232
135
(ATTR_COLOR_NAME , color_name ),
0 commit comments