We have a Honeywell TE923W weather station, which I finally got set up with “wview”, and excellent (free) program for Linux and MacOS that supports a ton of weather stations. Our site is up here:
I’ve added a few internally visible CGI scripts that query the wview DB and report back useful into. One of them gives back the rounded value of the last reported outdoor temperature.
My SO is pretty passionate about feeding her hummingbirds, and we have Annas around here that overwinter. I bought some heat lamps last year to keep them from freezing, and set up scenes to run them periodically, and was manually enabling/disabling timers depending on weather–the lamps burn plenty of juice, and I don’t want them on when they don’t need to be.
So this morning, I woke up to slushing syrup in the feeders, and set out the lamps. They’re switched by some z-wave outdoor relays. For debugging purposes, I wanted to get Prowl notifications any time they actually run–which is now controlled based on last reported outside temp.
It worked out nicely–I just have the scene firing on a 30-minute interval, and if the Lua code that checks the temperature returns true, the lamps come on for 10 minutes and power down. I wanted to have the Prowl notices contain the actual temperature that tripped the “true” result. I hadn’t seen examples of doing that around here, but there were enough code fragments that I got something worked out. If this was hopelessly obvious to everyone else, I apologize…
local status, outTemp = luup.inet.wget("http://172.16.0.5/lasttemp.php",5)
if (status == 0) then
-- we got a successful "get" of the current (5-minute delay max) temp
-- convert what we got back to a number
local tempNum = tonumber(outTemp)
-- compare it to our desired threshold, if it's below, return true
if (tempNum >= 29) then
return false
else
-- for now, send RLM a Prowl alert that we ran the heat this time
local rlm_prowl_url = "https://prowl.weks.net/publicapi/add?apikey="
.. "........"
.. "&application=Vera&event=Hummer+heat+temp&description="
.. tempNum
.. "&priority=-1"
luup.inet.wget(rlm_prowl_url)
return true
end
else
-- our "get" failed. Assume it's not necessary to struggle onward
return false
end