예제 #1
0
async def test_turn_off_light(hass: core.HomeAssistant):
    """Tests that turn off command delegates to API."""
    await setup_platform(hass,
                         LIGHT_DOMAIN,
                         ceiling_fan("name-1"),
                         bond_device_id="test-device-id")

    with patch_bond_action() as mock_turn_light_off, patch_bond_device_state():
        await hass.services.async_call(
            LIGHT_DOMAIN,
            SERVICE_TURN_OFF,
            {ATTR_ENTITY_ID: "light.name_1"},
            blocking=True,
        )
        await hass.async_block_till_done()

    mock_turn_light_off.assert_called_once_with("test-device-id",
                                                Action.turn_light_off())
예제 #2
0
파일: light.py 프로젝트: jcgoette/core
 async def async_turn_off(self, **kwargs: Any) -> None:
     """Turn off the light."""
     await self._hub.bond.action(self._device.device_id,
                                 Action.turn_light_off())