32
32
CONF_SUNSET_CT = 'sunset_colortemp'
33
33
CONF_STOP_CT = 'stop_colortemp'
34
34
CONF_BRIGHTNESS = 'brightness'
35
+ CONF_DISABLE_BRIGTNESS_ADJUST = 'disable_brightness_adjust'
35
36
CONF_MODE = 'mode'
36
37
37
38
MODE_XY = 'xy'
52
53
vol .All (vol .Coerce (int ), vol .Range (min = 1000 , max = 40000 )),
53
54
vol .Optional (CONF_BRIGHTNESS ):
54
55
vol .All (vol .Coerce (int ), vol .Range (min = 0 , max = 255 )),
56
+ vol .Optional (CONF_DISABLE_BRIGTNESS_ADJUST ): cv .boolean ,
55
57
vol .Optional (CONF_MODE , default = DEFAULT_MODE ):
56
58
vol .Any (MODE_XY , MODE_MIRED )
57
59
})
@@ -88,10 +90,11 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
88
90
sunset_colortemp = config .get (CONF_SUNSET_CT )
89
91
stop_colortemp = config .get (CONF_STOP_CT )
90
92
brightness = config .get (CONF_BRIGHTNESS )
93
+ disable_brightness_adjust = config .get (CONF_DISABLE_BRIGTNESS_ADJUST )
91
94
mode = config .get (CONF_MODE )
92
95
flux = FluxSwitch (name , hass , False , lights , start_time , stop_time ,
93
96
start_colortemp , sunset_colortemp , stop_colortemp ,
94
- brightness , mode )
97
+ brightness , disable_brightness_adjust , mode )
95
98
add_devices ([flux ])
96
99
97
100
def update (call = None ):
@@ -106,7 +109,7 @@ class FluxSwitch(SwitchDevice):
106
109
107
110
def __init__ (self , name , hass , state , lights , start_time , stop_time ,
108
111
start_colortemp , sunset_colortemp , stop_colortemp ,
109
- brightness , mode ):
112
+ brightness , disable_brightness_adjust , mode ):
110
113
"""Initialize the Flux switch."""
111
114
self ._name = name
112
115
self .hass = hass
@@ -118,6 +121,7 @@ def __init__(self, name, hass, state, lights, start_time, stop_time,
118
121
self ._sunset_colortemp = sunset_colortemp
119
122
self ._stop_colortemp = stop_colortemp
120
123
self ._brightness = brightness
124
+ self ._disable_brightness_adjust = disable_brightness_adjust
121
125
self ._mode = mode
122
126
self .unsub_tracker = None
123
127
@@ -192,6 +196,8 @@ def flux_update(self, now=None):
192
196
temp = self ._sunset_colortemp + temp_offset
193
197
x_val , y_val , b_val = color_RGB_to_xy (* color_temperature_to_rgb (temp ))
194
198
brightness = self ._brightness if self ._brightness else b_val
199
+ if self ._disable_brightness_adjust :
200
+ brightness = None
195
201
if self ._mode == MODE_XY :
196
202
set_lights_xy (self .hass , self ._lights , x_val ,
197
203
y_val , brightness )
0 commit comments