Created
October 30, 2020 22:28
-
-
Save blacklight/585ee33114171b80d61a53f626977640 to your computer and use it in GitHub Desktop.
Script illustrating two hooks that send a notification to the configured mobile devices when a baby cry start/stop event is detected
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from platypush.context import get_plugin | |
from platypush.event.hook import hook | |
from platypush.message.event.custom import CustomEvent | |
@hook(CustomEvent, subtype='baby-cry', state='positive') | |
def on_baby_cry_start(event, **_): | |
pb = get_plugin('pushbullet') | |
pb.send_note(title='Baby cry status', body='The baby is crying!') | |
@hook(CustomEvent, subtype='baby-cry', state='negative') | |
def on_baby_cry_stop(event, **_): | |
pb = get_plugin('pushbullet') | |
pb.send_note(title='Baby cry status', body='The baby stopped crying - good job!') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment