Beispiel #1
0
def on_motion_cleared(event):
    logger.info("Kitchen motion cleared")
    timer_manager.start_timer("landing_motion_timer",
                              landing_light_off,
                              minutes=5)
    timer_manager.start_timer("kitchen_motion_timer",
                              kitchen_lights_off,
                              minutes=30)
Beispiel #2
0
def on_motion_cleared(event):
    logger.info("Basement stairs motion cleared")

    timer_manager.start_timer("landing_motion_timer",
                              landing_light_off,
                              minutes=5)
    if not state_machine.is_enabled("workout_mode"):
        timer_manager.start_timer("basement_stairs_motion_timer",
                                  basement_lights_off,
                                  minutes=10)
Beispiel #3
0
def on_disabled(event):
    MediaPlayerAction().add_media_player("basement_tv").turn_off()
    LightAction().add_light("basement_fan").turn_off()

    light_action = LightAction().add_light("basement_lights").turn_off
    timer_manager.start_timer("basement_stairs_motion_timer",
                              light_action,
                              minutes=10)

    if state_machine.is_heating_enabled():
        heat_action = ThermostatAction().add_thermostat("oil_thermostat")
        heat_action.turn_on()
        heat_action.set_temperature(state_machine.get_number("normal_heat"),
                                    "heat")
Beispiel #4
0
def handle_set_timer(intent, source, raw, slotMap):
    if not "timer_name" in slotMap or not "timer_duration" in slotMap:
        logger.error("Must have name and duration of timer")
        return

    if source not in assistant_list:
        logger.error("Invalid source room supplied")
        return

    duration = slotMap["timer_duration"]
    name = slotMap["timer_name"]["value"]
    action = AssistantAction().add_assistant(source).tts_say
    callback = functools.partial(action, "{} timer has finished".format(name))
    timer_manager.start_timer(name,
                              callback,
                              seconds=duration["seconds"],
                              minutes=duration["minutes"],
                              hours=duration["hours"],
                              days=duration["days"])

    AssistantAction().add_assistant(source).tts_say(
        "{} timer started".format(name))
def play_white_noise():
    mp_action = MediaPlayerAction().add_media_player("master_bedroom_mpd")
    mp_action.set_volume(0.8)
    mp_action.play_music("http://10.0.0.6:8123/local/white_noise.mp3")
    timer_manager.start_timer("white_noise_restart", play_white_noise, hours=1)
Beispiel #6
0
def on_unavailable(event):
    logger.info(f"Received unavailable for {event.name}")
    timer_manager.start_timer(f"{event.name}_unavailable_timer",
                              partial(on_timeout, event.name),
                              minutes=5)
Beispiel #7
0
def on_door_closed(event):
    logger.info("Jim Closet door closed")
    timer_manager.start_timer("jim_closet_door_timer", lights_off, minutes=5)
def on_motion_cleared(event):
    logger.info("Erica closet motion cleared")
    timer_manager.start_timer("erica_closet_motion_timer",
                              lights_off,
                              minutes=5)
def on_motion_cleared(event):
    logger.info("Landing motion cleared")

    timer_manager.start_timer("landing_motion_timer", lights_off, minutes=5)
Beispiel #10
0
def on_motion_cleared(event):
    logger.info("Fourth bedroom motion cleared")
    timer_manager.start_timer("fourth_bedroom_motion_timer", lights_off, minutes=15)
Beispiel #11
0
def on_motion_cleared(event):
    logger.info("Hallway motion cleared")
    timer_manager.start_timer("hallway_motion_timer", lights_off, minutes=5)
Beispiel #12
0
def on_washer_off_event(event):
    logger.info("Washer turned off")
    timer_manager.start_timer("laundry_washer_timer",
                              on_washer_finished,
                              minutes=6)
def on_motion_cleared(event):
    logger.info("Garage motion cleared")
    timer_manager.start_timer("garage_motion_timer", lights_off, minutes=20)
def on_door_closed(event):
    logger.info("Attic door closed")
    timer_manager.start_timer("attic_door_timer", lights_off, minutes=20)