We have moved at community.getvera.com

Author Topic: Weather Plugin  (Read 225230 times)

Offline Chimpware

  • Sr. Member
  • ****
  • Posts: 426
  • Karma: +0/-0
Re: Plugin for Web: weather.com et al
« Reply #45 on: September 05, 2009, 01:46:32 pm »
You need to add it as a Zwave device at the bottom of the page there is a spot that looks like this:

(http://img.skitch.com/20090905-ppphayte8p6wk6my3j4nhph4rk.jpg)

Type "D_Weather.xml" there and it should work.

Offline husky

  • Newbie
  • *
  • Posts: 12
  • Karma: +0/-0
Re: Plugin for Web: weather.com et al
« Reply #46 on: September 05, 2009, 02:09:27 pm »
I did, after that it shows in the Luup plugins section but no output like the weather. It looks like a dead node.

Don't I have to rename the .XML file?

Offline guessed

  • Community Beta
  • Master Member
  • ******
  • Posts: 5301
  • Karma: +92/-22
  • Release compat is not a bolted-on afterthought
Re: Plugin for Web: weather.com et al
« Reply #47 on: September 05, 2009, 03:09:13 pm »
There are a few steps, including:

  • Expanding the source files from the ZIP to get
        D_Weather.xml
        S_Weather.xml
        I_GoogleWeather.xml

    These filenames should be exactly as above, with no other "characters" present in them.
  • Uploading these under the Luup Plugins area under Vera's Device menu/tab
  • Configuring your Location under Vera's Location menu/tab
  • Creating the Weather Device, like Chimpware's description
  • Adding a nice "label" to the Device (not sure why they don't default this)

At that point the device should startup cleanly and present the 4 values (Current Temp, High Temp, Low Temp and Humidity) based upon your Location data.

If your Location is not specified, then the device will not start.  The newer Luup builds visually indicate this with a Red Cog at the top and some text.

Offline husky

  • Newbie
  • *
  • Posts: 12
  • Karma: +0/-0
Re: Plugin for Web: weather.com et al
« Reply #48 on: September 05, 2009, 03:24:09 pm »
It's running, first time I added the files with IE, second time with FireFox.
IE is messing with the file name, FF doesn't.

Can you tell me how to set the temp on Celcius?

I changed the I_GoogleWeather file the following:

local currentTemp = extractElement(rss, "temp_f")["attrs"]["data"]

into:

local currentTemp = extractElement(rss, "temp_c")["attrs"]["data"]

Now only the current temp is in Celcius and the High and Low are in F.

Offline guessed

  • Community Beta
  • Master Member
  • ******
  • Posts: 5301
  • Karma: +92/-22
  • Release compat is not a bolted-on afterthought
Re: Plugin for Web: weather.com et al
« Reply #49 on: September 05, 2009, 04:38:41 pm »
I've added a general Wiki page for the component here to start formalizing things a little:

    http://wiki.micasaverde.com/index.php/Weather_Plugin

@husky, if you change the feel URL to "google.co.uk" instead of "google.com", then I believe the values will change over.  I haven't tried it, but that's what all the online references indicate.

This currently requires hand-editing (as you've experienced) of the I_GoogleWeather.xml file.

I have it on the books to build that in, once the respective "luup" API's are available to tell me whether the Location data is in Imperial or Metric.

Offline husky

  • Newbie
  • *
  • Posts: 12
  • Karma: +0/-0
Re: Plugin for Web: weather.com et al
« Reply #50 on: September 05, 2009, 04:58:02 pm »
google.co.uk doesn't do the job, the xml input is metric but the output is Imperial.

Offline guessed

  • Community Beta
  • Master Member
  • ******
  • Posts: 5301
  • Karma: +92/-22
  • Release compat is not a bolted-on afterthought
Re: Plugin for Web: weather.com et al
« Reply #51 on: September 05, 2009, 05:37:27 pm »
I wasn't planning on working out the Metric stuff until the associated luup.xxx variable was available to automate it (@MCV: hint, hint)

In the meantime you have a few options in the code, but I haven't tried these.

  • use tonumber(...) to get the values back from String form to Number form
  • Use the "*", "/" and "-" operators to "scale down" the values to Metric
  • Apply math.floor(...) to turn it back into a whole number (not sure that decimal temps are supported)

Once the Luup variable is available, I'll make the relevant mods per the above if I can't get the feed itself to give me the "futures" data in metric.  Until then you can likely apply these changes manually.

Note that some of the Devices you "attach" to might require the data in Imperial.  I  recall a few discussions where [certain] components would not behave correctly according to the ZWave spec... if not told data in degF, but cant remember the details.

Offline 325xi

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1101
  • Karma: +0/-0
  • V1, V2, still V2...
Re: Plugin for Web: weather.com et al
« Reply #52 on: September 05, 2009, 08:57:35 pm »
Being myself interested in Metric output, I would suggest to make it a parameter of Weather device  - if set, it would override the system setting (the luup.xxx value). This way users would be able to get Celsius values without waiting for implementing luup.xxx thing, and set it to Imperial for devices that require it. 

Offline LibraSun

  • Hero Member
  • *****
  • Posts: 574
  • Karma: +2/-0
Re: Plugin for Web: weather.com et al
« Reply #53 on: September 05, 2009, 10:08:43 pm »
I want to thank Guessed for such a great effort with the wiki pages, notably these:

http://wiki.micasaverde.com/index.php?title=Special:RecentChanges&from=20090904020737&days=1&hideminor=0
Vera Model I running UI4 (Firmware 1.1.1338), died in 2015
Vera Plus running UI7 (Firmware 1.7.2935)

Offline Ap15e

  • Beta Testers
  • Hero Member
  • *****
  • Posts: 1998
  • Karma: +12/-0
Re: Plugin for Web: weather.com et al
« Reply #54 on: September 06, 2009, 06:58:15 am »
---------------------------------------------------------------------------------------------------------
        local status, rss = luup.inet.wget(url)
        local currentTemp = extractElement(rss, "temp_f")["attrs"]["data"]
        local forecastLowTemp = extractElement(rss, "low")["attrs"]["data"]
        local forecastHighTemp = extractElement(rss, "high")["attrs"]["data"]
        local currentHumidity = extractElement(rss, "humidity")["attrs"]["data"]

currentTemp=math.floor((currentTemp-32)*5/9+0.5)
forecastLowTemp=math.floor((forecastLowTemp-32)*5/9+0.5)
forecastHighTemp=math.floor((forecastHighTemp-32)*5/9+0.5)
---------------------------------------------------------------------------------------------------------

The last three lines should do the trick.

Offline 325xi

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1101
  • Karma: +0/-0
  • V1, V2, still V2...
Re: Plugin for Web: weather.com et al
« Reply #55 on: September 06, 2009, 09:32:07 am »
Right, but unless guessed adds it as configurable option our changes will be lost when he updates his plugin... you know how it works...

Should we put this stuff into Google Code?..

Offline guessed

  • Community Beta
  • Master Member
  • ******
  • Posts: 5301
  • Karma: +92/-22
  • Release compat is not a bolted-on afterthought
Re: Plugin for Web: weather.com et al
« Reply #56 on: September 06, 2009, 11:00:27 am »
I've uploaded a new version to Box.net at the same address:

    http://www.box.net/shared/b7z6s9j9md

which has this code, and a "local" variable called metric (default "false").  This is a placeholder for us once MCV implements the UI/Rendition(s) for Luup Service declaration(s) in the Device/Luup configuration UI's.

The service declaration (S_Weather.xml) now also has a Metric Service variable, type boolean. 

I'm avoiding putting in the parameter hacks that result in configurable parameters in order to encourage MCV's team to complete this work... then we all get it, along with a nicer UI for config.

Once that's available, I'll make the mods to wire it up to the override services for Location and Metric (as spec'd in S_Weather.xml) to give people the ability to override stuff.


In the interim, you only have to edit the source, change "false" to "true" and re-upload.

NOTE: Vera's UI will display "F" at the end of the values, even if Metric, until you change the settings under Location to indicate Metric units, so the two are kinda lock-stepped anyhow, as there's no other [standard, non-hack] way for me to present "up" that the data is in Celcius

Offline mversluis

  • Jr. Member
  • **
  • Posts: 51
  • Karma: +0/-0
Re: Plugin for Web: weather.com et al
« Reply #57 on: September 06, 2009, 05:54:14 pm »
Hi All,

I did have the same problem with IE , after installing firefox and start uploading again everything will work.

Only the wron files with the variable paramaters ( IE created then ) are still located in my overvieuw.

Is there some way to deleted those files ..?


Thanks
Best regards,
Marco
An optimist is a person who sees only the lights in the picture,
 Whereas a pessimist sees only the shadows.  An idealist, however is one who sees the light and the shadows, but in addition sees something else:  the possibility of changing the picture, of making the light prevail over shadows.

Offline mversluis

  • Jr. Member
  • **
  • Posts: 51
  • Karma: +0/-0
Re: Plugin for Web: weather.com et al
« Reply #58 on: September 12, 2009, 04:34:53 pm »
Hi all.

Just curios.

I have try to get the humidity working but it wont work.

Pls advise me
See screen dump

The temperature is working
Also the low and high
Humidity is not showing any data , but the data is provide in the current level tab.
So it looks like the variable for the current tab is not copying it to the device.

Would be grateful if any one would help

Second question would it be possible to intergrate the windspeed / winddirection into this plugin ..?

Thanks
Best regards.
Marco
An optimist is a person who sees only the lights in the picture,
 Whereas a pessimist sees only the shadows.  An idealist, however is one who sees the light and the shadows, but in addition sees something else:  the possibility of changing the picture, of making the light prevail over shadows.

Offline guessed

  • Community Beta
  • Master Member
  • ******
  • Posts: 5301
  • Karma: +92/-22
  • Release compat is not a bolted-on afterthought
Re: Plugin for Web: weather.com et al
« Reply #59 on: September 12, 2009, 05:23:39 pm »
For Humidity, Vera doesn't provide a UI/Rendition of the Humidity Sensor Device (urn:schemas-micasaverde-com:device:HumiditySensor:1) so it has the value, but no special UI for it.  For Temperature, Vera has a UI, which is why it's rendering correctly.