Is anyone doing anything with weather underground

Yeah, proper error handling / messaging is definitely on the need-to-have list.

I think my loose workflow is going to be something like: migrate this into a platform instead of a component, look into / work on the generic weather component, and then modify the WU platform to conform to it.

1 Like

You can generate one via the API, but hand-generating the URL is a little tedious. You can see the available parameters here.

Ideally the software would use the lat/long set for the PWS and then have a config.yaml setting for the radius. Will have to look at whatā€™s involved in throwing an image up in the dashboard. If itā€™s pretty simple Iā€™ll see about putting it in the code Iā€™ve got now.

2 Likes

Cool! Iā€™m happy with using the generic camera for the radar images from NOAA but this would be much cooler.

I rearranged things to make it a sensor platform rather than a component. The good news is that the icons from WUnderground now work! The bad news is that I canā€™t figure out how (if itā€™s even possible) to display the other sensor data, because itā€™s set up as being an attribute for the PWS. I could register a whole bunch of separate sensors like I did before, but @balloob said in the weather component pull request that it makes more sense to have one device with a bunch of attributes for the weather. So for now Iā€™m guessing most folks will want to stick with the old version of the code, but Iā€™m happy to push up the newer platform version if anyone wants to poke at it.

1 Like

Where can we find the new code to give it a try? The master branch on your github was last updated 24 days ago, so I donā€™t think it is this version. Unless youā€™ve been holding out on us for 3 weeks :wink:

No, I confess I havenā€™t pushed the new code up to github because Iā€™ve been too lazy to rewrite the readme. Iā€™ll do that shortly though.

edit: git repo is up to date now.

I hope that I understand you right about the attributes. If you donā€™t want to create a bunch of sensor but still display the details use def device_state_attributes(self)

As long the weather component is not done, I see no problem to do it the same way as the other weather sensors are done.

1 Like

Hi kellbot, I noticed a small typo: your Readme.md file says to create /custom_components/sensors/, but it should be /custom_components/sensor/ (no s)

This had me scratching my head for a few daysā€¦ :slight_smile:

So will any further work be done on this? Iā€™d be willing to contribute some $ if thatā€™s what it takes.

You can pull the data you want via templates. Just need some nicer icons!

# wunderground sensors
sensor 4:
  platform: template
  sensors:
    wind_kph:
      name: "Wind KPH"
      value_template: '{{ states.sensor.weather_underground_pws.attributes.wind_kph }}'
    wind_degrees:
      name: "Wind Degrees"
      value_template: '{{ states.sensor.weather_underground_pws.attributes.wind_degrees }}'
    dewpoint:
      name: "dewpoint"
      value_template: '{{ states.sensor.weather_underground_pws.attributes.dewpoint_c }}'

One request: We need a check for the station ID, if not specified we can pull the nearest station via LONG/LAT co-ordinates with a url like:
http://api.wunderground.com/api/API_KEY/conditions/q/LONGITUDE,LATITUDE.json

How should this be formatted with proper spacing?

should be fixed now ^

sweet. thanks!

ā€œName:ā€ doesnā€™t seem to be working

  - platform: template
    sensors:
      stationid:
        name: "Station ID"
        value_template: '{{ states.sensor.weather_underground_pws.attributes.station_id }}'
      wind_mph:
        name: "Wind MPH"
        value_template: '{{ states.sensor.weather_underground_pws.attributes.wind_mph }}'
      wind_degrees:
        name: "Wind Degrees"
        value_template: '{{ states.sensor.weather_underground_pws.attributes.wind_degrees }}'
      dewpoint:
        name: "Dewpoint"
        value_template: '{{ states.sensor.weather_underground_pws.attributes.dewpoint_f }}'
      temp:
        name: "Temp F"
        value_template: '{{ states.sensor.weather_underground_pws.attributes.temp_f }}'
      feelslike:
        name: "Feels Like"
        value_template: '{{ states.sensor.weather_underground_pws.attributes.feelslike_f }}'

Are you talking about the friendly name attribute? That should go in the customize section.

If you post a full list of the sensor value templates, Iā€™ll go back and do the friendly names and icons. I picked out some nice icons for Forecast and Iā€™ll be glad to share them here.

Hi rpitera, that would be awesome! Here is the full list of possible state attributes in my dev tools:

{
  "UV": "0",
  "dewpoint_c": 11,
  "dewpoint_f": 52,
  "dewpoint_string": "52 F (11 C)",
  "display_location": {
    "city": "Saugeen Municipal",
    "country": "CA",
    "country_iso3166": "CA",
    "elevation": "286.00000000",
    "full": "Saugeen Municipal, Ontario",
    "latitude": "44.163067",
    "longitude": "-81.060646",
    "magic": "3",
    "state": "ON",
    "state_name": "Ontario",
    "wmo": "71631",
    "zip": "00000"
  },
  "entity_picture": "http://icons.wxug.com/i/c/k/nt_cloudy.gif",
  "estimated": {},
  "feelslike_c": "22.8",
  "feelslike_f": "73.1",
  "feelslike_string": "73.1 F (22.8 C)",
  "forecast_url": "http://www.wunderground.com/global/stations/71631.html",
  "friendly_name": "Weather Underground PWS",
  "heat_index_c": "NA",
  "heat_index_f": "NA",
  "heat_index_string": "NA",
  "history_url": "http://www.wunderground.com/weatherstation/WXDailyHistory.asp?ID=IONTARIO931",
  "icon": "cloudy",
  "icon_url": "http://icons.wxug.com/i/c/k/nt_cloudy.gif",
  "image": {
    "link": "http://www.wunderground.com",
    "title": "Weather Underground",
    "url": "http://icons.wxug.com/graphics/wu2/logo_130x80.png"
  },
  "local_epoch": "1465088919",
  "local_time_rfc822": "Sat, 04 Jun 2016 21:08:39 -0400",
  "local_tz_long": "America/Montreal",
  "local_tz_offset": "-0400",
  "local_tz_short": "EDT",
  "nowcast": "",
  "ob_url": "http://www.wunderground.com/cgi-bin/findweather/getForecast?query=44.163067,-81.060646",
  "observation_epoch": "1465088276",
  "observation_location": {
    "city": "CYHS airport, Hanover",
    "country": "CA",
    "country_iso3166": "CA",
    "elevation": "938 ft",
    "full": "CYHS airport, Hanover, ONTARIO",
    "latitude": "44.163067",
    "longitude": "-81.060646",
    "state": "ONTARIO"
  },
  "observation_time": "Last Updated on June 4, 8:57 PM EDT",
  "observation_time_rfc822": "Sat, 04 Jun 2016 20:57:56 -0400",
  "precip_1hr_in": "0.00",
  "precip_1hr_metric": " 0",
  "precip_1hr_string": "0.00 in ( 0 mm)",
  "precip_today_in": "0.00",
  "precip_today_metric": "0",
  "precip_today_string": "0.00 in (0 mm)",
  "pressure_in": "29.84",
  "pressure_mb": "1010",
  "pressure_trend": "-",
  "relative_humidity": "48%",
  "solarradiation": "--",
  "station_id": "IONTARIO931",
  "temp_c": 22.8,
  "temp_f": 73.1,
  "temperature_string": "73.1 F (22.8 C)",
  "unit_of_measurement": "degrees C",
  "visibility_km": "14.5",
  "visibility_mi": "9.0",
  "weather": "Overcast",
  "wind_degrees": 151,
  "wind_dir": "SSE",
  "wind_gust_kph": "16.1",
  "wind_gust_mph": "10.0",
  "wind_kph": 8,
  "wind_mph": 5,
  "wind_string": "From the SSE at 5.0 MPH Gusting to 10.0 MPH",
  "windchill_c": "NA",
  "windchill_f": "NA",
  "windchill_string": "NA"
}

I believe I may have spoke to soon due to my excitement over getting this working; I donā€™t think this can be done the way I thought on the customize side because itā€™s not going to output actual sensors.

But I can still give you a list of the mdi icons I have set up as well as look into ones for the ones that are different from my forecast set up matched by the attribute name if that will help. Thereā€™s still a lot of mdi icons that donā€™t map because theyā€™re missing but I try to stick with Google contributions.

Would this be of help to you?

Iā€™m not sure what you mean. This is exactly what @atomicpapa needs to rename his sensors. Note that the wind icon doesnā€™t exist and this is only an example:

  customize:
    sensor.wind_kph:
      friendly_name: Wind KPH
      icon: mdi:wind

more icons would be great!

Thank you!