Hey, I have a little knowledge of Python but I am having a hard time figuring out the scripts I need to use. My goal is to write a script that tells the plug to turn on between 6am-12pm and to turn off between 12:01am-5:59am. I have seen the example configuration files but I’m confused how to modify it for my needs. Does anybody have an example config they used to accomplish this? Do I need to use the Digi ESP application to write the code and upload onto the device from there.
OK, new to responding so here is goes. Digi ESP is a great tool so I would highly recommend using it, it keeps everything organized for you. As far as the time thing goes, look up ‘time’ in python and try running small commands on a python IDE to see what each time unit stands for, there are many variations of ‘time’ in python.
“http://docs.python.org/release/3.1.5/library/time.html”
This website has many descriptions of time units available in python. Note: you must ‘import time’ into your module or you will not be able to access time units.
Once you get a unit of time that satisfies you can use it any way you like.
Hope this helps.
Hello, I don’t have any examples to share, but this would be very simple to do. I would first create a configuration file for your application, giving the times to turn on and off as possible settings.
Your script can then open up this file and parse for times to turn on and off.
The next thing to do would be to use a separate thread which runs separate from main, checking the time every so often and comparing it to the time from your configuration file.
When it sees that the time matches (or if later than the times you sepcify, depending on the interval of your thread and the times you ask to turn on/off), your script can send the command to turn the adapter power to on or off.
Let me know if you have more questions.