Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_turn_on4(self):
self.bulb.power_mode = enums.PowerMode.MOONLIGHT
self.bulb.turn_on()
self.assertEqual(self.socket.sent["method"], "set_power")
self.assertEqual(self.socket.sent["params"], ["on", "smooth", 300, enums.PowerMode.MOONLIGHT.value])
def test_turn_on4(self):
self.bulb.power_mode = enums.PowerMode.MOONLIGHT
self.bulb.turn_on()
self.assertEqual(self.socket.sent["method"], "set_power")
self.assertEqual(self.socket.sent["params"], ["on", "smooth", 300, enums.PowerMode.MOONLIGHT.value])
"color1": BulbType.Color,
"color2": BulbType.Color,
"strip1": BulbType.Color,
"bslamp1": BulbType.Color,
"RGBW": BulbType.Color,
"lamp1": BulbType.WhiteTemp,
"ceiling1": BulbType.WhiteTemp,
"ceiling2": BulbType.WhiteTemp,
"ceiling3": BulbType.WhiteTemp,
"ceiling4": BulbType.WhiteTempMood,
}
VALID_BRIGHTNESS = vol.All(vol.Coerce(int), vol.Range(min=1, max=100))
SERVICE_SCHEMA_SET_MODE = YEELIGHT_SERVICE_SCHEMA.extend(
{vol.Required(ATTR_MODE): vol.In([mode.name.lower() for mode in PowerMode])}
)
SERVICE_SCHEMA_START_FLOW = YEELIGHT_SERVICE_SCHEMA.extend(
YEELIGHT_FLOW_TRANSITION_SCHEMA
)
SERVICE_SCHEMA_SET_COLOR_SCENE = YEELIGHT_SERVICE_SCHEMA.extend(
{
vol.Required(ATTR_RGB_COLOR): vol.All(
vol.ExactSequence((cv.byte, cv.byte, cv.byte)), vol.Coerce(tuple)
),
vol.Required(ATTR_BRIGHTNESS): VALID_BRIGHTNESS,
}
)
SERVICE_SCHEMA_SET_HSV_SCENE = YEELIGHT_SERVICE_SCHEMA.extend(
def _turn_on_power_mode(self):
return PowerMode.MOONLIGHT