How to record temperature ?

Hi there,
I would like to record the variation of the temperature in few rooms in the house. With Trane ZWAVE thermostat and VERA2 I can monitor the current temperature remotely and locally but can’t record it.
Any ideas how to do it with VERA2?
Thanks,
Nenad

You have to use Lua/Lua Luup extensions:

local outf = io.open('/etc/cmh/temp.log', 'a')

outf:write(os.date('%Y-%m-%d %H:%M:%S '..os.time()..' ')..luup.variable_get("urn:upnp-org:serviceId:TemperatureSensor1","CurrentTemperature",16806)..'\n')

outf:close()

Replace 16806 with the id of your temperature sensor (from ‘Advanced’ tab, ‘id’ next to ‘device_file’).

Add the code to the ‘Luup’ tab of a scene.

To access the logfile, ssh to your Vera.

I tried this, not sure why it’s not recording to the temp.log, I SSH in there and can’t find it.
Do I need to reboot Vera? Is there any special scene I need to use?

thanks for the help, lots of folks wish this was easier. I’d like to somehow have it post to a Googe docs spreadsheet with Wget, and also log the Google Weather Plugin temp and some of my Fortrezz H20/Freeze sensors and each HSM100 3-in-1. Any ideas on how to do that? I see one guy using Wget to push a log, but hes not using google docs.

thanks again for all your contributions here, you, guessed and many others have done so much for the code here for all of us newbies that are clueless. :slight_smile:

Maybe this is just a stupid answer, but are you triggering the scene off every hour or so in order to record the temp?

@myhomeserver

Please test my code in the ‘MiOS developers’ → ‘Test Luup code (Lua)’ window. If it doesn’t work there, chances are that you are using the wrong device id (use the id of the temperature device, not the id of the HSM100).

Thanks, I have three of these and I also have two other sensors from Fortrezz that have temp capabilities.

I also want to use the google Weather Plugin (current temp) and record all these. For some reason the test code wasnt working, so I checked and tried again this AM and it worked. For some reason, my ID of some of my 3-in-1 sensors are e1, e3.

Any ideas how I can modify the code to support the FortrezZ sensors? Thanks for the help, the other question is about the scene, How often does the temp get recorded? ANy way to add all these into one scene so it grabs all the temps?
Just wondering the best way, I’d like to record every hour, but not sure what I need to do in the scene to do this

For some reason, my ID of some of my 3-in-1 sensors are e1, e3.

Please use the ‘id’ from the ‘Advanced’ tab, the ‘id’ is next to ‘device_file’.

How often does the temp get recorded?

Every time the sensor wakes up (‘Wakeup interval’), it sends the current light level and the current temperature to Vera.

is there any other way to access the temp log other than ssh?

OpenWRT comes with ftpput, so you could ftpput the logfile to a FTP server of your choice.

Another possibility would be to use wget to post the data to a HTTP server.

… and in theory it should be possible to install an SMTP client on Vera.

… and Vera comes with an HTTP server, which could be used to make the logfile accessible from a HTTP client.

I wrote some Lua code that you can place into a scene to log the temperature, light, battery and location.
I POST the data over HTTP to a simple data logger written in PHP.
See this post:

[url=http://forum.micasaverde.com/index.php?topic=4590.msg25570#msg25570]http://forum.micasaverde.com/index.php?topic=4590.msg25570#msg25570[/url]

[quote=“Ap15e, post:2, topic:167073”]You have to use Lua/Lua Luup extensions:

local outf = io.open('/etc/cmh/temp.log', 'a')

outf:write(os.date('%Y-%m-%d %H:%M:%S '..os.time()..' ')..luup.variable_get("urn:upnp-org:serviceId:TemperatureSensor1","CurrentTemperature",16806)..'\n')

outf:close()

Replace 16806 with the id of your temperature sensor (from ‘Advanced’ tab, ‘id’ next to ‘device_file’).

Add the code to the ‘Luup’ tab of a scene.

To access the logfile, ssh to your Vera.[/quote]

Ive got all this working fine now, but when I SSH into get my logs, how can I add a carriage return after the temp is written? Everything flows in one line and I’d like to try and make it easier to import into a spreadsheet, etc for graphing

thanks for all the help here, its SOOOO nice to have temp logs of the wood stove, google outdoor weather, and all my basement and rooms with a 3-in-1 sensor. My next step is to try and grab the temps from all my Fortrezz H20/Temp sensors

outf:write(‘\n’)

Thank you so much! This is great, The logs are working great!

I think I have done this right (thanks btw!!). My next dumb question is how do I SSH into Vera? Is there a good resource someone can recommend on how to do it? I looked online but couldn’t find what I ‘think’ I was suppose to be looking for.

Also - to confirm, I change the number to 24 correct - since that is what is in the ‘id’ field (see screenshot).

Thanks! ;D

You can use WINSCP or PUTTY if you use windows. Connect to the IP of Vera using WinSCP and then use root as the username along with the Wifi Password on the bottom sticker. Then you can navigate the inner workings of Vera and grab the logs (It’s similar to an FTP application, remote and local windows, drag and drop, copy, etc.

I’m grabbing all my 3-in-1 temps now and also setup a scene to grab the google weather plugin temp each hour too, so I can see the affect on external temp and how that affects my crawlspace temps, etc.

I have a few Water/Temp sensors from FortrezZ, but when I modify the code it’s not working to pull these temps from these devices…any idea? I changed the ID and the type of sensor, still nothing

local outf = io.open('/etc/cmh/temp-aptbasement.log', 'a')

outf:write(os.date('%Y-%m-%d %H:%M:%S '..os.time()..' ')..luup.variable_get("urn:upnp-org:serviceId:TempLeakSensor1","CurrentTemperature",57))
outf:write('\n')
outf:close()

In looking at D_TempLeakSensor1.xml, there are three serviceIds:

  • urn:upnp-org:serviceId:TemperatureSensor1
  • urn:micasaverde-com:serviceId:SecuritySensor1
  • urn:micasaverde-com:serviceId:HaDevice1

Try the first one.

–Jim

Thank you Jim, I learn something new every day on how to make my Vera better.

Thanks again!

Thanks guys!!!
I have a passive solar home and it really help to check it’s performance by recording weather conditions and internal temp.
Now, any suggestions how to SSH from my Mac?