(request: WSGIRequest)
Stores the current lights state and restores the previous one.
Stores the current lights state and restores the previous one.
Stores the current lights state and restores the previous one .
def set_lights_shortcut(request: WSGIRequest) -> None:
    """Stores the current lights state and restores the previous one."""
    should_enable = request.POST.get("value") == "true"
    is_enabled = (
        storage.get("ring_program") != "Disabled"
        or storage.get("wled_program") != "Disabled"
        or storage.get("strip_program") != "Disabled"
    )
    if should_enable == is_enabled:
        return
    if should_enable:
        for device in ["ring", "wled", "strip"]:
            set_program(device, storage.get(f"last_{device}_program"))
    else:
        for device in ["ring", "wled", "strip"]:
            set_program(device, "Disabled")
def set_lights_shortcut ( request : WSGIRequest ) -> None : should_enable = request . POST . get ( "value" ) == "true" is_enabled = ( storage . get ( "ring_program" ) != "Disabled" or storage . get ( "wled_program" ) != "Disabled" or storage . get ( "strip_program" ) != "Disabled" ) if should_enable == is_enabled : return if should_enable : for device in [ "ring" , "wled" , "strip" ] : set_program ( device , storage . get ( f"last_{device}_program" ) ) else : for device in [ "ring" , "wled" , "strip" ] : set_program ( device , "Disabled" )