Community
OpenEnergyMonitor

Community

emonTH offline temperature recorder?

Tags: #<Tag:0x00007f6e062f25d0>

I am interested in using one of my emonTH’s as a temperature logger. BUT… I need it to record temperatures when it has no connection to my emonBase, and then transmit them when it reconnects.

Has anyone done code to do this? And how would one deal with the time in the recorded data - I assume when it sends it to emonBase, the timestamp is applied by the receiver.

Thanks

Answering the easy bit first, I can’t recollect anyone ever mentioning doing anything like this. Stand-alone data loggers have been mentioned on occasions, but not as I recall has anyone said anything about using an emonTH.

My initial reaction is that available memory and power - battery life - will be your problem.

As it stands, the emonTH transmits its data and forgets it. It doesn’t turn round and listen for a response, so it doesn’t know or care whether the data got through. But it can receive, so after sending a temperature, you’d need to turn the radio on in receive mode and add code to handle an acknowledgement to know whether to store the data or send the stored values.

As far as time is concerned, yes, emonCMS determines the time. This depends on how you set up the database. If the feed is PHPFINA, the data goes into a fixed time slot. If it’s PHPTIMESERIES, the data is stored with a time stamp. It might be possible to add a real-time clock and send the time as well as temperature. But I don’t think that’s strictly necessary if the emonTH knows when the data has got through and when it hasn’t.

All this will cost cost some memory, and you’ll need to use some of that to store the data when you fail to get an acknowledgement. I haven’t checked how much free memory there is after the standard sketch is loaded - but it would only be a rough guide anyway.

And then, emonCMS (as far as I know) will only accept data in strict chronological order, so you’ll need to intercept the first reading received after a break, send an ACK to trigger a resend of the lost data and then pass all that to emonCMS in the right order.

Can I ask why it loses connection in the first place?