Jump to content

Weather workflow


Recommended Posts

  • 6 months later...

Excellent, glad to hear it's working.

 

Would it be possible to make your workflow show CURRENT conditions instead of only highest/lowest throughout the day?

 

Thanks for a great workflow - using it with forecast.io :)

 

Edit: 

Oh well, don't mind my question.... ;)

Edited by Arthur
Link to comment

Hi, 

 

I'm getting the same "invalid literal for int() with base 10: ' '" that was briefly mentioned. I tried resetting all of the locations, units, service, etc. I checked my key. I tried restarting Alfred and restarting my computer, but the problem persists.

 

It shows the error when I use the "weather" keyword. But, if I type something like "weather Vancouver" then it will get valid results. If I stop typing like "weather V", "weather Van", "weather Vancou" then it will report "results failed" or sometimes it will suggest a city and show results.

 

After running "weather" keyword, I get the following debug log:

 

[2013-12-10 22:13:54,299] INFO: alfred_weather: Running command weather
[2013-12-10 22:13:54,314] ERROR: alfred_weather: Error telling
Traceback (most recent call last):
  File "alfred_weather.py", line 804, in tell
    items = globals()[cmd](query)
  File "alfred_weather.py", line 706, in tell_weather
    weather = _get_wund_weather()
  File "alfred_weather.py", line 359, in _get_wund_weather
    weather['alerts'] = [parse_alert(a) for a in data['alerts']]
  File "alfred_weather.py", line 341, in parse_alert
    'expires': datetime.fromtimestamp(int(alert['expires_epoch'])),
ValueError: invalid literal for int() with base 10: ''
 

Is anyone able to understand what this code means? I tried looking up "expires_epoch" and found this from weather underground:

 

http://www.wunderground.com/weather/api/d/docs?d=data/alerts

 

But it wasn't too helpful (to me). I don't think the problem can be that my default location is in Canada since the workflow seems to work for Vancouver. 

 

I'd really appreciate some help!

Edited by katie
Link to comment

Hi, 

 

I'm getting the same "invalid literal for int() with base 10: ' '" that was briefly mentioned. I tried resetting all of the locations, units, service, etc. I checked my key. I tried restarting Alfred and restarting my computer, but the problem persists.

 

It shows the error when I use the "weather" keyword. But, if I type something like "weather Vancouver" then it will get valid results. If I stop typing like "weather V", "weather Van", "weather Vancou" then it will report "results failed" or sometimes it will suggest a city and show results.

 

After running "weather" keyword, I get the following debug log:

 

[2013-12-10 22:13:54,299] INFO: alfred_weather: Running command weather
[2013-12-10 22:13:54,314] ERROR: alfred_weather: Error telling
Traceback (most recent call last):
  File "alfred_weather.py", line 804, in tell
    items = globals()[cmd](query)
  File "alfred_weather.py", line 706, in tell_weather
    weather = _get_wund_weather()
  File "alfred_weather.py", line 359, in _get_wund_weather
    weather['alerts'] = [parse_alert(a) for a in data['alerts']]
  File "alfred_weather.py", line 341, in parse_alert
    'expires': datetime.fromtimestamp(int(alert['expires_epoch'])),
ValueError: invalid literal for int() with base 10: ''
 

Is anyone able to understand what this code means? I tried looking up "expires_epoch" and found this from weather underground:

 

http://www.wunderground.com/weather/api/d/docs?d=data/alerts

 

But it wasn't too helpful (to me). I don't think the problem can be that my default location is in Canada since the workflow seems to work for Vancouver. 

 

I'd really appreciate some help!

 

That's just the workflow being a bit too trusting of the data its downloaded. I'll try to get that fixed later today.

Link to comment

It works! Thank you!!

 

And I love your workflow; thank you for sharing it! 

 

Any chance that you would consider adding additional features, like hourly weather or favourite locations or yesterday's conditions?

 

I'm always open to new feature suggestions, and those sound very doable.

Link to comment

Great! And I'm available if you need a guinea pig :) I have a few ideas now that I've played with it a bit and I'll write them out here, but I'm not sure they would be helpful to everyone so feel free to reject any that you think are not useful. I'm also really new to Alfred so I don't know the best way to implement things or if they are even possible.

  1. Option to choose "feels like" temperature versus "actual temperature".
  2. Weather alert text shown in Alfred. As it is now, I have to go to the website to read the updates. Maybe in the black text box that sometimes pops up (like in workflows for lyrics)?
  3. Hourly weather: chance of precipitation (%, mm) and temperature. I think it would probably clutter things up to include all of this at once. But, maybe clicking enter on a day could take you to a new list with hourly conditions displayed in the same manner as the forecast?
  4. Favourite locations to see current conditions in multiple places (useful when planning a road trip home - it's an 8 hour drive and weather along the way makes a big difference). I guess this would require setting up favourite locations. I don't know if this would work with the key limits (no more than 10 requests per minute).
  5. Yesterday's weather - I'm interested in the relative judgement, something like "Today will be colder than/the same as yesterday" or "Tomorrow will be warmer than today" (maybe display this text rather than the local time in the subtext). But if that's too complex, then displaying the information would be good, too. 
  6. Option to display local sunrise and sunset times.

That's everything - I didn't quite realize how much I check the weather until writing this up...but it may also be because we're in the middle of a snow squall warning :) I also know that this is quite a lot of stuff and a lot of work so please don't take them all as requests - none of them are really even necessary; the workflow is awesome in its current form and I already see myself using it daily.

Link to comment

Great! And I'm available if you need a guinea pig :) I have a few ideas now that I've played with it a bit and I'll write them out here, but I'm not sure they would be helpful to everyone so feel free to reject any that you think are not useful. I'm also really new to Alfred so I don't know the best way to implement things or if they are even possible.

  1. Option to choose "feels like" temperature versus "actual temperature".
  2. Weather alert text shown in Alfred. As it is now, I have to go to the website to read the updates. Maybe in the black text box that sometimes pops up (like in workflows for lyrics)?
  3. Hourly weather: chance of precipitation (%, mm) and temperature. I think it would probably clutter things up to include all of this at once. But, maybe clicking enter on a day could take you to a new list with hourly conditions displayed in the same manner as the forecast?
  4. Favourite locations to see current conditions in multiple places (useful when planning a road trip home - it's an 8 hour drive and weather along the way makes a big difference). I guess this would require setting up favourite locations. I don't know if this would work with the key limits (no more than 10 requests per minute).
  5. Yesterday's weather - I'm interested in the relative judgement, something like "Today will be colder than/the same as yesterday" or "Tomorrow will be warmer than today" (maybe display this text rather than the local time in the subtext). But if that's too complex, then displaying the information would be good, too. 
  6. Option to display local sunrise and sunset times.

That's everything - I didn't quite realize how much I check the weather until writing this up...but it may also be because we're in the middle of a snow squall warning :) I also know that this is quite a lot of stuff and a lot of work so please don't take them all as requests - none of them are really even necessary; the workflow is awesome in its current form and I already see myself using it daily.

 

Wow, many good suggestions here. I like your idea for hourly weather, so I reorganized the internals of the workflow a bit to make implementing that kind of thing easier (I haven't gotten to it yet, though). I did add a "feelslike" option, so  you can give that a try when you get a chance. It will simply toggle the current conditions temperature display between actual and "feels like". (I considered showing both temps at the same time, but as you pointed out, things are already getting kind of crowded.)

Link to comment

Wow, many good suggestions here. I like your idea for hourly weather, so I reorganized the internals of the workflow a bit to make implementing that kind of thing easier (I haven't gotten to it yet, though). I did add a "feelslike" option, so  you can give that a try when you get a chance. It will simply toggle the current conditions temperature display between actual and "feels like". (I considered showing both temps at the same time, but as you pointed out, things are already getting kind of crowded.)

 

Thanks for being so open to suggestions! The feelslike option works great! I generally find the feels like temperature more informative so I appreciate this addition to the workflow. I think you could fit in both if it was something like this: Actual (Feelslike) or vice versa, e.g. -16C (-26), but it's not necessary. I like the new simplified implementation of the wset commands!

Link to comment
  • 2 years later...
  • 3 weeks later...
  • 1 month later...
  • 2 months later...

Hi,

 

I installed this worklfow version 1.1.0 (https://github.com/jason0x43/alfred-weather/releases/tag/1.1.0) on my Alfred 3.3.1 and after configuring it using WTO, I get error message "Error: invalid character...g for beginning of value" when I use WTR or WTD. Below is code from /Users/<me>/Library/Application Support/Alfred 3/Workflow Data/com.jason0x43.alfred-weather/config.json:

 

{
    "Service": "Weather Underground",
    "DarkSkyKey": "",
    "WeatherUndergroundKey": "<my key>",
    "Icons": "grzanka",
    "DateFormat": "1/2/2006",
    "TimeFormat": "15:04",
    "Location": {
        "Latitude": 34.0522342,
        "Longitude": -118.2436849,
        "Timezone": "",
        "ShortName": "Los Angeles, CA, USA",
        "Name": "Los Angeles, CA, USA"
    },
    "Units": "US"
}

 

 

error.jpg

Link to comment

Hmmm...your config seems fine (it works for me), so there must be something else going on here. Could you open your Alfred preferences, go to Workflows, pick the Weather workflow, and the select the "debug" icon (looks like a bug) in the upper right to open a debug terminal? That should open a debug pane under the workflow in the Alfred preferences window. Then try getting a forecast, the post what's displayed in the debug pane (filtering out anything you'd rather not post).

Link to comment
On 4/8/2017 at 11:40 AM, jason0x43 said:

Hmmm...your config seems fine (it works for me), so there must be something else going on here. Could you open your Alfred preferences, go to Workflows, pick the Weather workflow, and the select the "debug" icon (looks like a bug) in the upper right to open a debug terminal? That should open a debug pane under the workflow in the Alfred preferences window. Then try getting a forecast, the post what's displayed in the debug pane (filtering out anything you'd rather not post).

 

 

Not sure what changed but the workflow started working. All I remember doing was reboot before checking again.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...