Ejemplo n.º 1
0
 async def build(cls, hardware: ThreadManager):
     lights_on = hardware.get_lights()['rails']
     await hardware.cache_instruments()
     await hardware.set_lights(rails=True)
     await hardware.home()
     return cls(hardware=hardware, lights_on_before=lights_on)
Ejemplo n.º 2
0
async def get_robot_light_state(
        hardware: ThreadManager = Depends(get_hardware)) \
        -> control.RobotLightState:
    light_state = hardware.get_lights()  # type: ignore
    return control.RobotLightState(on=light_state.get('rails', False))
Ejemplo n.º 3
0
async def toggle_lights(hardware: ThreadManager, *args):
    light_state = hardware.get_lights()
    await hardware.set_lights(rails=not light_state.get('rails', False))