Just trying to make sure I’m on the right track here. We have a TE923W weather station, and in addition to the base inside temp/hum and one outside temp/hum, we’ve got a couple extra sensors–one out in the garage, and one on the back deck. After spending a chunk of a day wrestling with WeatherDisplay Console, I have it running in the background, and have a companion Perl script running and publishing the results (I care about) from parsing the raw WD data as a web page: www.nguzu.com/hillweather.html. I can put these in any format I want, but the goal was to get something simple running…something less spiffy than the flash-based GUI that WD generates if you shell out the $$$ for it.
The machine serving this is in the same house as my Vera–they’re on different sides of a firewall maintaining a DMZ, but Vera requests would be going the right direction. I’m guessing I could create some manner of I_TemperatureSensor1.xml to implement the method to set the CurrentTemperature variable for each of four "sensors:, correct?
I’m sure I can look at the weather plugin for how to go about parsing the results of requesting the above page…hell, I can have separate pages for each temp, if that works. But am just curious how loading multiple instances of such an “I” file really works. Hints, pointers appreciated.
–Richard
Richard,
You end up working with the [tt]D_TemperatureSensor1.xml[/tt], not the [tt]I_xxx.xml[/tt] file. For each type of temperature thing you want to measure/expose to Vera, you create one of these as a “Child” device of the Parent Device (your Plugin)
The Weather Plugin does this already, in order to represent High/Low/Current temp, and would be easily hackable into what you want to do.
For the bit that’s creating the child devices, see this bit of code:
http://code.mios.com/trac/mios_weather/browser/I_GoogleWeather.xml#L235
Then, for the content-extraction, you can probably use the standard string-parsing/pattern matching stuff that Lua has. See [tt]string.match[/tt] if you’re parsing raw HTML output, since you can probably use it to extract all the relevant values from a single-string “HTML” output if there are enough unique items that can be defined in the content and defined as “captures” for [tt]string.match[/tt]
So my goal (such as it is) would be to be able to impersonate “normal” temperature sensors, so I could display them easily using SQ Connect. Is this still my line of attack? Write the plug-in, create the child devices, and then associate them to SQ Connect temp-status “controls” using the child device as the associated MIOS device?
–Richard
[quote=“guessed, post:2, topic:167255”]Richard,
You end up working with the [tt]D_TemperatureSensor1.xml[/tt], not the [tt]I_xxx.xml[/tt] file. For each type of temperature thing you want to measure/expose to Vera, you create one of these as a “Child” device of the Parent Device (your Plugin)
The Weather Plugin does this already, in order to represent High/Low/Current temp, and would be easily hackable into what you want to do.
For the bit that’s creating the child devices, see this bit of code:
http://code.mios.com/trac/mios_weather/browser/I_GoogleWeather.xml#L235
Then, for the content-extraction, you can probably use the standard string-parsing/pattern matching stuff that Lua has. See [tt]string.match[/tt] if you’re parsing raw HTML output, since you can probably use it to extract all the relevant values from a single-string “HTML” output if there are enough unique items that can be defined in the content and defined as “captures” for [tt]string.match[/tt][/quote]
Yup. The ones that are created by the Weather Plugin, for example, can be natively displayed on SQRemote. I do this using their Temperature Status control, and display temps from 2x Trane’s, 1x HSM 100 (garage temp) and 1x Weather Plugin (external temp)
It [roughly] looks like:
[Upstairs Thermo... 68 F]
[Downstairs Ther... 68 F]
[Garage Tempera... 65 F]
[Temperature 51 F]
btw, using Lua, extracting the data from your [HTML] webpage will look something like:
local out = lu_wget("http://www.nguzu.com/hillweather.html")
print(out)
local indoorTemp, frontTemp, backTemp, garageTemp
= string.match(out, ".*Indoors:% +(%-?%d+%.%d+).*Out front:% +(%-?%d+%.%d+).*Out back:% +(%-?%d+%.%d+).*Garage:% +(%-?%d+%.%d+).*")
based upon the format you had a few minutes ago…
Thanks. I am late for some work key results, but couldn’t finish them until I can talk to one of my colleagues who had the last three weeks off. So it looks like my 2010 had 53 weeks…so it may be a few days before I get time to come back for air and play with this.
One thing I have already done is teach the Perl script that’s publishing the data to send me Prowl alerts if the garage temp falls below 40F. We had a scary incident last winter during a (rare, for Willamette Valley) cold snap that took us down into the teens for a few days. I had brought the dog in from his before-bed bio-break, and didn’t notice that the garage door reversed near the bottom of its travel instead of closing and staying that way. It was our first winter in this house, and the adjustments on the doors needed tweaked–and unknown to us, this one was twitchy when it got cold. Anyway, the damned thing stayed open all night, freezing up some hard-to-replace plants that we were wintering in there, and the garage plumbing. Thankfully, nothing split, but it took me a good day and a half to get things thawed back out.
This year, we came back from vacation to a dead heat pump, and because it was mis-installed, didn’t revert to emergency heat. 52 degree house. So we’re trying to get on top of being able to track such things, and through redundant means when possible.
–Richard
[quote=“guessed, post:5, topic:167255”]btw, using Lua, extracting the data from your [HTML] webpage will look something like:
local out = lu_wget("http://www.nguzu.com/hillweather.html")
print(out)
local indoorTemp, frontTemp, backTemp, garageTemp
= string.match(out, ".*Indoors:% +(%-?%d+%.%d+).*Out front:% +(%-?%d+%.%d+).*Out back:% +(%-?%d+%.%d+).*Garage:% +(%-?%d+%.%d+).*")
based upon the format you had a few minutes ago…[/quote]
No problem, noe that the above snippet is from some free-standing Lua test code that I wrote so Lu_wget would be replaced by the luup.inet equivalent.