We have moved at community.getvera.com

Author Topic: openLuup: Dark Sky (formerly Forecast.io) weather plugin  (Read 10461 times)

Offline logread

  • Full Member
  • ***
  • Posts: 214
  • Karma: +7/-1
openLuup: Dark Sky (formerly Forecast.io) weather plugin
« on: November 18, 2016, 07:51:22 am »
As an alternative to my "openWeather" plugin based on Weather Underground's free developer API (and after being recently faced with with an apparent lack of reliable connectivity with WU servers that derailed some of my home automation), I wrote a new plugin to fetch weather data from Dark Sky, also offering free weather data. Please see https://darksky.net/dev/

It is now published on the AltUI App Store as "DarkSky Weather" and can be installed following the attached instructions (also available from the plugin after it is installed).

The current version is 0.2 and is a beta version that may still contain bugs.
Version 0.3 beta is now available, featuring dynamic icon based on current weather and automatic location information upon install based on Vera/openLuup system setup.
I welcome any feedback.

Screen shots of the AlUI devices created by the plugin as well as of the plugin device variables available in the beta version are attached to this post as well.

It is designed to run on openLuup systems. It may work on a real Vera, but I did not test this (my only real Vera is a Veralite that I stripped off of all plugins to make it a zwave controller only, at last finally reliable... all my production and development systems are openLuup driven, with either Vera or Domoticz/openZwave controllers as "slaves" and that made my life so much easier while being cheaper...)
« Last Edit: November 19, 2016, 12:55:45 pm by logread »
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 akbooer

  • Moderator
  • Master Member
  • *****
  • Posts: 6387
  • Karma: +292/-70
  • "Less is more"
Re: openLuup: Dark Sky (formerly Forecast.io) weather plugin
« Reply #1 on: November 18, 2016, 08:05:26 am »
Sounds good!

I took a quick look at the documentation and have a couple of comments:
  • latitude and longitude are native luup variables (which can be set in the Lua Startup code.)  I see that you've chosen to require these to be configured separately in your plugin.  I suppose this gives flexibility to monitor weather in a different place.  I haven't looked at your source code and wondered if you preset those values from the existing luup variables?
  • you mention the variable names, but not the serviceId that the plugin uses.  Would be good to document that.
Anyway, hope this works well for you.  Thanks for using the AltAppStore.
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: openLuup: Dark Sky (formerly Forecast.io) weather plugin
« Reply #2 on: November 18, 2016, 08:13:26 am »
@akbooer, thanks for your prompt feedback !

latitude and longitude are native luup variables (which can be set in the Lua Startup code.)  I see that you've chosen to require these to be configured separately in your plugin.  I suppose this gives flexibility to monitor weather in a different place.  I haven't looked at your source code and wondered if you preset those values from the existing luup variables?
You are right, I wanted the flexibility to use different locations... but your point about having the default location taken from the controller attributes is well taken... for next release  8)

you mention the variable names, but not the serviceId that the plugin uses.  Would be good to document that.
good suggestion... hovering with the mouse over the variables in AltUI is the way to go for now...
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 NikV

  • Full Member
  • ***
  • Posts: 143
  • Karma: +2/-1
Re: openLuup: Dark Sky (formerly Forecast.io) weather plugin
« Reply #3 on: November 18, 2016, 06:56:38 pm »
thanks for this seems to be working well with one problem

Code: [Select]
2016-11-18 23:48:08.331   openLuup.server:: GET /cmh/skins/default/img/devices/device_states/darksky.png HTTP/1.1 tcp{client}: 0xcc2030
2016-11-18 23:48:08.477   openLuup.server:: request completed (214014 bytes, 14 chunks, 1898 ms) tcp{client}: 0xd3b018
2016-11-18 23:48:08.478   openLuup.server:: file not found:icons/darksky.png

cant seem to find the icon - I poresume a different one is downloaded depending on the weather

regards

Nik

Offline Mike Yeager

  • Hero Member
  • *****
  • Posts: 603
  • Karma: +11/-12
Re: openLuup: Dark Sky (formerly Forecast.io) weather plugin
« Reply #4 on: November 18, 2016, 07:49:52 pm »
Any chance of a native Vera plugin? I'd much rather use this than WU as it seems to be more reliable here. Also allows more "hits" a day. I am currently using an RPI to retrieve the information and pass it to Vera (along with a virtual rain sensor that's tied to ForecastIO) but I'd love to be able to bring it all local...

Offline logread

  • Full Member
  • ***
  • Posts: 214
  • Karma: +7/-1
Re: openLuup: Dark Sky (formerly Forecast.io) weather plugin
« Reply #5 on: November 19, 2016, 02:43:56 am »
thanks for this seems to be working well with one problem

Code: [Select]
2016-11-18 23:48:08.331   openLuup.server:: GET /cmh/skins/default/img/devices/device_states/darksky.png HTTP/1.1 tcp{client}: 0xcc2030
2016-11-18 23:48:08.477   openLuup.server:: request completed (214014 bytes, 14 chunks, 1898 ms) tcp{client}: 0xd3b018
2016-11-18 23:48:08.478   openLuup.server:: file not found:icons/darksky.png

cant seem to find the icon - I poresume a different one is downloaded depending on the weather

regards

Nik
I do not see this error in my own logs... Would appreciate if you please check that the darksky.png icon exists in the cmh-ludl/icons directory ? I suspect installation parameters for the App Store might not be all correct.
Thanks
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: openLuup: Dark Sky (formerly Forecast.io) weather plugin
« Reply #6 on: November 19, 2016, 02:59:11 am »
Any chance of a native Vera plugin? I'd much rather use this than WU as it seems to be more reliable here. Also allows more "hits" a day. I am currently using an RPI to retrieve the information and pass it to Vera (along with a virtual rain sensor that's tied to ForecastIO) but I'd love to be able to bring it all local...
Thanks for trying the app ! I am not planning a native Vera plugin due to a) the cumbersome need to deal with json and xml device and service files when developing for Vera UI, and b) I do not want to load any plugin on my only real Vera*, so would not be able to test such a plugin.

That being said, you can use the mirroring feature of the Vera Bridge plugin to "push" any of the DarkSky device variables to a dummy device on the Vera... See http://forum.micasaverde.com/index.php/topic,36971.msg281751.html#msg281751 and/or the openLuup documentation for details.

* as said before, I migrated all my scenes/plugins to openLuup and use my Veralite only as a radio controller... much more reliable... no reboots/reloads
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 NikV

  • Full Member
  • ***
  • Posts: 143
  • Karma: +2/-1
Re: openLuup: Dark Sky (formerly Forecast.io) weather plugin
« Reply #7 on: November 19, 2016, 03:49:55 am »
thanks for this seems to be working well with one problem

Code: [Select]
2016-11-18 23:48:08.331   openLuup.server:: GET /cmh/skins/default/img/devices/device_states/darksky.png HTTP/1.1 tcp{client}: 0xcc2030
2016-11-18 23:48:08.477   openLuup.server:: request completed (214014 bytes, 14 chunks, 1898 ms) tcp{client}: 0xd3b018
2016-11-18 23:48:08.478   openLuup.server:: file not found:icons/darksky.png

cant seem to find the icon - I poresume a different one is downloaded depending on the weather

regards

Nik
I do not see this error in my own logs... Would appreciate if you please check that the darksky.png icon exists in the cmh-ludl/icons directory ? I suspect installation parameters for the App Store might not be all correct.
Thanks

yes I checked there is no Darksky.png anwhere I can find on the RPI , having looked at the darksky api it looks like the call should return the icon depending upon the state of the weather but this is optional


Offline logread

  • Full Member
  • ***
  • Posts: 214
  • Karma: +7/-1
Re: openLuup: Dark Sky (formerly Forecast.io) weather plugin
« Reply #8 on: November 19, 2016, 04:24:57 am »
yes I checked there is no Darksky.png anwhere I can find on the RPI , having looked at the darksky api it looks like the call should return the icon depending upon the state of the weather but this is optional
Thanks for checking. BTW, the variable icon based on weather conditions is not yet implemented. But still, I found why even the default icon is not displayed... I had incorrectly assumed the Alt App Store would also copy subdirectories of the GitHub repository to the host system, while it seems it does not (I need to check this with @akbooer)... I made a quick fix to this that will be in the next version, but in the meantime the attached updated device file can be manually added in the openLuup working directory (e.g. cmh_ludl) to implement the fix (the device will load the icon over the internet)
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 NikV

  • Full Member
  • ***
  • Posts: 143
  • Karma: +2/-1
Re: openLuup: Dark Sky (formerly Forecast.io) weather plugin
« Reply #9 on: November 19, 2016, 04:42:39 am »
Thanks - I did not realise that it did not download the weather specific Icon (well I did this morning after I poked around in the code)

Offline Mike Yeager

  • Hero Member
  • *****
  • Posts: 603
  • Karma: +11/-12
Re: openLuup: Dark Sky (formerly Forecast.io) weather plugin
« Reply #10 on: November 19, 2016, 12:41:32 pm »
I can't even get the alt app store to appear. It shows on Vera, but when I click APP STORE under Alt-UI, I get a blank page. Alt-UI also want's to update itself, but it won't...

Offline logread

  • Full Member
  • ***
  • Posts: 214
  • Karma: +7/-1
Re: openLuup: Dark Sky (formerly Forecast.io) weather plugin
« Reply #11 on: November 19, 2016, 12:47:16 pm »
I can't even get the alt app store to appear. It shows on Vera, but when I click APP STORE under Alt-UI, I get a blank page. Alt-UI also want's to update itself, but it won't...
You may want to check about that on the AltUI sub forum at http://forum.micasaverde.com/index.php/board,78.0.html
... This is not related to the DarkSky plugin.
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: openLuup: Dark Sky (formerly Forecast.io) weather plugin
« Reply #12 on: November 19, 2016, 12:51:37 pm »
Version 0.3 is now available from the Alt App Store.
Changelog:
  • automatic location setup by default - thanks @akbooer
  • default icon fix - thanks @NikV
  • state icons to reflect current weather - icons from icon8.com
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: openLuup: Dark Sky (formerly Forecast.io) weather plugin
« Reply #13 on: November 19, 2016, 01:23:31 pm »
Ok, I did manage to get the App Store and everything loaded and got the plugin installed. Waiting to see how it works. It did populate back to Vera so that is a good thing. Any chance that it would be easy to either add a virtual rain sensor output to this or tag off of it to set and clear a virtual rain sensor? This looks like it may be what finally removes my Z-Way (Razberry) setup from the equation...

Offline NikV

  • Full Member
  • ***
  • Posts: 143
  • Karma: +2/-1
Re: openLuup: Dark Sky (formerly Forecast.io) weather plugin
« Reply #14 on: November 19, 2016, 06:00:37 pm »
Version 0.3 is now available from the Alt App Store.
Changelog:
  • automatic location setup by default - thanks @akbooer
  • default icon fix - thanks @NikV
  • state icons to reflect current weather - icons from icon8.com

right I updated to version 0.3 (thanks for your efforts here) I have had currentconditions as "Drizzle" and "Light rain" this evening and checking the variables it lists the Icon as "Rain" but the icon has gone back to the standard Z-wave icon

checking the log

Code: [Select]
2016-11-19 22:47:09.478   openLuup.server:: request completed (14344 bytes, 1 chunks, 12 ms) tcp{client}: 0x1e726b8
2016-11-19 22:47:09.484   openLuup.server:: GET /cmh/skins/default/img/devices/device_states/DarkSky-rain.png HTTP/1.1 tcp{client}: 0x207fc48
2016-11-19 22:47:09.485   openLuup.server:: file not found:icons/DarkSky-rain.png
2016-11-19 22:47:09.485   openLuup.server:: request completed (137 bytes, 0 chunks, 0 ms) tcp{client}: 0x207fc48
2016-11-19 22:47:09.519   openLuup.server:: GET /data_request?id=lu_status2&output_format=json&DataVersion=595530974&Timeout=60&MinimumDelay=1500&_=1479595618093 HTTP/1.1 tcp{client}: 0x1e726b8

so we are back to where we were this morning :) :)

In my OpenLuup I dont have any directories under cmh and I dont have a skins directory under cmh-ludl either ????