Ejemplo n.º 1
0
def callback():
    if not hassutil.is_weekend() and state_machine.is_heating_enabled():
        if state_machine.is_enabled("jim_wfh_calendar"):
            LightAction().add_light("office_lights").turn_on()
            if state_machine.is_heating_enabled():
                _enable_office_heat()
        else:
            timer_manager.schedule_oneoff_task("office_heatup",
                                               _enable_office_heat, "08:00:00")
Ejemplo n.º 2
0
def handle_nobody_home():
    logger.info("Nobody home...")

    if not state_machine.is_enabled("guest_mode"):
        hassutil.activate_scene("nobody_home")

        if state_machine.is_heating_enabled():
            heat_action = ThermostatAction().add_thermostat("oil_thermostat")
            heat_action.set_temperature(state_machine.get_number("away_heat"), 'heat')
Ejemplo n.º 3
0
def callback():
    if state_machine.is_enabled("jim_wfh_calendar"):

        LightAction().add_light("office_lights").turn_on()

        if state_machine.is_heating_enabled():
            heat_action = ThermostatAction().add_thermostat("office_heat")
            heat_action.turn_on()
            heat_action.set_temperature("74", "heat")
Ejemplo n.º 4
0
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()
Ejemplo n.º 5
0
def handle_somebody_home():
    logger.info("Someone is home now...")
    
    LightAction().add_lights(["kitchen_lights", "kitchen_cabinet_lights"]).turn_on()
    LightAction().add_lights(["dining_room_light", "living_room_lamps"]).turn_on(color_temp=255)

    if state_machine.is_heating_enabled():
        heat_action = ThermostatAction().add_thermostat("oil_thermostat")
        heat_action.set_temperature(state_machine.get_number("normal_heat"), 'heat')
    
    #TODO: cancel timer for simulating someone being home
    #TODO: set lights / thermostats / tvs
Ejemplo n.º 6
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")
Ejemplo n.º 7
0
def on_sleep_state_disabled(event):
    logger.info("Sleep state disabled")
    
    SwitchAction().add_switch("master_bedroom_whitenoise").turn_off()
    JoinAction().add_target("jim_cell").send_taker_command("awake_command")
    LightAction().add_lights(["first_floor_staircase_led"]).turn_off()
    ThermostatAction().add_thermostat("master_bedroom_ac").turn_off()

    if state_machine.is_heating_enabled():
        heat_action = ThermostatAction().add_thermostat("oil_thermostat")
        heat_action.set_temperature(state_machine.get_number("normal_heat"), 'heat')

    if state_machine.is_enabled("christmas_lights_mode"):
        LightAction().add_light("christmas_tree_lights").turn_on_no_brightness()
Ejemplo n.º 8
0
def on_enabled(event):
    hassutil.activate_scene("workout_mode")

    if state_machine.is_heating_enabled():
        ThermostatAction().add_thermostat("oil_thermostat").turn_off()