/Snips-Wecker

An app for Snips.ai with a fully controllable alarm clock :alarm_clock:

Primary LanguagePython

Snips-Wecker ⏰

An app for Snips.ai with a fully controllable alarm clock.

Table of Contents

Features
Installation
Configuration
Usage
Troubleshooting
Coming soon
Contribution

I. Features

  • Full multi-room support 🏠
  • context-awareness: it detects what room you're in 💬
  • customizable (ringtone sound, volume, ringing timeout, rooms) 🔧

II. Installation

❗ The following instructions assume that Snips is already configured and running on your device (e.g. a Raspberry Pi 3 from the Snips Maker Kit with Raspbian Stretch Lite). SAM should also already be set up and connected to your device and your account.

  1. In the German app store add the app Wecker & Alarme (by domi; this) to your German assistant.

  2. You want to have a more unique alarmclock? Take a look at the section Configuration below and see what you can change.

  3. If you already have the same assistant on your platform, update it with:

    sam update-assistant

    Otherwise install the assistant on the platform with the following command to choose it (if you have multiple assistants in your Snips console):

    sam install assistant

    You may change some parameter values of the alarmclock during installation.

III. Configuration

1. Normal (single-room specific)

In the Snips console or manually in the file /var/lib/snips/skills/Snips-Wecker/config.ini you can change some parameters that influence the behaviour of the alarm clock app:

Parameter name Default Range Description
ringing_volume 50 0 - 100 Volume of the ringtone
ringing_timeout 30 3 - 8000 Time in seconds for the ringing timeout
restore_alarms on on/off Whether the alarms should be restored after reboot
ringtone_status on on/off Describes the state of the ringtone. If it's off, only a MQTT message will be sent when the alarm is ringing

2. Advanced (multi-room specific)

  • Parameter ringing_volume for different ringing volume in each room:

    Scheme: siteId1: volume1, siteId2: volume2, siteId3: volume3, [...]
    Unit: Volume in % with range 0 - 100

    Example: kitchen: 20, bedroom: 70, bathroom: 100

  • Parameter ringing_timeout for different ringing timeout in each room:

    Scheme: siteId1: timeout1, siteId2: timeout2, siteId3: timeout3, [...]
    Unit: Timeout in seconds with range 3 to 8000

    Example: kitchen: 50, bedroom: 120, bathroom: 300

  • Parameter ringtone_status for different ringtone status in each room:

    Scheme: siteId1: status1, siteId2: status2, siteId3: status3, [...]
    Unit: Status with on or off

    Example: kitchen: off, bedroom: on, bathroom: on

  • Parameter dict_siteIds:
    Important if you have a multi-room setup of Snips! These are pairs of room names and siteIds of these rooms.

    Scheme: room1: siteId1, room2: siteId2, room3: siteId3, [...]
    Default: Schlafzimmer:default

  • Parameter default_room:
    Important if you have a multi-room setup of Snips!
    Here must be the name of the room in which the alarm is to be set, if no room was said in the command.

    Scheme: roomname
    Default: Schlafzimmer

Examples of multi-room configurations

Example 1

Example 1

Parameters values in the Snips console in this app:

  • dict_site-id: Wohnzimmer:main, Küche:kitchen, Büro:office, Schlafzimmer:bedroom
  • default_room: Schlafzimmer

IV. Usage

1. Example sentences

New alarm:

  • Wecke mich in neun Stunden.
  • Kannst du mich morgen um 8 Uhr 30 wecken?
  • Bitte wecke mich in drei Tagen um 5 Uhr.
  • Stelle einen Alarm in zwei Minuten.
  • Alarmiere mich hier in 15 Minuten.
  • Stelle im Schlafzimmer einen Alarm auf 10 Uhr 20.
  • Stelle einen Alarm in der Küche auf 18 Uhr 50.
  • Ich möchte morgen um 7 Uhr in diesem Raum geweckt werden.
  • Morgen soll mich ein Wecker um 10 Uhr wecken.

Get alarms:

  • Gibt es einen Alarm um 12 Uhr?
  • Gibt es einen Wecker um 1 Uhr in diesem Zimmer?
  • Sage alle Alarme hier zwischen 21 Uhr und 23 Uhr.
  • Bitte zähle die Alarme von der Küche bis zwanzig Uhr auf.
  • Wird heute um Mitternacht der Wecker im Kinderzimmer losgehen?
  • Ist für heute Abend neunzehn Uhr ein Wecker aktiv?
  • Ich will alle Alarme wissen, die heute in diesem Zimmer klingeln.
  • Welche Alarme werden am Mittwoch in zwei Wochen klingeln?

Get next alarm:

  • Wann klingelt in der Küche der nächste Alarm?
  • Was ist der nächste Alarm?
  • Kannst du mir sagen wann der nächste Alarm klingelt?
  • In wie vielen Stunden klingelt hier der nächste Alarm?
  • Sage mir wann der nächste Alarm klingelt.
  • Wann ist der nächste Wecker gestellt?
  • Wann klingelt der nächste Alarm im Bad?
  • Ich will wissen wann im Schlafzimmer der nächste Alarm los geht.

Delete alarms:

  • Lösche alle Alarme morgen um neun Uhr im Foyer.
  • Kannst du bitte den Wecker morgen um neun Uhr im Foyer entfernen.
  • Kannst du den Wecker in zwei Tagen um achtzehn Uhr im Eingangsbereich löschen.
  • Alarm um neun Uhr zehn im Esszimmer löschen.
  • Bitte den Alarm im Wohnzimmer um 8 Uhr zwanzig entfernen.
  • Entferne den Alarm heute um zehn Uhr auf dem Dachboden.
  • Lösche den Alarm heute um drei Uhr in diesem Raum.
  • Entferne den Wecker im Klo um acht Uhr.

Get missed alarms:

  • Habe ich Alarme heute hier verpasst?
  • Habe ich in der Vergangenheit hier Alarme verpasst?
  • Sage bitte die nicht gehörten Wecker vom Eingang.
  • Kannst du die nicht gehörten Alarme sagen.
  • Bitte lese alle verpassten Alarme von gestern vor.
  • Kannst du alle verpassten Wecker von der Küche sagen.
  • Sage alle verpassten Alarme von diesem Mittwoch.
  • Habe ich letzte Woche im Kinderzimmer einen Alarm verpasst?

2. While ringing

While an alarm is ringing in a room you can say a hotword in this room, which is by default "Hey Snips!". The ringtone

img

3. MQTT messages

In messages

external/alarmclock/in/getAllAlarms

You should subscribe to external/alarmclock/out/allAlarms before publishing this message. Then you will get all alarms.

No JSON Payload required.

hermes/external/alarmclock/in/stopRinging

JSON Payload (I'm working on it):

Key Value
siteId String - Site where the alarmclock should stop ringing

Out messages

external/alarmclock/out/newAlarm

JSON Payload: data (example access name)

Key Value
new JSON Object - Alarm details: datetime object and siteId (see below: 'new')
all Dictionary - Includes all alarms (with the new one; see below: 'all')

'new' - JSON Object: data['new']

Key Value
datetime String - Python object which includes date and time
siteId String - Site where the user created the alarm

'all' - Dictionary: data['all']

Dict-Keys (description) Dict-Values (description)
datetime (String - Includes date and time; can be parsed into datetime object with strptime from module datetime (see below)) siteId (String - Site where the user created the alarm)

An example parsing with Python is in examples/exaple_parsing_newAlarm.py

external/alarmclock/out/allAlarms

todo

external/alarmclock/out/ringing

JSON Payload:

Key Value
siteId String - Site where the alarmclock is ringing
room String - Room name where the alarmclock is ringing

V. Troubleshooting

  • I can't receive some MQTT messages from the Alarmclock.

    Some MQTT clients may have a package size limit, so you won be able to receive messages with a larger payload than the limit size until you increase this. E.g. in the library PubSubClient for the Arduino the package limit is 128 bytes. In the file <Arduino libraries folder>/PubSubClient/src/PubSubClient.h the constant MQTT_MAX_PACKET_SIZE must be increased. How much? This depends on how many alarms you will create.

  • The time is wrong on my device.

    Make sure that the time and date are correct on your device.

VI. Coming 🔜

  • Ask for missed alarms [############_]
  • New setting: snooze en/disabled (then don't end session)
  • Captcha exercises against oversleeping [______________________]
  • Internationalisation [############__]
  • Nice README [#######__________]
  • Send alarm data over MQTT [###_________________]
  • Maybe: periodical alarms (daily, weekly); before: change clock thread to schedule module

VII. Contribution

Please report errors and bugs (you can see them with sam service log snips-skill-server or on the Pi with sudo tail -f /var/log/syslog) by opening a new issue. You can also write other ideas for this app. Thank you for your contribution.

Made with 💙