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_switch(vera_controller_data: VeraControllerData, device_id: int) -> None:
"""Test function."""
controller = vera_controller_data.controller
device = cast(VeraSwitch, controller.get_device_by_id(device_id))
controller.register(device, lambda device: None)
assert device.is_switched_on() is False
device.switch_on()
assert device.is_switched_on() is True
device.switch_off()
assert device.is_switched_on() is False
return "light"
if isinstance(vera_device, veraApi.VeraBinarySensor):
return "binary_sensor"
if isinstance(vera_device, veraApi.VeraSensor):
return "sensor"
if isinstance(vera_device, veraApi.VeraArmableDevice):
return "switch"
if isinstance(vera_device, veraApi.VeraLock):
return "lock"
if isinstance(vera_device, veraApi.VeraThermostat):
return "climate"
if isinstance(vera_device, veraApi.VeraCurtain):
return "cover"
if isinstance(vera_device, veraApi.VeraSceneController):
return "sensor"
if isinstance(vera_device, veraApi.VeraSwitch):
if vera_device.device_id in remap:
return "light"
return "switch"
return None
return 'light'
if isinstance(vera_device, veraApi.VeraBinarySensor):
return 'binary_sensor'
if isinstance(vera_device, veraApi.VeraSensor):
return 'sensor'
if isinstance(vera_device, veraApi.VeraArmableDevice):
return 'switch'
if isinstance(vera_device, veraApi.VeraLock):
return 'lock'
if isinstance(vera_device, veraApi.VeraThermostat):
return 'climate'
if isinstance(vera_device, veraApi.VeraCurtain):
return 'cover'
if isinstance(vera_device, veraApi.VeraSceneController):
return 'sensor'
if isinstance(vera_device, veraApi.VeraSwitch):
if vera_device.device_id in remap:
return 'light'
return 'switch'
return None