def on_motion_triggered(event): logger.info("Kitchen motion detected") timer_manager.cancel_timer("landing_motion_timer") timer_manager.cancel_timer("kitchen_motion_timer") if not state_machine.is_enabled( "indoor_movie_mode") and state_machine.is_enabled( "motion_lighting"): LightAction().add_light("landing_light").turn_on() if not state_machine.is_enabled( "outdoor_movie_mode", "indoor_movie_mode" ) and state_machine.is_enabled("motion_lighting"): LightAction().add_light("kitchen_cabinet_lights").turn_on( color_temp=400) if not state_machine.is_enabled("sleep_mode"): LightAction().add_light("kitchen_lights").turn_on()
def on_sleep_state_enabled(event): logger.info("Sleep state enabled") hassutil.activate_scene("sleep_mode") JoinAction().add_target("jim_cell").send_taker_command("bed_command") if state_machine.is_heating_enabled(): heat_action = ThermostatAction().add_thermostat("oil_thermostat") heat_action.set_temperature(state_machine.get_number("sleep_mode_heat"), 'heat') if state_machine.is_enabled("christmas_lights_mode"): LightAction().add_light("christmas_tree_lights").turn_off()
def lights_off(): LightAction().add_lights(["attic_lights"]).turn_off()
def on_door_opened(event): logger.info("Garage door opened") PushNotifyAction().add_target("jim_cell").set_message( "Garage door opened", notification_id="garage-door-state").notify() LightAction().add_light("garage_lights").turn_on()
def on_closet_single_click(event): logger.info("Master Bedroom Closet Button single clicked") LightAction().add_light("master_bedroom_closet_lights").toggle()
def on_bottom_button(event): logger.info("Turning off dining room light") LightAction().add_light("dining_room_light").turn_off()
def on_door_opened(event): logger.info("Jim Closet door opened") timer_manager.cancel_timer("jim_closet_door_timer") LightAction().add_light("jim_closet_light").turn_on()
def landing_light_off(): if state_machine.is_enabled("motion_lighting"): LightAction().add_light("landing_light").turn_off()
def on_bottom_button(event): logger.info("Turning off master bedroom mirror light") LightAction().add_light("master_bedroom_mirror_led").turn_off()
def on_top_button(event): logger.info("Turning on master bedroom light") LightAction().add_light("master_bedroom_fixture").turn_on(color_temp=255)
def on_motion_triggered(event): logger.info("Garage motion detected") timer_manager.cancel_timer("garage_motion_timer") if state_machine.is_enabled("motion_lighting"): LightAction().add_light("garage_lights").turn_on()
def lights_off(): if state_machine.is_enabled("motion_lighting"): LightAction().add_light("garage_lights").turn_off()
def handle_turned_off(event): LightAction().add_light("kitchen_hi_hats").turn_off()
def on_bottom_button(event): logger.info("Turning off hallway lights") LightAction().add_light("hallway_lights").turn_off()
def on_top_button(event): logger.info("Turning on hallway lights") LightAction().add_light("hallway_lights").turn_on()
def on_motion_triggered(event): logger.info("Erica closet motion detected") timer_manager.cancel_timer("erica_closet_motion_timer") if state_machine.is_enabled("motion_lighting"): LightAction().add_light("erica_closet_light").turn_on()
def on_sunset(event): if state_machine.is_enabled("christmas_lights_mode"): SwitchAction().add_switches(["frontyard_outlet", "backyard_outlet", "porch_outlet"]).turn_on() LightAction().add_light("front_garden_lights").turn_on()
def lights_off(): if state_machine.is_enabled("motion_lighting"): LightAction().add_light("erica_closet_light").turn_off()
def lights_off(): if state_machine.is_enabled("motion_lighting"): if not state_machine.is_enabled("sleep_mode"): LightAction().add_lights(["hallway_lights"]).turn_off() else: LightAction().add_lights(["first_floor_staircase_led"]).turn_off()
def on_bottom_button(event): logger.info("Turning off master bedroom light") LightAction().add_light("master_bedroom_fixture").turn_off()
def on_motion_triggered(event): logger.info("Fourth bedroom motion detected") timer_manager.cancel_timer("fourth_bedroom_motion_timer") if state_machine.is_enabled("motion_lighting"): LightAction().add_light("fourth_bedroom_fixture").turn_on()
def lights_off(): LightAction().add_lights(["jim_closet_light"]).turn_off()
def lights_off(): if state_machine.is_enabled("motion_lighting"): LightAction().add_light("fourth_bedroom_fixture").turn_off()
def basement_lights_off(): if state_machine.is_enabled("motion_lighting"): LightAction().add_light("basement_lights").turn_off()
def kitchen_lights_off(): if state_machine.is_enabled("motion_lighting"): LightAction().add_lights(["kitchen_lights", "kitchen_cabinet_lights"]).turn_off()
def on_top_button(event): logger.info("Turning on dining room light") LightAction().add_light("dining_room_light").turn_on(color_temp=255)
def on_motion_triggered(event): logger.info("Office motion detected") if not state_machine.is_enabled("sleep_mode") and state_machine.is_enabled("motion_lighting"): LightAction().add_light("office_lights").turn_on()
def on_long_press(event): logger.info("Basement Button long press") LightAction().add_light("basement_fan").toggle()
def on_door_opened(event): logger.info("Attic door opened") timer_manager.cancel_timer("attic_door_timer") LightAction().add_light("attic_lights").turn_on()