Script Prerequisites: Google Chromecast device(s) Python 3.x installed Python modules: sys, datetime, pychromecast, smtplib, email and requests
The schedule.py script reads in data from a schedule.txt file located in the /scripts/python directory.
The schedule file is set up with each line containing the information for a timed event with the information formated as follows:
time|title|function|param1|param2|param3
time - is the time of the event formated as YYYY-MM-DD HH:MM. To create a daily event format time as DAY HH:MM - DAY 12:00 title - is the title of the event function - currently there are only three functions - birthday, send_text and timed_device
birthday - plays a random song located in the www/media/birthday songs directory. The songs are named 1.mp3,2.mp3,3.mp3,etc... sent_text - sends a text message timed_device - turned on/off a device using the device's idx number
Params1,2,3 are used to pass parameters according to the functions parameters - see the comments in the schedule.py script for more information about the parameters for the functions
To get this up and running:
- Place the schedule.py file in the /scripts/python directory
- Place the lua script in the /scripts/lua directory
- Create a birthday songs directory in the www/media directory
- Copy birthday songs into the birthday songs directory
- Rename songs 1.mp2, 2.mp3 and so on untill all song names are a number
- Edit the second number in the randint function on line 30 to match the number of mp3 files you have in your www/media/birthday songs directory
- Edit the fromaddr on line 50 to the desired from email address
- Edit line 61 to reflect your smtp sever and port
- Edit line 63 to reflect your user and password information used to connect to your smtp server
- Modify the schedule.txt file as desire - each line needs 5 pipe characters - "|" - regardless of the function being called
More functions can easily be added by creating more def's
As well for testing purposes there is a testing parameter that can be used to bypass the time = use 'TEST' in the time field.
Running Domoticz Version: 4.97 on Windows 10 | Domoticz intagrated with Controlicz/Google Home/Kodi/LMS/Milights/Nest/Yeelights/z-wave