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_scene_controller(vera_controller_data: VeraControllerData) -> None:
"""Test function."""
controller = vera_controller_data.controller
device = cast(
VeraSceneController, controller.get_device_by_id(DEVICE_SCENE_CONTROLLER_ID)
)
controller.register(device, lambda device: None)
assert device.get_last_scene_id(refresh=True) == "1234"
assert device.get_last_scene_time(refresh=True) == "10000012"
assert device.should_poll is True
update_device(
vera_controller_data, DEVICE_SCENE_CONTROLLER_ID, "LastSceneID", "Id2"
)
update_device(
vera_controller_data, DEVICE_SCENE_CONTROLLER_ID, "LastSceneTime", "4444"
)
assert device.get_last_scene_id(refresh=False) == "1234"
assert device.get_last_scene_time(refresh=False) == "10000012"
assert device.get_last_scene_id(refresh=True) == "Id2"
import pyvera as veraApi
if isinstance(vera_device, veraApi.VeraDimmer):
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
if isinstance(vera_device, veraApi.VeraDimmer):
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