We have moved at community.getvera.com

Author Topic: [_CODE_] GWC - Google Weather Companion V0.3  (Read 22272 times)

Offline Ap15e

  • Beta Testers
  • Hero Member
  • *****
  • Posts: 1998
  • Karma: +12/-0
[_CODE_] GWC - Google Weather Companion V0.3
« on: May 13, 2011, 09:38:40 am »
EOL, unsupported.

Installation:

  • Install http://code.mios.com/trac/mios_weather,
  • upload the GWC files to your Vera,
  • create the GWC device using D_GWC.xml,
  • restart the Lua engine at least two times,
  • store the device IDs of the Google Weather plugin components in the corresponding GWC variables,
  • for metric wind speed set the GWC variable WindSpeedMetric to 1,
  • restart the Lua engine.

Download:


History:
V0.1 inital release
V0.2 adds wind direction and wind speed
V0.3 fixes S_GWC.xml; adds support for new UPnP variables 'WindDirection' and 'WindSpeed'

Security considerations:

GWC dynamically loads data from the internet (icons for weather condidition and wind direction). Obviously, this poses a security risk. To be on the safe side, I recommend downloading the icons (use the attached file icons.html and wget), checking the icons for viruses (if you're really paranoid: cloning the icons via screenshots or by taking pictures with your camera ...) and uploading the icons to your Vera into /www/cmh/skins/default/icons/ (use scp, uploading via 'MiOS developers' won't work due to automatic compression) and modifying GWC accordingly:

Replace

Code: [Select]
local ICON_PREFIX      = 'http://www.google.ru/ig/images/weather/'
[...]
local ICON_DIR_PREFIX  = 'http://saratoga-weather.org/images/'

with

Code: [Select]
local ICON_PREFIX      = 'http://<Vera's IP address>/cmh/skins/default/icons/'
[...]
local ICON_DIR_PREFIX  = 'http://<Vera's IP address>/cmh/skins/default/icons/'

By setting the PREFIXes to a non-existent path you'll get a text-only version.
« Last Edit: May 08, 2012, 12:55:21 pm by Ap15e »

Offline cedriclocqueneux

  • Jr. Member
  • **
  • Posts: 79
  • Karma: +0/-0
Re: [_CODE_] GWC - Google Weather Companion
« Reply #1 on: May 13, 2011, 10:12:41 am »
Great ! I wait the code :p

Offline guessed

  • Community Beta
  • Master Member
  • ******
  • Posts: 5301
  • Karma: +92/-22
  • Release compat is not a bolted-on afterthought
Re: [_CODE_] GWC - Google Weather Companion
« Reply #2 on: May 13, 2011, 10:13:24 am »
@Ap15e,
I have avoided doing that, and anything like it, as the technique relies upon using a nasty Security hole in Vera's UI.

They'll fix that, and all code using it will break.... IMHO it's a great party trick, but poor coding practice to use that Security hole.

Offline Ap15e

  • Beta Testers
  • Hero Member
  • *****
  • Posts: 1998
  • Karma: +12/-0
Re: [_CODE_] GWC - Google Weather Companion
« Reply #3 on: May 13, 2011, 04:55:37 pm »
@guessed

Quote
They'll fix that

I doubt it. And if they will ever fix it, I'm pretty sure they will provide methods that professional programmers can use as a replacement.

How long are we waiting for a fix for http://bugs.micasaverde.com/view.php?id=1038 (and for many other bugs and missing features)?
« Last Edit: May 14, 2011, 07:28:04 am by Ap15e »

Offline Ap15e

  • Beta Testers
  • Hero Member
  • *****
  • Posts: 1998
  • Karma: +12/-0
Re: [_CODE_] GWC - Google Weather Companion
« Reply #4 on: May 14, 2011, 07:26:49 am »
GWC V0.1 is available. V0.2 will add support for WindCondition.

Offline Henk

  • Hero Member
  • *****
  • Posts: 820
  • Karma: +3/-0
Re: [_CODE_] GWC - Google Weather Companion
« Reply #5 on: May 14, 2011, 09:23:06 am »
Why would GWC be better than the weather plugin currently available?
What are to pro and cons?

| Vera2 @ UI4 1.1.1350 / 3.20 | Vera Lite @ UI5 | Vera 3 @ UI5 | 2x Merten  504519 | 1x Duewi  064374 | 1x Everspring SM103 doorbell mod |1 Y-cam IP cam | various LUUP plugins |

Offline oTi@

  • Community Beta
  • Master Member
  • ******
  • Posts: 4041
  • Karma: +32/-6
  • UI what ?!
Re: [_CODE_] GWC - Google Weather Companion
« Reply #6 on: May 14, 2011, 10:23:50 am »
Why would GWC be better than the weather plugin currently available?
It's a companion. You need both (see instructions). It takes the info from the weather plug-in and puts it all in a single device, including translating the weather condition to an icon.
Dezwaved at the moment...

Offline Henk

  • Hero Member
  • *****
  • Posts: 820
  • Karma: +3/-0
Re: [_CODE_] GWC - Google Weather Companion
« Reply #7 on: May 14, 2011, 10:26:49 am »
Why would GWC be better than the weather plugin currently available?
It's a companion. You need both (see instructions). It takes the info from the weather plug-in and puts it all in a single device, including translating the weather condition to an icon.

Ok. i didnt know that. i was using the weather plugin and it created 4 sensors that work just fine, even from my ivera remote (iphone). This is more of a wrapper then, used to display the data in a more friendlt way?

The only thing now unreckognized in ivere was the "device" itself.

And what is the security issue @guessed brought up then?

--------edit---------------
Being the curious feller i am, i installedGWC  0.1. Looks nice, but add no functionality at all.
I have all the information of the Weather plugin (TWP) in 1 device yes, but that device isnt supported by my ivera control either, and the sensors ARE, so just some more code cluttering my lua engine is my humble opinion so far.

I guess its ok for ppl who have different setups, but for me it adds little to the TWP itself.

I think if Ap15e would be able to actually redo the TWP code to add this info on the device itself and keep the sensors instead of adding an extra device it would be cleaner

Henk
« Last Edit: May 14, 2011, 10:50:28 am by Henk »
| Vera2 @ UI4 1.1.1350 / 3.20 | Vera Lite @ UI5 | Vera 3 @ UI5 | 2x Merten  504519 | 1x Duewi  064374 | 1x Everspring SM103 doorbell mod |1 Y-cam IP cam | various LUUP plugins |

Offline oTi@

  • Community Beta
  • Master Member
  • ******
  • Posts: 4041
  • Karma: +32/-6
  • UI what ?!
Re: [_CODE_] GWC - Google Weather Companion
« Reply #8 on: May 14, 2011, 10:50:02 am »
Ok. i didnt know that. i was using the weather plugin and it created 4 sensors that work just fine, even from my ivera remote (iphone). This is more of a wrapper then, used to display the data in a more friendlt way?
Yep, something like that. At a minimum, I find, each new episode of ACE (Ap15e's Cool Extensions :) ) has educational value in terms of what is possible with Luup.

Quote
The only thing now unreckognized in ivere was the "device" itself.
Right. The app, such as iVera, would need to implement support for a specialized device (which I know you requested for the weather plugin).

Quote
And what is the security issue @guessed brought up then?
I'm thinking along the lines of what @Ap15e did (purposely of course) with WAI as well: HTML injection. In WAI it was text. In GWC it's also an image. Who knows what's next...
Dezwaved at the moment...

Offline Henk

  • Hero Member
  • *****
  • Posts: 820
  • Karma: +3/-0
Re: [_CODE_] GWC - Google Weather Companion
« Reply #9 on: May 14, 2011, 10:55:38 am »
@oTi@

Yes i agree that AP15e is showing the powerfull possibilities of HTML injection in LUUP (strange, actually, regarding his filosophy of regarding HTML in EMAIL as "unsafe") but in my opinion, (see my last edit) it would be more gracefull if WAI itself would be updated the in stead of creating a seperate companion.

As for my request with iVera, you are very well informed, and that request actually stated the support of LUUP devices in general.
If Jerome pulls this off, theres no limits to what can be achieved in LUUP coded devices, showing info on remotes etc.

Henk
| Vera2 @ UI4 1.1.1350 / 3.20 | Vera Lite @ UI5 | Vera 3 @ UI5 | 2x Merten  504519 | 1x Duewi  064374 | 1x Everspring SM103 doorbell mod |1 Y-cam IP cam | various LUUP plugins |

Offline Ap15e

  • Beta Testers
  • Hero Member
  • *****
  • Posts: 1998
  • Karma: +12/-0
Re: [_CODE_] GWC - Google Weather Companion
« Reply #10 on: May 14, 2011, 12:56:59 pm »
I'll leave hijacking the display of the Google Weather parent device as an easy exercise to the gentle source code reader. I even thought about adding a flag GoogleWeatherHijack to GWC - but I came to the conclusion that hijacking other devices would be a hostile act. :)


Please note that I'm not propagating the use of HTML injection: there is an urgent need for a decent and well documented GUI toolkit for MiOS; using HTML injection is just a last and desperate resort.

Offline Ap15e

  • Beta Testers
  • Hero Member
  • *****
  • Posts: 1998
  • Karma: +12/-0
Re: [_CODE_] GWC - Google Weather Companion V0.2
« Reply #11 on: May 14, 2011, 04:59:26 pm »
GWC V0.2 is available. V0.2 adds support for wind speed (mph or km/h) and wind direction.
« Last Edit: May 15, 2011, 03:39:33 am by Ap15e »

Offline Ap15e

  • Beta Testers
  • Hero Member
  • *****
  • Posts: 1998
  • Karma: +12/-0
Re: [_CODE_] GWC - Google Weather Companion V0.2
« Reply #12 on: May 15, 2011, 06:21:07 am »
Please note the security considerations in the topmost post.

Offline guessed

  • Community Beta
  • Master Member
  • ******
  • Posts: 5301
  • Karma: +92/-22
  • Release compat is not a bolted-on afterthought
Re: [_CODE_] GWC - Google Weather Companion
« Reply #13 on: May 16, 2011, 12:59:33 am »
@guessed

Quote
They'll fix that

I doubt it. And if they will ever fix it, I'm pretty sure they will provide methods that professional programmers can use as a replacement.

How long are we waiting for a fix for http://bugs.micasaverde.com/view.php?id=1038 (and for many other bugs and missing features)?
We've shown that when we focus, and list our bugs/enhancements [formally] in manageable, prioritized chunks, that MCV and team will listen.  This is how we got the long list of key fixes in the latest Beta, via the Beta forum.

Did it come easily, no.  But when we each contributed our [short] "key-bugs" list then they were fixed.


I think if you:
  • File Mantis bug reports for each Problem - after all, they can't fix what they don't know about
  • Be the driver behind a Beta release for UI/Security functionality.
  • Get support that these issues are the "highest priority" to fix - the security one should be given what you can do with it

...then you could get the fixes.

Personally, I haven't pursued many of the recent Mantis items filed as, whilst they're important to me, they're not in the "Top 20" issues that need to be fixed in Vera.... so I hold off.  In the case of the Weather Plugin, I have the somewhat less flexible request #1386 but I don't use the Dashboard that often, so would rather something be added to the CP's (SQRemote has something close to what's needed in the HTML Widget)

So, let's start with first principals....

What Mantis/Bug#'s are you using to track both the Security issue, and the desire for a new Dashboard HTML-based UI/Widget?

We can then add to the existing Private-Beta track to see if we can get enough support (compared to any stability/functional/performance type issues)

Offline Ap15e

  • Beta Testers
  • Hero Member
  • *****
  • Posts: 1998
  • Karma: +12/-0
Re: [_CODE_] GWC - Google Weather Companion V0.2
« Reply #14 on: May 16, 2011, 07:53:03 am »
My bug statistics as of today are:

  • resolved: 5 (of which at least one bug (#1391) isn't fixed; I had to reopen it as #1473, and #1473 is still unassigned ...)
  • assigned: 8
  • new: 18

I'm quite sure you purposely left the event implementation of your Weather plugin non-functioning in order to press MCV to fix bug #1038. Nothing happended, ... well, IIRC one user posted a 'fixed' version of your event definitions and other users are using Luup code to check the current Condition ...

IMHO if MCV doesn't care about the bug reports (for whatever reason), filing more bug reports seems to be the wrong strategy. Do you remember how much effort I had to invest in getting #1451 acknowledged (still unfixed)?

My personal resume is:
Be happy with what is working (and hope it won't break with the next update) and use workarounds/hacks if available - or use another product. ... and if you have some spare cycles, feel free to submit some bug reports.
« Last Edit: May 16, 2011, 10:26:18 am by Ap15e »