We have moved at community.getvera.com

Author Topic: openWeather plugin for openLuup  (Read 9708 times)

Offline akbooer

  • Moderator
  • Master Member
  • *****
  • Posts: 6387
  • Karma: +292/-70
  • "Less is more"
Re: openWeather plugin for openLuup
« Reply #15 on: July 24, 2016, 07:52:30 am »
...although if you're really an XML devotee, then you could (equally) use openLuup's XML parser to do the same thing...

Code: [Select]
local xml = require "xml"
local key  = "XXXXXXXXXX"
local req_fmt = "https://api.wunderground.com/api/%s/conditions/forecast/q/%0.6f,%0.6f.xml"

local url = req_fmt: format (key, luup.latitude, luup.longitude)
local status, result = luup.inet.wget (url,5)
local info = xml.decode (result)

print (pretty(info))
3x Vera Lite-UI5/Edge-UI7, 25x Fibaro, 23x TKB, 9x MiniMote, 2x NorthQ Power, 2x Netatmo, 1x Foscam FI9831P, 9x Philips Hue,
Razberry, MySensors Arduino, HomeWave, AltUI, AltHue, DataYours, Grafana, openLuup, ZWay, ZeroBrane Studio.

Offline a-lurker

  • Hero Member
  • *****
  • Posts: 872
  • Karma: +66/-8
Re: openWeather plugin for openLuup
« Reply #16 on: July 24, 2016, 06:24:57 pm »
Mmmm - certainly helps when a json and a xml decoder are "just" available. It took MCV sometime to distribute a JSON decoder with their firmware and I believe it still doesn't have a XML decoder as such? Presumably both these libraries are part of the Open Luup install?

Offline akbooer

  • Moderator
  • Master Member
  • *****
  • Posts: 6387
  • Karma: +292/-70
  • "Less is more"
Re: openWeather plugin for openLuup
« Reply #17 on: July 24, 2016, 06:46:05 pm »
Presumably both these libraries are part of the Open Luup install?

Absolutely!  Both XML and JSON required to read the UPnP files and respond to HTTP requests.  The JSON one is extremely well tested (about 200 test cases, both valid and illegal syntax, all available from the openLuup GitHub repository). The XML one is good enough for the job, but not so comprehensively tested.  Both are DOM-type, as you can see from the examples.
3x Vera Lite-UI5/Edge-UI7, 25x Fibaro, 23x TKB, 9x MiniMote, 2x NorthQ Power, 2x Netatmo, 1x Foscam FI9831P, 9x Philips Hue,
Razberry, MySensors Arduino, HomeWave, AltUI, AltHue, DataYours, Grafana, openLuup, ZWay, ZeroBrane Studio.

Offline logread

  • Full Member
  • ***
  • Posts: 214
  • Karma: +7/-1
Re: openWeather plugin for openLuup
« Reply #18 on: August 24, 2016, 07:12:25 am »
Version 1.1 is available on the AltAppStore in AltUI and has been committed to GitHub https://github.com/999LV/openWeather-plugin-for-openLuup.
Major rewrite of code (taking into account some comments from this thread), paving the way for additional features soon...
Vera Lite UI7, Fibaro FGS-221, FGS-212, FGSS-001, FGK-101, FGWPE/F-101, FGMS-001, Aeon HEM G2, GreenWave PowerNode 6,  Everspring ST-814, SE-812, Swiid SwiidInter.
Raspberry Pi2 Raspbian w/ openLuup. AltUI, SV Thermostat, Virtual Switch, Weather (openWeather), System Monitor (openSysMon), HomeWave.

Offline Mike Yeager

  • Hero Member
  • *****
  • Posts: 603
  • Karma: +11/-12
Re: openWeather plugin for openLuup
« Reply #19 on: August 25, 2016, 09:56:07 am »
Any chance you'd be interested in doing one for ForecastIO?

Offline logread

  • Full Member
  • ***
  • Posts: 214
  • Karma: +7/-1
Re: openWeather plugin for openLuup
« Reply #20 on: August 26, 2016, 02:17:30 am »
I am afraid I am not planning to implement ForecastIO for now... I am rather soon to implement additional features offered by Weather Underground but not yet exploited by this plug-in.
Anything in particular you have in mind that is currently missed ?
Vera Lite UI7, Fibaro FGS-221, FGS-212, FGSS-001, FGK-101, FGWPE/F-101, FGMS-001, Aeon HEM G2, GreenWave PowerNode 6,  Everspring ST-814, SE-812, Swiid SwiidInter.
Raspberry Pi2 Raspbian w/ openLuup. AltUI, SV Thermostat, Virtual Switch, Weather (openWeather), System Monitor (openSysMon), HomeWave.

Offline Mike Yeager

  • Hero Member
  • *****
  • Posts: 603
  • Karma: +11/-12
Re: openWeather plugin for openLuup
« Reply #21 on: August 26, 2016, 11:06:58 am »
I haven't looked at this plugin. I prefer the other due to being able to poll it more often...

Offline korttoma

  • Hero Member
  • *****
  • Posts: 729
  • Karma: +26/-5
Re: openWeather plugin for openLuup
« Reply #22 on: September 22, 2016, 02:55:25 am »
Hi @logread,

Would it be possible for your plugin to use of the "lang" parameter for the wunderground API call to get weather forecast in other language than English (Swedish for example)?
- Tomas

Offline logread

  • Full Member
  • ***
  • Posts: 214
  • Karma: +7/-1
Re: openWeather plugin for openLuup
« Reply #23 on: September 22, 2016, 03:03:17 am »
Would it be possible for your plugin to use of the "lang" parameter for the wunderground API call to get weather forecast in other language than English (Swedish for example)?
Good suggestion... Should be very easy to implement via a user configured variable. I'll look into this when I get a chance.
Vera Lite UI7, Fibaro FGS-221, FGS-212, FGSS-001, FGK-101, FGWPE/F-101, FGMS-001, Aeon HEM G2, GreenWave PowerNode 6,  Everspring ST-814, SE-812, Swiid SwiidInter.
Raspberry Pi2 Raspbian w/ openLuup. AltUI, SV Thermostat, Virtual Switch, Weather (openWeather), System Monitor (openSysMon), HomeWave.

Offline logread

  • Full Member
  • ***
  • Posts: 214
  • Karma: +7/-1
Re: openWeather plugin for openLuup
« Reply #24 on: September 22, 2016, 11:24:00 am »
Version 1.2 is now available on the AltAppStore:
  • added support for Metric vs. US/Imperial units and language parameter to fetch the WU data in another language than English (@korttoma suggestion):
    please edit the "Metric" device variable to the value of 1 (metric units, default) or 0 (if you want to use US/Imperial units) and the "Language" device variable to the two letters shortcut used by Weather Underground API (e.g. EN is English and default, FR is French, SW is Swedish, etc... as per https://www.wunderground.com/weather/api/d/docs?d=language-support)

  • added today and tomorrow forecast data (high/low temps, conditions and text forecast) that show up as new devices variables:
    - TodayHighTemp, TodayLowTemp, TodayConditions, TodayForecast and
    - TomorrowHighTemp, TomorrowLowTemp, TomorrowConditions, TomorrowForecast
Vera Lite UI7, Fibaro FGS-221, FGS-212, FGSS-001, FGK-101, FGWPE/F-101, FGMS-001, Aeon HEM G2, GreenWave PowerNode 6,  Everspring ST-814, SE-812, Swiid SwiidInter.
Raspberry Pi2 Raspbian w/ openLuup. AltUI, SV Thermostat, Virtual Switch, Weather (openWeather), System Monitor (openSysMon), HomeWave.

Offline korttoma

  • Hero Member
  • *****
  • Posts: 729
  • Karma: +26/-5
Re: openWeather plugin for openLuup
« Reply #25 on: September 23, 2016, 04:24:44 am »
Wow! Thanks @logread!

Now I will actually have to try your plugin :D
- Tomas

Offline korttoma

  • Hero Member
  • *****
  • Posts: 729
  • Karma: +26/-5
Re: openWeather plugin for openLuup
« Reply #26 on: September 26, 2016, 01:19:33 am »
Hi @logread,

I installed AltUI and the AltAppStore and then the 1.1 version of your openWeather (1.2 does not seem to be selectable to download in the AltAppStore).
Anyhow the 2 variables "Language" and "Metric" seems to be available and I do get forecast in Swedish so maybe I do have the correct version.

Thanks for making this even if it feels a bit excessive to install AltUI and AltAppStore just to get to your plugin.

Edit: I managed to install your openWeather plugin on my other Vera device manually without AltUI and AltAppStore. Seems to be working just fine :D
« Last Edit: September 26, 2016, 01:46:14 am by korttoma »
- Tomas

Offline logread

  • Full Member
  • ***
  • Posts: 214
  • Karma: +7/-1
Re: openWeather plugin for openLuup
« Reply #27 on: September 26, 2016, 01:47:15 am »
@korttoma,

Thanks for the feeback... need to check the version mismatch.

BUT... you may not have noticed that this plugin discussion is in a subsection of the forum dedicated to openLuup... there is a weather plugin available as a regular Vera app and running under the regular UI (and AltUI). however that plugin cannot not run under openLuup as its developper chose to encrypt it.. this is why I wrote an opensource solution that can run

Hope this clarifies
Vera Lite UI7, Fibaro FGS-221, FGS-212, FGSS-001, FGK-101, FGWPE/F-101, FGMS-001, Aeon HEM G2, GreenWave PowerNode 6,  Everspring ST-814, SE-812, Swiid SwiidInter.
Raspberry Pi2 Raspbian w/ openLuup. AltUI, SV Thermostat, Virtual Switch, Weather (openWeather), System Monitor (openSysMon), HomeWave.

Offline korttoma

  • Hero Member
  • *****
  • Posts: 729
  • Karma: +26/-5
Re: openWeather plugin for openLuup
« Reply #28 on: September 26, 2016, 02:06:18 am »
Yes, I know you made this plugin solely for openLuup and I respect that.
I also know about the regular weather plugin available for Vera in that app store but that plugin does not support the language parameter in the API cal. I did ask about supporting the language parameter but I don't think anyone is developing the plugin anymore.

Thanks again for providing the plugin and the addition I suggested ;)
- Tomas

Offline akbooer

  • Moderator
  • Master Member
  • *****
  • Posts: 6387
  • Karma: +292/-70
  • "Less is more"
Re: openWeather plugin for openLuup
« Reply #29 on: November 03, 2016, 08:23:40 am »
1.2 does not seem to be selectable to download in the AltAppStore).
Anyhow the 2 variables "Language" and "Metric" seems to be available and I do get forecast in Swedish so maybe I do have the correct version.

I noticed this problem too, and have just fixed it, so that 1.2 is now selectable.

The problem was that releases 1.0 and 1.1 were referencing the master repository, and 1.2 was not defined at all as a release.  As a result, selecting anything would download the latest version.  They now point towards their correct tagged releases.
3x Vera Lite-UI5/Edge-UI7, 25x Fibaro, 23x TKB, 9x MiniMote, 2x NorthQ Power, 2x Netatmo, 1x Foscam FI9831P, 9x Philips Hue,
Razberry, MySensors Arduino, HomeWave, AltUI, AltHue, DataYours, Grafana, openLuup, ZWay, ZeroBrane Studio.