Haiku Flag email

Ok well I put the script in and ran it with the time now and I got an email with 0's which I guess isn't a problem. I will let it run for a day or two now and see how it goes. Thanks!
 
I got my report at 1:30 today and it still reads as 0's. I don't think this is correct? What do I put for the zone name the description? I just want to make sure I am doing this properly. Anything else have to reflect the zone name or number in the aforementioned scripts?

Thanks,

Neil
 
Interestingly enough today my email didn't show up?

As for the short name is that the zone name from the omni? That is what I was using.
 
var poolMeterDay = 0;
var poolMeterWeek = 0;

function onSyncStart(forced, timestamp) {
var date = new Date(timestamp);

if(date.getHours() == 13 && date.getMinutes() == 30) {
sendPoolMeterReport();
poolMeterDay = 0;
if(date.getDay() == 0) poolMeterWeek = 0;
}
}

function onZoneNotReady(zone) {
if(zone.name == "Water Meter") incrementPoolMeter();
}

function incrementPoolMeter() {
poolMeterDay += 1;
poolMeterWeek += 1;
}

function sendPoolMeterReport() {
var report = "Pool Meter Report: Week = " + poolMeterWeek + " Day = " + poolMeterDay;
helper.sendMail(controller, "[email protected]", "Pool Meter Report", report);
helper.log(controller, report);
}
 
Also I noticed this morning that HaikuHelper had a little spinning wheel next to the controller and it said something. I stopped it and started it back up and it shows connected now. I think it lost connectivity for some reason - not the first time either.
 
The problems I foresee with this methodology and I hope you can clarify is this: if for any reason HaikuHelper restarts - the flags are reset to 0. That means if I restart the program, reboot the machine or whatever, correct?

If this is the case it doesn't work very well for me. There are more and numerous circumstances this machine could need a restart. Just wondering but I would better to have a DB or a file we wrote to that we could retrieve that number?

Thanks,

Neil
 
Good news I got my email today! 7, 7

So I think there was a hiccup in the connection between the machine and the omnipro.

Thanks,

Neil
 
Check the HaikuHelper log to see if the report was generated and logged at the time it was supposed to?


Also regarding storing values -- the next version adds support for localStorage and databases (HTML5). So you will be able to have it remember the values even if the machine or HaikuHelper is restarted. To do so, you will use localStorage.poolMeterDay and localStorage.poolMeterWeek (instead of poolMeterDay and poolMeterWeek) and take out the first two lines from the script.
 
Looks like it isn't running every day. I started using an include but that wasn't when it stopped working.

First line:


helper.include(controller, "pool.js")

pool.js just has our regular script.
 
Try adding this line into onSyncStart:
Code:
helper.log(controller, 'Started sync at ' + now.getHours() + ':' + now.getMinutes());
Lets see if it logs properly every minute? Afterwards, move it into the if() condition so that it only logs when the scheduled time matches.

I've tested here and it seems to be working fine.
 
I added that line and nothing in the log files. I think it has to do with the include. I am going to pull it out and see what happens.

Something is screwy. I put it in the script and I don't see anything in the logs. Any ideas now?

I just looked at my events.log and I don't think that is working properly for me anymore. Also in that events.log I noticed that the events are being repeated lots and lots of time....

Sorry for the trouble!

Update: I pulled my event log script / function out of the include and it is writing now. It seems to write the same stuff everytime is runs. Anyway still no email or log entry for the pool stuff
 
Back
Top