Davis WeatherLink Integration

For anyone struggling with, or interested in, integrating Davis WeatherLink with Home Assistant, here are the steps that I took:

You have 2 options:

  1. You can generate an API token in WeatherLink Instruction Video and make an API call.

  2. If your data logger is on the same LAN, you can call it directly (REST).

My data logger is on the same network segment as my HA box, so I chose option 2.
Then created a RESTful sensor in configuration.yaml (or imported package).

sensor:
  - name: davis_vantage_pro_curr
    platform: rest
    resource: 'http://172.16.0.11/v1/current_conditions'
    json_attributes:
      - data
    value_template: 'Vantage Pro'
  - platform: template
    sensors:
      temp:
        friendly_name: 'Temperature'
        device_class: temperature
        unit_of_measurement: "°F"
        value_template: '{{ state_attr("sensor.davis_vantage_pro_curr", "data")["conditions"][0]["temp"] }}'
      hum:
        friendly_name: 'Humidity'
        device_class: humidity
        unit_of_measurement: "%"
        value_template: '{{ state_attr("sensor.davis_vantage_pro_curr", "data")["conditions"][0]["hum"] }}'

Add more template sensors as desired.

Here is a sample of the data returned by my Vantage Pro2:

{
  "data": {
    "did": "XXXXXXXXXXXX",
    "ts": 1567218910,
    "conditions": [
      {
        "lsid": 226873,
        "data_structure_type": 1,
        "txid": 7,
        "temp": 77,
        "hum": 41.7,
        "dew_point": 52,
        "wet_bulb": 57.5,
        "heat_index": 76.2,
        "wind_chill": 77,
        "thw_index": 76.2,
        "thsw_index": null,
        "wind_speed_last": 0,
        "wind_dir_last": 0,
        "wind_speed_avg_last_1_min": 0,
        "wind_dir_scalar_avg_last_1_min": null,
        "wind_speed_avg_last_2_min": 0,
        "wind_dir_scalar_avg_last_2_min": null,
        "wind_speed_hi_last_2_min": 0,
        "wind_dir_at_hi_speed_last_2_min": 0,
        "wind_speed_avg_last_10_min": 0,
        "wind_dir_scalar_avg_last_10_min": null,
        "wind_speed_hi_last_10_min": 0,
        "wind_dir_at_hi_speed_last_10_min": 0,
        "rain_size": 1,
        "rain_rate_last": 0,
        "rain_rate_hi": 0,
        "rainfall_last_15_min": 0,
        "rain_rate_hi_last_15_min": 0,
        "rainfall_last_60_min": 0,
        "rainfall_last_24_hr": 0,
        "rain_storm": 0,
        "rain_storm_start_at": null,
        "solar_rad": null,
        "uv_index": null,
        "rx_state": 0,
        "trans_battery_flag": 0,
        "rainfall_daily": 0,
        "rainfall_monthly": 28,
        "rainfall_year": 658,
        "rain_storm_last": 21,
        "rain_storm_last_start_at": 1565236800,
        "rain_storm_last_end_at": 1565496060
      },
      {
        "lsid": 226871,
        "data_structure_type": 4,
        "temp_in": 74.6,
        "hum_in": 36.3,
        "dew_point_in": 46.1,
        "heat_index_in": 73.2
      },
      {
        "lsid": 226870,
        "data_structure_type": 3,
        "bar_sea_level": 30.128,
        "bar_trend": 0.039,
        "bar_absolute": 24.852
      }
    ]
  },
  "friendly_name": "davis_vantage_pro_curr"
}

Enjoy!

1 Like

Is this only for US weather data or world wide?
E.

I’m in Australia and it works for me although my weather station is on a different LAN so I couldn’t call it directly.

This is my config:

# Weatherlink API
  - platform: rest
    resource: !secret weatherlink_api_key
    scan_interval: 600
    name: weatherlink
    json_attributes:
    - temp_c
    - davis_current_observation
    value_template: '{{ value_json.weatherlink }}'
  
  - platform: template
    sensors:
      outside_temp:
        friendly_name: 'Outside Temp'
        unit_of_measurement: '°C'
        device_class: 'temperature'
        value_template: "{{ state_attr('sensor.weatherlink', 'temp_c') }}"
      inside_temp:
        friendly_name: 'Living Room temp'
        value_template: '{{ ((states.sensor.weatherlink.attributes["davis_current_observation"]["temp_in_f"] | float - 32) * (5/9)) | round(1) }}'
        unit_of_measurement: '°C'
        device_class: 'temperature'
2 Likes

This collects the weather data from your own personal Davis weather station, if you have one.

Oh right, got it.
Thx

E.

Hi,

A newbie here so learning the ropes. I’m in Australia and have the Davis Vantage Pro 2.

Some assistance please with the script. I have a weatherlinkIP and it sits on 192.168.1.112 which is within my home network. 192.168.1.x
This is what is on my Ubuntu server.

IP address for enp2s0: 192.168.1.104
IP address for hassio: 172.30.32.1
IP address for docker0: 172.17.0.1
IP address for docker_gwbridge: 172.18.0.1

I’ve tried both the 192.168.1.112 and the 172.30.32.1 but don’t get any data. The categories show however.

Suggestions please.

I have a Vantage Pro 2 setup from many years ago…10 or 15 years at least.

Can I just buy the WeatherLink unit and get all my data on the cloud and HA?

Do you use the WiFi or Ethernet?

I was thinking of getting another weather station, but considering the issues people have had with other units, I’d prefer to leverage the Davis Vantage Pro 2 that I have.

Do you have any Lovelace cards that you like to use for your data?

For history, you need to use the Weatherlink.com or is there some DB or method in HA to do history?

Do you have any issues with your setup?

Thanks,

Ambi

FYI: The WeatherLink unit works for my old Vantage Pro 2!

Now, on to the integration! :smiley:

-Ambi

Hi Patchy,

Thanks for the help.

This works for me, but how do I get the other monitored data into HA? I see all the data, but there doesn’t seem to be sensors for wind speed, dew point, etc.

I found the answer, at least a partial one. When using sensors, device_class isn’t required. So if you have one of the “regular” sensors, like temp, luminescence, etc. use those device_classes, otherwise, just leave it out;

Tnx,

Ambi

Hi,
I’m new to Home Assistant and not a programmer so please bear with me.

My question is: Does this integration work with Weatherlink IP or Weatherlink Live?

When I look at the example from Mutty using API key don’t I need to enter the URL for the API (api.weatherlink.com/v1…) somewhere?

That will be what is entered after resource in the configuration file. I have my API key in my secrets file.

The config section should look something like this:

  - platform: rest
    resource: https://api.weatherlink.com/v1/NoaaExt.json?user=<REDACTED>0&pass=<REDACTED>&apiToken=<REDACTED>
    scan_interval: 600
    name: weatherlink
    json_attributes:
    - temp_c
    - davis_current_observation
    value_template: '{{ value_json.weatherlink }}'

Of course I have my user id, password and token.

Thanks, I receive data now,
I found out that I can receive data without the API key using " resource: https://api.weatherlink.com/v1/NoaaExt.json?user=0&pass="
So why go thru the trouble generating the API key?

Hi. My sensors are no longer working. Other than the introduction of the additional v2 API it doesn’t appear anything has changed from the Davis Inst. side. Anyone having issues with their sensors no longer working?

I tried this with my Vantage Vue station connected by a WeatherLink IP module but get the log message “REST result could not be parsed as JSON” so perhaps the JSON format is different for a Vantage Vue than a Vantage Pro. Changing the name of the first value_template doesn’t help. Where does HA put the JSON file so that I can inspect it?

Hello,

I’m joining a bit late on the conversation. This post was exactly what I was looking for but, unfortunately, it does not work for me and since I am quite a beginner I was hoping I could ask for help.

My case is very similar to the one described by Muttly, so I copied his code entirely and replaced the “!secret weatherlink_api_key” with a URL filled with my ID, password, and station TOKEN. I’ve tested the URL on the browser and XML page shows up with all the correct data.

Is my understanding (but I may be wrong) that the Muttly’s code goes in the configuration.yaml and under “sensor:” … am I correct? I don’t understand why I don’t get anything and why the logs don’t report any problem. Under the “developer” tab, I can see the weatherlink variable but it is empty and, as a consequence, also “Outside Temp” and “Living Room temp” are empty.

Do I need to change anything else in Muttly’s code? When can I see a more specific “log” about what is going on with it? I look at the general log but I can’t see anything relating to this weatherling integration. Any advice for me?

Thanks for the support!
Ben

Hi Ben,

Yes, the code does go in the Sensors section. Are you able to post the URL (without the ID, password and token) and I will compare it to mine.

Regards
Greg

Hi Greg,

thanks so much for the help. Yes, the issue was there, in the URL: after I read your message I carefully checked the URL and… it turns out I took the XML version of the weatherlink URL, not the JSON one. I’m sorry!

Your code works like a charm! Thanks so much for the share!
Best regards,
Ben

1 Like