Author Topic: Weatherunderground.com plugin not working  (Read 4639 times)

0 Members and 1 Guest are viewing this topic.

PegLegTV

  • $upporter
  • Sr. Member
  • *****
  • Posts: 497
  • Karma: 43
    • View Profile
Weatherunderground.com plugin not working
« on: March 06, 2019, 06:00:39 PM »
Weatherunderground.com plugin isn't working, but site is up and running. I've tested with 2.241 and 2.245b and getting the same errors



I've tested it on two PC's running windows 10

anyone else having the same problem?

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 1999
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: Weatherunderground.com plugin not working
« Reply #1 on: March 08, 2019, 08:24:30 AM »
Hi Pegleg,

Unfortunately, it seems that Weather Underground has ended support for its free API, which is what VC relied on.

https://apicommunity.wunderground.com/weatherapi/topics/end-of-service-for-the-weather-underground-api

https://www.wunderground.com/weather/api/

I suspect that their warning a few months ago must not have reached James. He is away at the moment so it may take some time for him to respond.

Perhaps he could add an "API key" field to the plugin so that anyone who wants to pay for their own key can still use it, but even that may not be worth his labour because their commercial API is probably aimed at big data users and not really priced for the individual consumer. They may also have divided their variables into separate "packages" and who knows what else.


« Last Edit: March 08, 2019, 08:34:42 AM by nime5ter »
TIPS: POST VC VERSION #. Explain what you want VC to do. Say what you've tried & what happened, or post a video demo. Attach VC log. Link to instructions followed.  Post your command (xml)

PegLegTV

  • $upporter
  • Sr. Member
  • *****
  • Posts: 497
  • Karma: 43
    • View Profile
Re: Weatherunderground.com plugin not working
« Reply #2 on: March 08, 2019, 12:12:40 PM »
Thanks for the reply, I completely understand, to bad they couldn't offer a free version with maximum quires like some other API's offer but business is business.

we mainly use the weather plugin to tell us the weather each morning when we wake up and then sunrise and sunset events. I'll have to do some digging and see what I can find.

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 1999
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: Weatherunderground.com plugin not working
« Reply #3 on: March 08, 2019, 06:51:10 PM »
Open Weather Map might be usable for your needs.  https://openweathermap.org/

The API's http queries are pretty straightforward. Unfortunately, the results are probably easier to manage with Python or real programming due to the values they return, which need to be made more human friendly.

Just for the heck of it, however, I signed up for a key and created the command below. It grabs today's sunrise and sunset times from a full five-day forecast with a lot of other info in it. Forecast information could similarly be grabbed with scrape and regular expressions.

Since the request results return everything in Greenwich mean time (UTC +0), I had to subtract 5 from the hours. This makes it kind of silly overkill to get basic info. I did it just for a few minutes of fun, really. :)

Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 2.2.4.5-->
<command id="283" name="Get 5-day forecast (location by lat,lon)" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="Get your own api key at: https://openweathermap.org/&#xD;&#xA;In your own apiKeys map, add an openWeather key with a value: APPID=YOUR_APIKEY&#xD;&#xA;In Scrape action: Change the lat&amp;long to your own real coordinates. units=metric can be changed to units=imperial">
  <action>
    <cmdType>Scrape</cmdType>
    <params>
      <param>https://api.openweathermap.org/data/2.5/forecast?{M:apiKeys.openWeather}&amp;mode=xml&amp;units=metric&amp;lat=0&amp;lon=-1</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>Results.SetVar</cmdType>
    <params>
      <param>forecast</param>
      <param>{LastResult}</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>Results.RegEx</cmdType>
    <params>
      <param>&lt;sun\srise.*?T(\d\d):(\d\d).*?T(\d\d):(\d\d)</param>
      <param />
      <param>{var.forecast}</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>PY.ExecString</cmdType>
    <params>
      <param>result={Match.1.1}-5</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>Results.SetVar</cmdType>
    <params>
      <param>sunrise</param>
      <param>{LastResult}:{Match.1.2}</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>PY.ExecString</cmdType>
    <params>
      <param>result={Match.1.3}-5</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>Results.SetVar</cmdType>
    <params>
      <param>sunset</param>
      <param>{LastResult}:{Match.1.4}</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>OSD.ShowText</cmdType>
    <params>
      <param>Sunrise: {var.sunrise}</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>OSD.AddText</cmdType>
    <params>
      <param>Sunset: {var.sunset}</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <phrase>Get forecast</phrase>
</command>

« Last Edit: March 09, 2019, 08:10:54 AM by nime5ter »
TIPS: POST VC VERSION #. Explain what you want VC to do. Say what you've tried & what happened, or post a video demo. Attach VC log. Link to instructions followed.  Post your command (xml)

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 1999
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: Weatherunderground.com plugin not working
« Reply #4 on: March 09, 2019, 09:09:43 AM »
Here I used the XJson plugin's token parser to parse the Open Weather's json data for today's forecast.

Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 2.2.4.5-->
<command id="280" name="Today's forecast" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="You can paste the full scrape results into an online JSON viewer for help finding all the variables. list[0] contains today's data. list[1] would be tomorrow's etc.">
  <action>
    <cmdType>Scrape</cmdType>
    <params>
      <param>https://api.openweathermap.org/data/2.5/forecast?units=metric&amp;lat=yourlatitude&amp;lon=yourlongitude&amp;APPID=yourapikeygoeshere&amp;units=metric</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>Results.SetVar</cmdType>
    <params>
      <param>forecast</param>
      <param>{LastResult}</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>XJson.ParseTokens</cmdType>
    <params>
      <param>Today's forecast calls for a high of {list[0].main.temp_max} degrees and {list[0].weather[0].description}.</param>
      <param>{var.forecast}</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>OSD.ShowText</cmdType>
    <params>
      <param>{LastResult}</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>XJson.ParseTokens</cmdType>
    <params>
      <param>{list[0].wind.speed}</param>
      <param>{var.forecast}</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <if ifBlockDisabled="False" ifNot="False">
    <ifType>(A)&lt;(B)</ifType>
    <ifParams>10&amp;&amp;{LastResult}</ifParams>
    <then>
      <action>
        <cmdType>OSD.AddText</cmdType>
        <params>
          <param>Expect winds of {LastResult} km/h</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
    </then>
    <else />
  </if>
  <phrase>What's today's forecast</phrase>
</command>

It's doable. To implement it beyond a demo command, one would want to break down some of the steps into different commands probably. Especially to avoid re-querying the Open Weather site unless new data is needed.

OK, that's my morning fun. Now back to the espresso machine for my morning cappuccino fix ...
TIPS: POST VC VERSION #. Explain what you want VC to do. Say what you've tried & what happened, or post a video demo. Attach VC log. Link to instructions followed.  Post your command (xml)

PegLegTV

  • $upporter
  • Sr. Member
  • *****
  • Posts: 497
  • Karma: 43
    • View Profile
Re: Weatherunderground.com plugin not working
« Reply #5 on: March 09, 2019, 11:11:49 AM »
Nice work, your awesome  8)! Going above and beyond as always, I'll test them out today

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 1999
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: Weatherunderground.com plugin not working
« Reply #6 on: March 09, 2019, 01:18:35 PM »
There's a note in the command xml, but in case it's not obvious you'll need to get your own API key and use that in your requests.

These examples are not for unseasoned users, but I figure that you as a Super User can probably do something with them if you're desperate. ;-)
TIPS: POST VC VERSION #. Explain what you want VC to do. Say what you've tried & what happened, or post a video demo. Attach VC log. Link to instructions followed.  Post your command (xml)

PegLegTV

  • $upporter
  • Sr. Member
  • *****
  • Posts: 497
  • Karma: 43
    • View Profile
Re: Weatherunderground.com plugin not working
« Reply #7 on: March 09, 2019, 05:47:06 PM »
While I was waiting for my API key to get activated I decided to test Weather underground through IFTTT, I had it trigger an event with some information and it looks like IFTTT still has accesses to Weather undergrounds API, so there may be a way for non "Super users" to get a daily event with sunrise, sunset, high and low temps, then set them to a map table to be used as they want.

they can get current weather and some other information but the event can only be triggered at a specific time, so you wouldn't be able request current weather, you would have to set the high and low for the day to a map or variable to be able to request it,


both commands you posted work well, I've been looking through the information in the response and it looks like it has a lot of the information that I'm after which is definitely good, but it looks like they aren't broken down by days (24 hour) they are broken down into three hour increments, so your second command gets the high temp of the current three hour window, it could be used for current weather, but determining today's high and low would be a little trickier.

I'm thinking it would be easiest to have IFTTT get:
Sunrise
Sunset
Today's High
Today's Low

and use openweathermap.org to get current conditions

as long as weather underground doesn't stop Ifttt from using their API, Then I think this will work



nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 1999
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: Weatherunderground.com plugin not working
« Reply #8 on: March 09, 2019, 05:51:59 PM »
For sure. That sounds like a much better option.
TIPS: POST VC VERSION #. Explain what you want VC to do. Say what you've tried & what happened, or post a video demo. Attach VC log. Link to instructions followed.  Post your command (xml)

oeste24

  • Jr. Member
  • **
  • Posts: 3
  • Karma: 0
    • View Profile
Re: Weatherunderground.com plugin not working
« Reply #9 on: May 06, 2019, 12:00:52 PM »
Excuse me for ignorance, what would my API key be? I am already registered with username and password for the site https://openweathermap.org/

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Weatherunderground.com plugin not working
« Reply #10 on: May 06, 2019, 01:01:27 PM »

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Weatherunderground.com plugin not working
« Reply #11 on: August 07, 2019, 12:17:47 PM »
Sorry for the long wait.  Anyone who is still interested should check out the alpha of Voxcommando here:

https://voxcommando.com/forum/index.php?topic=2906.0