示例#1
0
def on_door_lock_changed(event):
    if event.is_locked:
        logger.info("Front door locked")
        PushNotifyAction().add_target("jim_cell").set_message(
            "Front door locked", notification_id="front-door-lock").notify()
    else:
        logger.info("Front door unlocked")
        PushNotifyAction().add_target("jim_cell").set_message(
            "Front door Unlocked", notification_id="front-door-lock").notify()
def on_person_away(name):
    logger.info("{} has left home".format(name))
    
    if hassutil.is_nobody_home():
        handle_nobody_home()
    
    if name == "jim_presence":
        DoorLockAction().add_lock("front_entrance_lock").lock()
        PushNotifyAction().add_target("jim_cell").set_message("Come back soon!").notify()

        if state_machine.is_garage_open():
            PushNotifyAction().add_target("jim_cell").set_message("Garage door is open!", notification_id="garage-alert", tts=True).notify()
def on_person_home(name):
    logger.info("{} has arrived home".format(name))
    
    handle_somebody_home()
    
    if name == "jim_presence":
        PushNotifyAction().add_target("jim_cell").set_message("Welcome home!").notify()
def on_doorbell_pushed(payload):
    if payload == 'on':
        logger.info("Doorbell push detected")
        PushNotifyAction().add_targets("jim_cell", "erica_cell").set_message(
            "Doorbell is ringing",
            notification_id="hass-doorbell-push",
            tts=True).notify()
示例#5
0
def on_washer_finished():
    PushNotifyAction().add_targets(
        "jim_cell",
        "erica_cell").set_message("Washing Machine has finished").notify()

    if not state_machine.is_enabled("sleep_mode"):
        TTSAction().add_assistants(["living_room_mpd", "master_bedroom_mpd"
                                    ]).say("Washer has finished")
示例#6
0
def on_generate(event):
    logger.info("Generating mealplan")
    success, errorList = trello_util.generate_grocery_list_from_meal_plan()
    
    PushNotifyAction().add_target("jim_cell").set_message("Mealplan generation is finished!", notification_id="mealplan-alert", tts=True).notify()

    if not success:
        hassutil.gui_notify("Grocery List Errors", message="\n".join(errorList))
def on_doorbell_motion(payload):
    if payload == 'on':
        logger.info("Doorbell motion detected")
        PushNotifyAction().add_target("jim_cell").set_message(
            "Motion at front door",
            notification_id="hass-doorbell-motion").notify()
    elif payload == 'off':
        logger.info("Doorbell motion cleared")
    else:
        logger.warning(f"Received invalid motion payload {payload}")
示例#8
0
def _notify_dryer_finish():
    global dryer_start

    if not state_machine.is_enabled("sleep_mode"):
        TTSAction().add_assistants(["living_room_mpd", "master_bedroom_mpd"
                                    ]).say("Dryer has finished")

    PushNotifyAction().add_targets(
        "jim_cell", "erica_cell").set_message("Dryer has finished").notify()
    dryer_start = None
示例#9
0
def callback():
    conn = http.client.HTTPSConnection("www.shopskibluemt.com")
    payload = 'productId=582&productForm=product_attribute_3618%3D%26product_attribute_3617%3D6127431%26product_attribute_3630-startdate%3D%26product_attribute_3630-price%3D0%26product_attribute_3630%3D%26addtocart_582.EnteredQuantity%3D1&start=2021-01-23T00%3A00%3A00&end=2021-01-24T00%3A00%3A00'
    headers = {
        'Content-Type':
        'application/x-www-form-urlencoded',
        'Cookie':
        'Nop.customer=80fce464-b4da-4cbc-b56a-d528f48eaf3f; TS01426631=01c017140d08eade67514b4ccac7aa8ab661b2510d094c3d38791250d06e6b2f37b5939bf01a684f0f0f4f9d5ec17f61092caac88e'
    }
    conn.request("POST", "/intouchPrices/list", payload, headers)
    res = conn.getresponse()
    data = res.read()
    data = json.loads((data.decode("utf-8")))
    for day in data:
        if DATE in day['optionDisplay']:
            PushNotifyAction().add_target("jim_cell").set_message(
                day['optionDisplay']).notify()
示例#10
0
def on_timeout(friendly_name):
    PushNotifyAction().add_target("jim_cell").set_message(
        f"{friendly_name} is unavailable").notify()
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_door_closed(event):
    logger.info("Garage door closed")
    PushNotifyAction().add_target("jim_cell").set_message(
        "Garage door closed", notification_id="garage-door-state").notify()
def on_dry_event(event):
    logger.info("Basement sensor dry")

    PushNotifyAction().add_target("jim_cell").set_message(
        "Basement dry!").notify()