I think I've found a solution, I have modified Sebastian's HA script that I'm also using for sending Battery and WiFi status from my Prontos to HomeSeer.
/*! @title test10.v-fischer @version 1.0 @author v Fischer */
var updateInterval = 60 * 1000; // 1 min; in msec
function getDate() { d = new Date(); return d.getFullYear() + "-" + ("0" + Number(d.getMonth()+1)).slice(-2) + "-" + d.getDate() + "T" + GUI.getDisplayTime() + ":" + ("0" + d.getSeconds()).slice(-2); } function time() { var timePattern = new RegExp('(\\d+):(\\d+)((am|pm)*)','g'); GUI.getDisplayTime().match(timePattern);
var hour = parseInt(RegExp.$1,10);
var minute = parseInt(RegExp.$2,10);
if (hour === 3 && minute === 55) {CF.widget("A4","B","C").executeActions();} var ampm = RegExp.$3; var seconds = new Date().getSeconds(); }
/* schedule periodic updates for when the TSU sits in the charging dock and it is powered on. */ function periodicUpdate_2(activity) { System.setDebugMask(9); System.print(getDate() + " [ScheduleAfter] TIMER"); time(); activity.scheduleAfter(updateInterval, periodicUpdate_2, activity); }
((function () { //debugging System.setDebugMask(9); // the current activity. var myActivity = CF.activity(); myActivity.onEntry = function () { last = System.getGlobal('time_last_update'); ts = Date.now(); if (last === null) { System.print(getDate() + " [Wake up]");
time();
System.setGlobal('time_last_update', ts); } }; System.print(getDate() + " Setting up scheduled updates for TIMER"); myActivity.scheduleAfter(updateInterval, periodicUpdate_2, myActivity); System.print("Done.");
}()));
I'm using onEntry to kick off the new timer.
Will do some more tests, but it seems that all is working fine now. I'm using the stuff to put the sunrise/sunset data into Schmuzli's Prontotimer because the weather.com data aren't available nomore.
(BTW: Barry's Pronto Pro Debugger shows 'Action list error' but that can be ignored)