Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- sensor:
- # Device Definition for the Weather Station
- # This sensor's primary purpose is to define the device metadata.
- - unique_id: weather_station_ecowitt_gateway_device_info
- state_topic: "ecowitt/gateway"
- name: "GW2000B Console Status"
- value_template: "Online"
- entity_category: "diagnostic"
- force_update: true
- device:
- identifiers: ["ecowitt_gateway"]
- name: "GW2000B Weather Station"
- manufacturer: "Ecowitt / Fine Offset"
- model: "GW2000B"
- # GW2000B Firmware Version Sensor
- - unique_id: weather_station_gw2000b_firmware
- state_topic: "ecowitt/gateway"
- name: "GW2000B Firmware"
- icon: mdi:chip
- entity_category: "diagnostic"
- value_template: "{{ value.split('stationtype=')[1].split('&')[0] if 'stationtype=' in value else none }}"
- force_update: true
- device:
- identifiers: ["ecowitt_gateway"]
- # WS90 Firmware Version Sensor (Moved from device attributes)
- - unique_id: weather_station_ws90_firmware
- state_topic: "ecowitt/gateway"
- name: "WS90 Firmware"
- icon: mdi:chip
- entity_category: "diagnostic"
- value_template: "{{ value.split('ws90_ver=')[1].split('&')[0] if 'ws90_ver=' in value else none }}"
- force_update: true
- device:
- identifiers: ["ecowitt_gateway"]
- # Individual Sensors (Value Templates Updated for Robustness)
- - unique_id: weather_station_temp_indoor
- state_topic: "ecowitt/gateway"
- name: "Indoor Temperature"
- unit_of_measurement: "°F"
- device_class: temperature
- state_class: measurement
- value_template: "{{ value.split('tempinf=')[1].split('&')[0] | float(0) if 'tempinf=' in value else none }}"
- force_update: true
- device:
- identifiers: ["ecowitt_gateway"]
- - unique_id: weather_station_humidity_indoor
- state_topic: "ecowitt/gateway"
- name: "Indoor Humidity"
- unit_of_measurement: "%"
- device_class: humidity
- state_class: measurement
- value_template: "{{ value.split('humidityin=')[1].split('&')[0] | int(0) if 'humidityin=' in value else none }}"
- force_update: true
- device:
- identifiers: ["ecowitt_gateway"]
- - unique_id: weather_station_barom_relative
- state_topic: "ecowitt/gateway"
- name: "Barometric Pressure (Relative)"
- unit_of_measurement: "hPa"
- device_class: pressure
- state_class: measurement
- value_template: "{{ (value.split('baromrelin=')[1].split('&')[0] | float(0) * 33.8639) | round(2) if 'baromrelin=' in value else none }}"
- force_update: true
- device:
- identifiers: ["ecowitt_gateway"]
- - unique_id: weather_station_barom_absolute
- state_topic: "ecowitt/gateway"
- name: "Barometric Pressure (Absolute)"
- unit_of_measurement: "hPa"
- device_class: pressure
- state_class: measurement
- value_template: "{{ (value.split('baromabsin=')[1].split('&')[0] | float(0) * 33.8639) | round(2) if 'baromabsin=' in value else none }}"
- force_update: true
- device:
- identifiers: ["ecowitt_gateway"]
- - unique_id: weather_station_temp_outdoor
- state_topic: "ecowitt/gateway"
- name: "Outdoor Temperature"
- unit_of_measurement: "°F"
- device_class: temperature
- state_class: measurement
- value_template: "{{ value.split('tempf=')[1].split('&')[0] | float(0) if 'tempf=' in value else none }}"
- force_update: true
- device:
- identifiers: ["ecowitt_gateway"]
- - unique_id: weather_station_humidity_outdoor
- state_topic: "ecowitt/gateway"
- name: "Outdoor Humidity"
- unit_of_measurement: "%"
- device_class: humidity
- state_class: measurement
- value_template: "{{ value.split('humidity=')[1].split('&')[0] | int(0) if 'humidity=' in value else none }}"
- force_update: true
- device:
- identifiers: ["ecowitt_gateway"]
- - unique_id: weather_station_vpd
- state_topic: "ecowitt/gateway"
- name: "Vapor Pressure Deficit (VPD)"
- unit_of_measurement: "hPa"
- device_class: pressure
- state_class: measurement
- value_template: "{{ (value.split('vpd=')[1].split('&')[0] | float(0) * 33.8639) | round(2) if 'vpd=' in value else none }}"
- force_update: true
- device:
- identifiers: ["ecowitt_gateway"]
- - unique_id: weather_station_wind_direction
- state_topic: "ecowitt/gateway"
- name: "Wind Direction"
- unit_of_measurement: "°"
- icon: mdi:compass
- state_class: measurement
- value_template: "{{ value.split('winddir=')[1].split('&')[0] | int(0) if 'winddir=' in value else none }}"
- force_update: true
- device:
- identifiers: ["ecowitt_gateway"]
- - unique_id: weather_station_wind_speed
- state_topic: "ecowitt/gateway"
- name: "Wind Speed"
- unit_of_measurement: "mph"
- device_class: wind_speed
- state_class: measurement
- value_template: "{{ value.split('windspeedmph=')[1].split('&')[0] | float(0) if 'windspeedmph=' in value else none }}"
- force_update: true
- device:
- identifiers: ["ecowitt_gateway"]
- - unique_id: weather_station_wind_gust
- state_topic: "ecowitt/gateway"
- name: "Wind Gust"
- unit_of_measurement: "mph"
- device_class: wind_speed
- state_class: measurement
- value_template: "{{ value.split('windgustmph=')[1].split('&')[0] | float(0) if 'windgustmph=' in value else none }}"
- force_update: true
- device:
- identifiers: ["ecowitt_gateway"]
- - unique_id: weather_station_max_daily_gust
- state_topic: "ecowitt/gateway"
- name: "Wind Gust Daily Max"
- unit_of_measurement: "mph"
- device_class: wind_speed
- state_class: measurement
- value_template: "{{ value.split('maxdailygust=')[1].split('&')[0] | float(0) if 'maxdailygust=' in value else none }}"
- force_update: true
- device:
- identifiers: ["ecowitt_gateway"]
- - unique_id: weather_station_solar_radiation
- state_topic: "ecowitt/gateway"
- name: "Solar Radiation"
- unit_of_measurement: "W/m²"
- device_class: irradiance
- state_class: measurement
- value_template: "{{ value.split('solarradiation=')[1].split('&')[0] | float(0) if 'solarradiation=' in value else none }}"
- force_update: true
- device:
- identifiers: ["ecowitt_gateway"]
- - unique_id: weather_station_uv_index
- state_topic: "ecowitt/gateway"
- name: "UV Index"
- unit_of_measurement: ""
- icon: mdi:weather-sunny-alert
- state_class: measurement
- value_template: "{{ value.split('uv=')[1].split('&')[0] | int(0) if 'uv=' in value else none }}"
- force_update: true
- device:
- identifiers: ["ecowitt_gateway"]
- - unique_id: weather_station_rain_rate
- state_topic: "ecowitt/gateway"
- name: "Rain Rate"
- unit_of_measurement: "in/h"
- device_class: precipitation_intensity
- state_class: measurement
- value_template: "{{ value.split('rrain_piezo=')[1].split('&')[0] | float(0) if 'rrain_piezo=' in value else none }}"
- force_update: true
- device:
- identifiers: ["ecowitt_gateway"]
- - unique_id: weather_station_event_rain
- state_topic: "ecowitt/gateway"
- name: "Rain Event Total"
- unit_of_measurement: "in"
- device_class: precipitation
- state_class: total_increasing
- value_template: "{{ value.split('erain_piezo=')[1].split('&')[0] | float(0) if 'erain_piezo=' in value else none }}"
- force_update: true
- device:
- identifiers: ["ecowitt_gateway"]
- - unique_id: weather_station_hourly_rain
- state_topic: "ecowitt/gateway"
- name: "Rain Acc. Hourly"
- unit_of_measurement: "in"
- device_class: precipitation
- state_class: measurement
- value_template: "{{ value.split('hrain_piezo=')[1].split('&')[0] | float(0) if 'hrain_piezo=' in value else none }}"
- force_update: true
- device:
- identifiers: ["ecowitt_gateway"]
- - unique_id: weather_station_daily_rain
- state_topic: "ecowitt/gateway"
- name: "Rain Acc. Daily"
- unit_of_measurement: "in"
- device_class: precipitation
- state_class: total_increasing
- value_template: "{{ value.split('drain_piezo=')[1].split('&')[0] | float(0) if 'drain_piezo=' in value else none }}"
- force_update: true
- device:
- identifiers: ["ecowitt_gateway"]
- - unique_id: weather_station_weekly_rain
- state_topic: "ecowitt/gateway"
- name: "Rain Acc. Weekly"
- unit_of_measurement: "in"
- device_class: precipitation
- state_class: total_increasing
- value_template: "{{ value.split('wrain_piezo=')[1].split('&')[0] | float(0) if 'wrain_piezo=' in value else none }}"
- force_update: true
- device:
- identifiers: ["ecowitt_gateway"]
- - unique_id: weather_station_monthly_rain
- state_topic: "ecowitt/gateway"
- name: "Rain Acc. Monthly"
- unit_of_measurement: "in"
- device_class: precipitation
- state_class: total_increasing
- value_template: "{{ value.split('mrain_piezo=')[1].split('&')[0] | float(0) if 'mrain_piezo=' in value else none }}"
- force_update: true
- device:
- identifiers: ["ecowitt_gateway"]
- - unique_id: weather_station_yearly_rain
- state_topic: "ecowitt/gateway"
- name: "Rain Acc. Yearly"
- unit_of_measurement: "in"
- device_class: precipitation
- state_class: total_increasing
- value_template: "{{ value.split('yrain_piezo=')[1].split('&')[0] | float(0) if 'yrain_piezo=' in value else none }}"
- force_update: true
- device:
- identifiers: ["ecowitt_gateway"]
- - unique_id: weather_station_ws90cap_volt
- state_topic: "ecowitt/gateway"
- name: "WS90 Capacitor Voltage"
- unit_of_measurement: "V"
- device_class: voltage
- entity_category: "diagnostic"
- state_class: measurement
- value_template: "{{ value.split('ws90cap_volt=')[1].split('&')[0] | float(0) if 'ws90cap_volt=' in value else none }}"
- force_update: true
- device:
- identifiers: ["ecowitt_gateway"]
- - unique_id: weather_station_lightning_num
- state_topic: "ecowitt/gateway"
- name: "Lightning Strikes"
- unit_of_measurement: "strikes"
- icon: mdi:lightning-bolt
- state_class: total_increasing
- value_template: "{{ value.split('lightning_num=')[1].split('&')[0] | int(0) if 'lightning_num=' in value else none }}"
- force_update: true
- device:
- identifiers: ["ecowitt_gateway"]
- - unique_id: weather_station_last_lightning_distance
- state_topic: "ecowitt/gateway"
- name: "Lightning Last Distance"
- unit_of_measurement: "mi"
- icon: mdi:lightning-bolt
- state_class: measurement
- value_template: >
- {% if 'lightning=' in value %}
- {{ (value.split('lightning=')[1].split('&')[0] | float(0) * 0.621371) | round(2) }}
- {% else %}
- none
- {% endif %}
- force_update: true
- device:
- identifiers: ["ecowitt_gateway"]
- - unique_id: weather_station_last_lightning_time
- state_topic: "ecowitt/gateway"
- name: "Lightning Time"
- device_class: timestamp
- value_template: >
- {{ (value.split('lightning_time=')[1].split('&')[0] | int(0)) | timestamp_custom('%Y-%m-%dT%H:%M:%SZ', false) }}
- force_update: true
- device:
- identifiers: ["ecowitt_gateway"]
- - unique_id: weather_station_wh57batt
- state_topic: "ecowitt/gateway"
- name: "WH57 Battery"
- unit_of_measurement: "V"
- entity_category: "diagnostic"
- device_class: voltage
- state_class: measurement
- value_template: "{{ value.split('wh57batt=')[1].split('&')[0] | float(0) if 'wh57batt=' in value else none }}"
- force_update: true
- device:
- identifiers: ["ecowitt_gateway"]
- - unique_id: weather_station_wh90batt
- state_topic: "ecowitt/gateway"
- name: "WH90 Battery"
- unit_of_measurement: "V"
- device_class: voltage
- entity_category: "diagnostic"
- state_class: measurement
- value_template: "{{ value.split('wh90batt=')[1].split('&')[0] | float(0) if 'wh90batt=' in value else none }}"
- force_update: true
- device:
- identifiers: ["ecowitt_gateway"]
- - unique_id: weather_station_runtime
- state_topic: "ecowitt/gateway"
- name: "Weather Station Runtime"
- unit_of_measurement: "s"
- icon: mdi:timer-sand
- state_class: total_increasing
- entity_category: "diagnostic"
- value_template: "{{ value.split('runtime=')[1].split('&')[0] | int(0) if 'runtime=' in value else none }}"
- force_update: true
- device:
- identifiers: ["ecowitt_gateway"]
- - unique_id: weather_station_heap
- state_topic: "ecowitt/gateway"
- name: "Weather Station Heap"
- unit_of_measurement: "bytes"
- icon: mdi:memory
- state_class: measurement
- entity_category: "diagnostic"
- value_template: "{{ value.split('heap=')[1].split('&')[0] | int(0) if 'heap=' in value else none }}"
- force_update: true
- device:
- identifiers: ["ecowitt_gateway"]
- - unique_id: weather_station_frequency
- state_topic: "ecowitt/gateway"
- name: "Frequency"
- entity_category: "diagnostic"
- icon: mdi:radio-tower
- value_template: "{{ value.split('freq=')[1].split('&')[0] if 'freq=' in value else none }}"
- force_update: true
- device:
- identifiers: ["ecowitt_gateway"]
- - unique_id: weather_station_date_utc
- state_topic: "ecowitt/gateway"
- name: "Last Update"
- device_class: timestamp
- entity_category: "diagnostic"
- value_template: >
- {% if 'dateutc=' in value %}
- {% set dt_str = value.split('dateutc=')[1].split('&')[0] %}
- {% set dt_str_decoded = dt_str.replace('%20', ' ').replace('%3A', ':') %}
- {{ dt_str_decoded.replace(' ', 'T') ~ 'Z' }}
- {% else %}
- {{ none }}
- {% endif %}
- force_update: true
- device:
- identifiers: ["ecowitt_gateway"]
- binary_sensor:
- - unique_id: weather_station_is_raining
- state_topic: "ecowitt/gateway"
- name: "Raining Now"
- device_class: moisture
- value_template: >
- {% if 'srain_piezo=' in value and value.split('srain_piezo=')[1].split('&')[0] == '1' %}
- ON
- {% else %}
- OFF
- {% endif %}
- force_update: true
- device:
- identifiers: ["ecowitt_gateway"]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement