async def test_turn_on_off(hass: HomeAssistant): """Test support of the light.turn_on service.""" client = ClientMock() client.state = False client.brightness = {"mode": "enabled", "value": 20} entity, _, _, _ = await _create_entries(hass, client) assert hass.states.get(entity.entity_id).state == "off" await hass.services.async_call( "light", "turn_on", service_data={"entity_id": entity.entity_id}) await hass.async_block_till_done() state = hass.states.get(entity.entity_id) assert state.state == "on" assert state.attributes[ATTR_BRIGHTNESS] == 51
async def test_turn_on_with_color_rgb(hass: HomeAssistant): """Test support of the light.turn_on service with a brightness parameter.""" client = ClientMock() client.state = False client.device_info["led_profile"] = "RGB" client.brightness = {"mode": "enabled", "value": 255} entity, _, _, _ = await _create_entries(hass, client) assert hass.states.get(entity.entity_id).state == "off" await hass.services.async_call( "light", "turn_on", service_data={ "entity_id": entity.entity_id, "rgb_color": (128, 64, 32) }, ) await hass.async_block_till_done() state = hass.states.get(entity.entity_id) assert state.state == "on" assert client.color == (128, 64, 32)