Did we figure out the update issue?
I have an update to fix the missing UV index data. In the sensor template for the UV sensor, change the case from
pws_uv:
value_template: '{{ states.sensor.weather_underground_pws.attributes.uv }}'
to:
pws_uv:
value_template: '{{ states.sensor.weather_underground_pws.attributes.UV }}'
Sorry I missed that!
Has anybody figured out the update/refresh issue? @kellbot seems to be MIA and this is the only thing holding this platform up from being outstanding.
No luck on my end. At first I thought it was just grabbing cached data, so I commented out the throttle code, but that made no difference. I may have to rewrite the whole thing and test each stage to see if it updates. I just don’t understand HA enough to do any real troubleshooting. I just need a way to see what this module is doing via logs or something else…
I wish I could offer some help but my Python knowledge is very basic. I wonder if the problem was somewhere here:
from datetime import timedelta
CONF_PWS_ID = 'pws_id'
_RESOURCE = 'http://api.wunderground.com/api/'
# Return cached results if last scan was less then this time ago.
MIN_TIME_BETWEEN_UPDATES = timedelta(seconds=300)
in the use of timedelta?
Yeah, I commented out both the from datetime and the variable MIN_TIME_BETWEEN_UPDATES lines among others when i was referring to the throttle code… no luck yet
Thanks to @kellbot for all the work…I was able to update the sensor. Created a new thread in share your project.
Thanks for getting the updates to work @arsaboo! I’ve posted underneath your new post with the pictures, instructions and the updated YAML files, so you can edit your post to remove the link (it was pointing to the older files anyway).
I merged @arsaboo’s changes into my version of the repo as well, so anyone who’s on mine can just git pull origin master
to get the fixed code. Thanks for picking up the pieces everyone!
Cool…will work on it to improve how the sensors are added and only the relevant details are saved.
@kellbot I have three things to add @ https://github.com/AlucardZero/hass-wunderground/commits/add-forecast
- switch to https, because why not
- add forecast data
- correct some Readme typos and document forecast a bit
Do you want a straight pull request of everything?
To circle back to this, once you have a WU API key you can get a local radar picture and display it in HASS. Now, do not use a generic camera component with a still_image_url, or you will quickly go over your API limits. Instead, use a cron job / scheduled task to download the file, say, every 15 minutes, and use a local_file camera instead,
Example cron entry to download an animated radar image every 15 minutes, see the API documentation for the options:
# m h dom mon dow command
*/15 * * * * wget -qO /home/hass/weather.gif "https://api.wunderground.com/api/KEY/animatedradar/q/ST/TOWN.gif?newmaps=1&timelabel=1&timelabel.y=10&num=10&delay=50&noclutter=1&rainsnow=1&radius=15&height=400&width=400"
One remaining quirk is the height and width is dynamic in HASS based on browser size, so I’m not sure what to do about the image scaling.
Then in your HASS config:
camera:
platform: local_file
file_path: /home/hass/weather.gif
name: Recent Radar
Kellbot just merged my PR, so anyone using this should update if you want to also get forecast data. There’s a short example in the README on how to use it, and here is a slightly longer example of how I got my picture two posts ago. More info on what forecast data you can get here.
sensor.yaml:
[code]# Forecast
- platform: template
sensors:
pws_tf_period_0_text:
value_template: ‘{{ states.sensor.weather_underground_pws.attributes.txt_forecast.forecastday.0.fcttext }}’
pws_tf_period_0_title:
value_template: ‘{{ states.sensor.weather_underground_pws.attributes.txt_forecast.forecastday.0.title }}’
pws_tf_period_1_text:
value_template: ‘{{ states.sensor.weather_underground_pws.attributes.txt_forecast.forecastday.1.fcttext }}’
pws_tf_period_1_title:
value_template: ‘{{ states.sensor.weather_underground_pws.attributes.txt_forecast.forecastday.1.title }}’
pws_tf_period_2_text:
value_template: ‘{{ states.sensor.weather_underground_pws.attributes.txt_forecast.forecastday.2.fcttext }}’
pws_tf_period_2_title:
value_template: ‘{{ states.sensor.weather_underground_pws.attributes.txt_forecast.forecastday.2.title }}’[/code]
customize.yaml:
sensor.pws_tf_period_0_text:
friendly_name: What
icon: mdi:chevron-double-right
sensor.pws_tf_period_0_title:
friendly_name: When
icon: mdi:calendar-clock
sensor.pws_tf_period_1_text:
friendly_name: What
icon: mdi:chevron-double-right
sensor.pws_tf_period_1_title:
friendly_name: When
icon: mdi:calendar-clock
sensor.pws_tf_period_2_text:
friendly_name: What
icon: mdi:chevron-double-right
sensor.pws_tf_period_2_title:
friendly_name: When
icon: mdi:calendar-clock
group.yaml:
[code]Forecast:
- sensor.pws_tf_period_0_title
- sensor.pws_tf_period_0_text
- sensor.pws_tf_period_1_title
- sensor.pws_tf_period_1_text
- sensor.pws_tf_period_2_title
- sensor.pws_tf_period_2_text[/code]
I’ve been using forecast.io for this so I’m glad to now have everything local in one place - thanks!
Just got started with HA and I created a sensor to learn. It operates similarly to the one in this thread it seems. I included the radar image download in the component itself.
I originally had it grabbing an animated gif, but HA didn’t seem to animate it. Perhaps I missed something?
Here you go:
I’m trying to use the forecast feature of weather underground, and it doesn’t seem to be working. I have the regular sensor working using (spaces are not show correctly, but they are actually correct):
sensor:
- platform: wunderground
api_key: !secret_api
monitored_conditions:
- weather
- temp_f
- relative_humidity
- wind_mph
But I am looking to use the attributes to get the forecast data. I used the example code above:
sensors: pws_forecast_period_1_text: value_template: '{{ states.sensor.weather_underground_pws.attributes.precip_1hr_string }}'
I get the output below which shows simply “unknown” for the first icon:
When I look at the log, I see, “‘None’ has no attribute ‘state’”, which I am not sure means anything.
I am wondering if weather_underground_pws is the right entity. Any thoughts?
Not sure what you’re trying to do here as WU doesn’t support forecasts. A PR was made to read in the available forecasts but was abandoned and closed.
Since this is not really a feature request anymore (as the support was added already), can you start a new thread in the Configuration category and try to explain a bit more what it is you’re trying to do? This way we can close this thread properly and I’ll see if I can help you with what you’re trying to do in the other thread.
Thanks!