Last active
June 24, 2024 03:28
-
-
Save phil-monroe/1ef07eee43ed75d522c6a6264bc6932f to your computer and use it in GitHub Desktop.
Setting up the Davis Vantage Vue with a WeatherLink Live in Home Assistant (https://weatherlink.github.io/weatherlink-live-local-api/)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Step 1: Ensure that all of the configuration is wired into the main configuration.yaml file. | |
# I've just so happen to split out my config files, but you can embed all of the following | |
# in this file if you so choose. | |
# https://www.home-assistant.io/docs/configuration/splitting_configuration/ | |
sensor: !include sensors.yaml | |
template sensors: !include template_sensors.yaml | |
weather: !include weather.yaml |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Step 2: Fetch the data from the WeatherLink Live hub using a local API and | |
# and persist the JSON response data as attribute on this "data retrival" sensor object. | |
# API Documentation: https://weatherlink.github.io/weatherlink-live-local-api/ | |
- name: "PWS Current Data" | |
unique_id: "pws_data" | |
icon: "mdi:database-sync-outline" | |
platform: rest | |
resource: 'http://YOUR-IP-ADDRESS-HERE/v1/current_conditions' | |
json_attributes: | |
- data | |
value_template: 'Davis Vantage Vue PWS' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Step 3: Set up a dedicated "weather" provider | |
# https://www.home-assistant.io/integrations/weather.template/ | |
- platform: template | |
name: "Monroestead PWS" | |
unique_id: "davis_vantage_vue_pws" | |
condition_template: >- | |
{{ states("weather.forecast_home") }} | |
temperature_template: >- | |
{{ state_attr("sensor.monroestead_pws_current_data", "data")["conditions"][0]["temp"] | float }} | |
humidity_template: >- | |
{{ state_attr("sensor.monroestead_pws_current_data", "data")["conditions"][0]["hum"] | float }} | |
dew_point_template: >- | |
{{ state_attr("sensor.monroestead_pws_current_data", "data")["conditions"][0]["dew_point"] | float }} | |
apparent_temperature_template: >- | |
{{ state_attr("sensor.monroestead_pws_current_data", "data")["conditions"][0]["thw_index"] | float }} | |
temperature_unit: "°F" | |
wind_speed_template: >- | |
{{ state_attr("sensor.monroestead_pws_current_data", "data")["conditions"][0]["wind_speed_avg_last_1_min"] | float }} | |
wind_gust_speed_template: >- | |
{{ state_attr("sensor.monroestead_pws_current_data", "data")["conditions"][0]["wind_speed_hi_last_2_min"] | float }} | |
wind_speed_unit: mph | |
wind_bearing_template: >- | |
{{ state_attr("sensor.monroestead_pws_current_data", "data")["conditions"][0]["wind_dir_at_hi_speed_last_2_min"] }} | |
attribution_template: >- | |
Davis Vantage Vue |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Step 4: Configure individual sensors for each of the WeatherLink Live sensor values. | |
- sensor: | |
# PWS Temp/Humidity/Etc | |
- name: "Temperature" | |
unique_id: "pws_temp" | |
unit_of_measurement: "°F" | |
icon: "mdi:thermometer" | |
state_class: "measurement" | |
state: >- | |
{{ state_attr("sensor.pws_current_data", "data")["conditions"][0]["temp"] | float }} | |
- name: "Humidity" | |
unique_id: "pws_humidity" | |
unit_of_measurement: "%" | |
icon: "mdi:water-percent" | |
state_class: "measurement" | |
state: >- | |
{{ state_attr("sensor.pws_current_data", "data")["conditions"][0]["hum"] | float }} | |
- name: "Dew point" | |
unique_id: "pws_dew_point" | |
unit_of_measurement: "°F" | |
icon: "mdi:thermometer-water" | |
state_class: "measurement" | |
state: >- | |
{{ state_attr("sensor.pws_current_data", "data")["conditions"][0]["dew_point"] | float }} | |
- name: "Wet-bulb temperature" | |
unique_id: "pws_wet_bulb_temp" | |
unit_of_measurement: "°F" | |
icon: "mdi:water-thermometer" | |
state_class: "measurement" | |
state: >- | |
{{ state_attr("sensor.pws_current_data", "data")["conditions"][0]["dew_point"] | float }} | |
- name: "Heat index" | |
unique_id: "pws_heat_index" | |
unit_of_measurement: "°F" | |
icon: "mdi:sun-thermometer" | |
state_class: "measurement" | |
state: >- | |
{{ state_attr("sensor.pws_current_data", "data")["conditions"][0]["heat_index"] | float }} | |
- name: "Wind chill" | |
unique_id: "pws_wind_chill" | |
unit_of_measurement: "°F" | |
icon: "mdi:snowflake-thermometer" | |
state_class: "measurement" | |
state: >- | |
{{ state_attr("sensor.pws_current_data", "data")["conditions"][0]["wind_chill"] | float }} | |
- name: "Feels like temperature" | |
unique_id: "pws_feels_like_temp" | |
unit_of_measurement: "°F" | |
icon: "mdi:thermometer" | |
state_class: "measurement" | |
state: >- | |
{{ state_attr("sensor.pws_current_data", "data")["conditions"][0]["thw_index"] | float }} | |
# PWS Wind Speeds | |
- name: "Wind speed" | |
unique_id: "pws_wind_speed" | |
unit_of_measurement: "mph" | |
icon: "mdi:weather-windy" | |
state_class: "measurement" | |
state: >- | |
{{ state_attr("sensor.pws_current_data", "data")["conditions"][0]["wind_speed_last"] | float }} | |
- name: "Wind speed average (last 1 min)" | |
unique_id: "pws_wind_speed_avg_last_1_min" | |
unit_of_measurement: "mph" | |
icon: "mdi:weather-windy" | |
state_class: "measurement" | |
state: >- | |
{{ state_attr("sensor.pws_current_data", "data")["conditions"][0]["wind_speed_avg_last_1_min"] | float }} | |
- name: "Wind speed average (last 2 min)" | |
unique_id: "pws_wind_speed_avg_last_2_min" | |
unit_of_measurement: "mph" | |
icon: "mdi:weather-windy" | |
state_class: "measurement" | |
state: >- | |
{{ state_attr("sensor.pws_current_data", "data")["conditions"][0]["wind_speed_avg_last_2_min"] | float }} | |
- name: "Wind speed average (last 10 min)" | |
unique_id: "pws_wind_speed_avg_last_10_min" | |
unit_of_measurement: "mph" | |
icon: "mdi:weather-windy" | |
state_class: "measurement" | |
state: >- | |
{{ state_attr("sensor.pws_current_data", "data")["conditions"][0]["wind_speed_avg_last_10_min"] | float }} | |
- name: "Wind speed maximum (last 2 min)" | |
unique_id: "pws_wind_speed_max_last_2_min" | |
unit_of_measurement: "mph" | |
icon: "mdi:weather-windy" | |
state_class: "measurement" | |
state: >- | |
{{ state_attr("sensor.pws_current_data", "data")["conditions"][0]["wind_speed_hi_last_2_min"] | float }} | |
- name: "Wind speed maximum (last 10 min)" | |
unique_id: "pws_wind_speed_max_last_10_min" | |
unit_of_measurement: "mph" | |
icon: "mdi:weather-windy" | |
state_class: "measurement" | |
state: >- | |
{{ state_attr("sensor.pws_current_data", "data")["conditions"][0]["wind_speed_hi_last_10_min"] | float }} | |
# PWS Wind Directions | |
- name: "Wind direction" | |
unique_id: "pws_wind_direction" | |
icon: "mdi:windsock" | |
state: >- | |
{% set dir = state_attr("sensor.pws_current_data", "data")["conditions"][0]["wind_dir_last"] %} | |
{% if 11.25 < dir <= 33.75 %} NNE | |
{% elif 33.75 < dir <= 56.25 %} NE | |
{% elif 56.25 < dir <= 78.75 %} ENE | |
{% elif 78.75 < dir <= 101.25 %} E | |
{% elif 101.25 < dir <= 123.75 %} ESE | |
{% elif 123.75 < dir <= 146.25 %} SE | |
{% elif 146.25 < dir <= 168.75 %} SSE | |
{% elif 168.75 < dir <= 191.25 %} S | |
{% elif 191.25 < dir <= 213.75 %} SSW | |
{% elif 213.75 < dir <= 236.25 %} SW | |
{% elif 236.25 < dir <= 258.75 %} WSW | |
{% elif 258.75 < dir <= 281.25 %} W | |
{% elif 281.25 < dir <= 303.75 %} WNW | |
{% elif 303.75 < dir <= 326.25 %} NW | |
{% elif 326.25 < dir <= 348.75 %} NNW | |
{% else %} N | |
{% endif %} | |
attributes: | |
direction_degrees: >- | |
{{ state_attr("sensor.pws_current_data", "data")["conditions"][0]["wind_dir_last"] }} | |
- name: "Wind direction average (last 1 min)" | |
unique_id: "pws_wind_direction_avg_last_1_min" | |
icon: "mdi:windsock" | |
state: >- | |
{% set dir = state_attr("sensor.pws_current_data", "data")["conditions"][0]["wind_dir_scalar_avg_last_1_min"] %} | |
{% if 11.25 < dir <= 33.75 %} NNE | |
{% elif 33.75 < dir <= 56.25 %} NE | |
{% elif 56.25 < dir <= 78.75 %} ENE | |
{% elif 78.75 < dir <= 101.25 %} E | |
{% elif 101.25 < dir <= 123.75 %} ESE | |
{% elif 123.75 < dir <= 146.25 %} SE | |
{% elif 146.25 < dir <= 168.75 %} SSE | |
{% elif 168.75 < dir <= 191.25 %} S | |
{% elif 191.25 < dir <= 213.75 %} SSW | |
{% elif 213.75 < dir <= 236.25 %} SW | |
{% elif 236.25 < dir <= 258.75 %} WSW | |
{% elif 258.75 < dir <= 281.25 %} W | |
{% elif 281.25 < dir <= 303.75 %} WNW | |
{% elif 303.75 < dir <= 326.25 %} NW | |
{% elif 326.25 < dir <= 348.75 %} NNW | |
{% else %} N | |
{% endif %} | |
attributes: | |
direction_degrees: >- | |
{{ state_attr("sensor.pws_current_data", "data")["conditions"][0]["wind_dir_scalar_avg_last_1_min"] }} | |
- name: "Wind direction average (last 2 min)" | |
unique_id: "pws_wind_direction_avg_last_2_min" | |
icon: "mdi:windsock" | |
state: >- | |
{% set dir = state_attr("sensor.pws_current_data", "data")["conditions"][0]["wind_dir_scalar_avg_last_2_min"] %} | |
{% if 11.25 < dir <= 33.75 %} NNE | |
{% elif 33.75 < dir <= 56.25 %} NE | |
{% elif 56.25 < dir <= 78.75 %} ENE | |
{% elif 78.75 < dir <= 101.25 %} E | |
{% elif 101.25 < dir <= 123.75 %} ESE | |
{% elif 123.75 < dir <= 146.25 %} SE | |
{% elif 146.25 < dir <= 168.75 %} SSE | |
{% elif 168.75 < dir <= 191.25 %} S | |
{% elif 191.25 < dir <= 213.75 %} SSW | |
{% elif 213.75 < dir <= 236.25 %} SW | |
{% elif 236.25 < dir <= 258.75 %} WSW | |
{% elif 258.75 < dir <= 281.25 %} W | |
{% elif 281.25 < dir <= 303.75 %} WNW | |
{% elif 303.75 < dir <= 326.25 %} NW | |
{% elif 326.25 < dir <= 348.75 %} NNW | |
{% else %} N | |
{% endif %} | |
attributes: | |
direction_degrees: >- | |
{{ state_attr("sensor.pws_current_data", "data")["conditions"][0]["wind_dir_scalar_avg_last_2_min"] }} | |
- name: "Wind direction average (last 10 min)" | |
unique_id: "pws_wind_direction_avg_last_10_min" | |
icon: "mdi:windsock" | |
state: >- | |
{% set dir = state_attr("sensor.pws_current_data", "data")["conditions"][0]["wind_dir_scalar_avg_last_10_min"] %} | |
{% if 11.25 < dir <= 33.75 %} NNE | |
{% elif 33.75 < dir <= 56.25 %} NE | |
{% elif 56.25 < dir <= 78.75 %} ENE | |
{% elif 78.75 < dir <= 101.25 %} E | |
{% elif 101.25 < dir <= 123.75 %} ESE | |
{% elif 123.75 < dir <= 146.25 %} SE | |
{% elif 146.25 < dir <= 168.75 %} SSE | |
{% elif 168.75 < dir <= 191.25 %} S | |
{% elif 191.25 < dir <= 213.75 %} SSW | |
{% elif 213.75 < dir <= 236.25 %} SW | |
{% elif 236.25 < dir <= 258.75 %} WSW | |
{% elif 258.75 < dir <= 281.25 %} W | |
{% elif 281.25 < dir <= 303.75 %} WNW | |
{% elif 303.75 < dir <= 326.25 %} NW | |
{% elif 326.25 < dir <= 348.75 %} NNW | |
{% else %} N | |
{% endif %} | |
attributes: | |
direction_degrees: >- | |
{{ state_attr("sensor.pws_current_data", "data")["conditions"][0]["wind_dir_scalar_avg_last_10_min"] }} | |
- name: "Wind direction maximum (last 2 min)" | |
unique_id: "pws_wind_direction_max_last_2_min" | |
icon: "mdi:windsock" | |
state: >- | |
{% set dir = state_attr("sensor.pws_current_data", "data")["conditions"][0]["wind_dir_at_hi_speed_last_2_min"] %} | |
{% if 11.25 < dir <= 33.75 %} NNE | |
{% elif 33.75 < dir <= 56.25 %} NE | |
{% elif 56.25 < dir <= 78.75 %} ENE | |
{% elif 78.75 < dir <= 101.25 %} E | |
{% elif 101.25 < dir <= 123.75 %} ESE | |
{% elif 123.75 < dir <= 146.25 %} SE | |
{% elif 146.25 < dir <= 168.75 %} SSE | |
{% elif 168.75 < dir <= 191.25 %} S | |
{% elif 191.25 < dir <= 213.75 %} SSW | |
{% elif 213.75 < dir <= 236.25 %} SW | |
{% elif 236.25 < dir <= 258.75 %} WSW | |
{% elif 258.75 < dir <= 281.25 %} W | |
{% elif 281.25 < dir <= 303.75 %} WNW | |
{% elif 303.75 < dir <= 326.25 %} NW | |
{% elif 326.25 < dir <= 348.75 %} NNW | |
{% else %} N | |
{% endif %} | |
attributes: | |
direction_degrees: >- | |
{{ state_attr("sensor.pws_current_data", "data")["conditions"][0]["wind_dir_at_hi_speed_last_2_min"] }} | |
- name: "Wind direction maximum (last 10 min)" | |
unique_id: "pws_wind_direction_max_last_10_min" | |
icon: "mdi:windsock" | |
state: >- | |
{% set dir = state_attr("sensor.pws_current_data", "data")["conditions"][0]["wind_dir_at_hi_speed_last_10_min"] %} | |
{% if 11.25 < dir <= 33.75 %} NNE | |
{% elif 33.75 < dir <= 56.25 %} NE | |
{% elif 56.25 < dir <= 78.75 %} ENE | |
{% elif 78.75 < dir <= 101.25 %} E | |
{% elif 101.25 < dir <= 123.75 %} ESE | |
{% elif 123.75 < dir <= 146.25 %} SE | |
{% elif 146.25 < dir <= 168.75 %} SSE | |
{% elif 168.75 < dir <= 191.25 %} S | |
{% elif 191.25 < dir <= 213.75 %} SSW | |
{% elif 213.75 < dir <= 236.25 %} SW | |
{% elif 236.25 < dir <= 258.75 %} WSW | |
{% elif 258.75 < dir <= 281.25 %} W | |
{% elif 281.25 < dir <= 303.75 %} WNW | |
{% elif 303.75 < dir <= 326.25 %} NW | |
{% elif 326.25 < dir <= 348.75 %} NNW | |
{% else %} N | |
{% endif %} | |
attributes: | |
direction_degrees: >- | |
{{ state_attr("sensor.pws_current_data", "data")["conditions"][0]["wind_dir_at_hi_speed_last_10_min"] }} | |
# PWS Rain Data | |
# a "rain_size" value of 1 means that the rainfall data will be in units of 0.01" | |
- name: "Rainfall (Last 24 hr)" | |
unique_id: "pws_rainfall_last_24_hr" | |
unit_of_measurement: "in" | |
icon: "mdi:weather-pouring" | |
state_class: "measurement" | |
state: >- | |
{{ state_attr("sensor.pws_current_data", "data")["conditions"][0]["rainfall_last_24_hr"] | float * 0.01 }} | |
- name: "Rainfall (Last 60 min)" | |
unique_id: "pws_rainfall_last_60_min" | |
unit_of_measurement: "in" | |
icon: "mdi:weather-pouring" | |
state_class: "measurement" | |
state: >- | |
{{ state_attr("sensor.pws_current_data", "data")["conditions"][0]["rainfall_last_60_min"] | float * 0.01 }} | |
- name: "Rainfall (Last 15 min)" | |
unique_id: "pws_rainfall_last_15_min" | |
unit_of_measurement: "in" | |
icon: "mdi:weather-pouring" | |
state_class: "measurement" | |
state: >- | |
{{ state_attr("sensor.pws_current_data", "data")["conditions"][0]["rainfall_last_15_min"] | float * 0.01 }} | |
- name: "Rainfall (Today)" | |
unique_id: "pws_rainfall_today" | |
unit_of_measurement: "in" | |
icon: "mdi:weather-pouring" | |
state_class: "measurement" | |
state: >- | |
{{ state_attr("sensor.pws_current_data", "data")["conditions"][0]["rainfall_daily"] | float * 0.01 }} | |
- name: "Rainfall (This Month)" | |
unique_id: "pws_rainfall_this_month" | |
unit_of_measurement: "in" | |
icon: "mdi:weather-pouring" | |
state_class: "measurement" | |
state: >- | |
{{ state_attr("sensor.pws_current_data", "data")["conditions"][0]["rainfall_monthly"] | float * 0.01 }} | |
- name: "Rainfall (This Year)" | |
unique_id: "pws_rainfall_this_year" | |
unit_of_measurement: "in" | |
icon: "mdi:weather-pouring" | |
state_class: "measurement" | |
state: >- | |
{{ state_attr("sensor.pws_current_data", "data")["conditions"][0]["rainfall_year"] | float * 0.01 }} | |
- name: "Rain rate (latest)" | |
unique_id: "pws_rain_rate_latest" | |
unit_of_measurement: "in/hour" | |
icon: "mdi:weather-pouring" | |
state_class: "measurement" | |
state: >- | |
{{ state_attr("sensor.pws_current_data", "data")["conditions"][0]["rain_rate_last"] | float * 0.01 }} | |
- name: "Rain rate (max)" | |
unique_id: "pws_rain_rate_max" | |
unit_of_measurement: "in/hour" | |
icon: "mdi:weather-pouring" | |
state_class: "measurement" | |
state: >- | |
{{ state_attr("sensor.pws_current_data", "data")["conditions"][0]["rain_rate_hi"] | float * 0.01 }} | |
- name: "Rain rate (max in last 15 min)" | |
unique_id: "pws_rain_rate_max_last_15_min" | |
unit_of_measurement: "in/hour" | |
icon: "mdi:weather-pouring" | |
state_class: "measurement" | |
state: >- | |
{{ state_attr("sensor.pws_current_data", "data")["conditions"][0]["rain_rate_hi_last_15_min"] | float * 0.01 }} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment