Advertisement
Guest User

Untitled

a guest
Jun 9th, 2025
42
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 13.89 KB | None | 0 0
  1. sensor:
  2. # Device Definition for the Weather Station
  3. # This sensor's primary purpose is to define the device metadata.
  4. - unique_id: weather_station_ecowitt_gateway_device_info
  5. state_topic: "ecowitt/gateway"
  6. name: "GW2000B Console Status"
  7. value_template: "Online"
  8. entity_category: "diagnostic"
  9. force_update: true
  10. device:
  11. identifiers: ["ecowitt_gateway"]
  12. name: "GW2000B Weather Station"
  13. manufacturer: "Ecowitt / Fine Offset"
  14. model: "GW2000B"
  15. # GW2000B Firmware Version Sensor
  16.  
  17. - unique_id: weather_station_gw2000b_firmware
  18. state_topic: "ecowitt/gateway"
  19. name: "GW2000B Firmware"
  20. icon: mdi:chip
  21. entity_category: "diagnostic"
  22. value_template: "{{ value.split('stationtype=')[1].split('&')[0] if 'stationtype=' in value else none }}"
  23. force_update: true
  24. device:
  25. identifiers: ["ecowitt_gateway"]
  26. # WS90 Firmware Version Sensor (Moved from device attributes)
  27.  
  28. - unique_id: weather_station_ws90_firmware
  29. state_topic: "ecowitt/gateway"
  30. name: "WS90 Firmware"
  31. icon: mdi:chip
  32. entity_category: "diagnostic"
  33. value_template: "{{ value.split('ws90_ver=')[1].split('&')[0] if 'ws90_ver=' in value else none }}"
  34. force_update: true
  35. device:
  36. identifiers: ["ecowitt_gateway"]
  37. # Individual Sensors (Value Templates Updated for Robustness)
  38.  
  39. - unique_id: weather_station_temp_indoor
  40. state_topic: "ecowitt/gateway"
  41. name: "Indoor Temperature"
  42. unit_of_measurement: "°F"
  43. device_class: temperature
  44. state_class: measurement
  45. value_template: "{{ value.split('tempinf=')[1].split('&')[0] | float(0) if 'tempinf=' in value else none }}"
  46. force_update: true
  47. device:
  48. identifiers: ["ecowitt_gateway"]
  49.  
  50. - unique_id: weather_station_humidity_indoor
  51. state_topic: "ecowitt/gateway"
  52. name: "Indoor Humidity"
  53. unit_of_measurement: "%"
  54. device_class: humidity
  55. state_class: measurement
  56. value_template: "{{ value.split('humidityin=')[1].split('&')[0] | int(0) if 'humidityin=' in value else none }}"
  57. force_update: true
  58. device:
  59. identifiers: ["ecowitt_gateway"]
  60.  
  61. - unique_id: weather_station_barom_relative
  62. state_topic: "ecowitt/gateway"
  63. name: "Barometric Pressure (Relative)"
  64. unit_of_measurement: "hPa"
  65. device_class: pressure
  66. state_class: measurement
  67. value_template: "{{ (value.split('baromrelin=')[1].split('&')[0] | float(0) * 33.8639) | round(2) if 'baromrelin=' in value else none }}"
  68. force_update: true
  69. device:
  70. identifiers: ["ecowitt_gateway"]
  71.  
  72. - unique_id: weather_station_barom_absolute
  73. state_topic: "ecowitt/gateway"
  74. name: "Barometric Pressure (Absolute)"
  75. unit_of_measurement: "hPa"
  76. device_class: pressure
  77. state_class: measurement
  78. value_template: "{{ (value.split('baromabsin=')[1].split('&')[0] | float(0) * 33.8639) | round(2) if 'baromabsin=' in value else none }}"
  79. force_update: true
  80. device:
  81. identifiers: ["ecowitt_gateway"]
  82.  
  83. - unique_id: weather_station_temp_outdoor
  84. state_topic: "ecowitt/gateway"
  85. name: "Outdoor Temperature"
  86. unit_of_measurement: "°F"
  87. device_class: temperature
  88. state_class: measurement
  89. value_template: "{{ value.split('tempf=')[1].split('&')[0] | float(0) if 'tempf=' in value else none }}"
  90. force_update: true
  91. device:
  92. identifiers: ["ecowitt_gateway"]
  93.  
  94. - unique_id: weather_station_humidity_outdoor
  95. state_topic: "ecowitt/gateway"
  96. name: "Outdoor Humidity"
  97. unit_of_measurement: "%"
  98. device_class: humidity
  99. state_class: measurement
  100. value_template: "{{ value.split('humidity=')[1].split('&')[0] | int(0) if 'humidity=' in value else none }}"
  101. force_update: true
  102. device:
  103. identifiers: ["ecowitt_gateway"]
  104.  
  105. - unique_id: weather_station_vpd
  106. state_topic: "ecowitt/gateway"
  107. name: "Vapor Pressure Deficit (VPD)"
  108. unit_of_measurement: "hPa"
  109. device_class: pressure
  110. state_class: measurement
  111. value_template: "{{ (value.split('vpd=')[1].split('&')[0] | float(0) * 33.8639) | round(2) if 'vpd=' in value else none }}"
  112. force_update: true
  113. device:
  114. identifiers: ["ecowitt_gateway"]
  115.  
  116. - unique_id: weather_station_wind_direction
  117. state_topic: "ecowitt/gateway"
  118. name: "Wind Direction"
  119. unit_of_measurement: "°"
  120. icon: mdi:compass
  121. state_class: measurement
  122. value_template: "{{ value.split('winddir=')[1].split('&')[0] | int(0) if 'winddir=' in value else none }}"
  123. force_update: true
  124. device:
  125. identifiers: ["ecowitt_gateway"]
  126.  
  127. - unique_id: weather_station_wind_speed
  128. state_topic: "ecowitt/gateway"
  129. name: "Wind Speed"
  130. unit_of_measurement: "mph"
  131. device_class: wind_speed
  132. state_class: measurement
  133. value_template: "{{ value.split('windspeedmph=')[1].split('&')[0] | float(0) if 'windspeedmph=' in value else none }}"
  134. force_update: true
  135. device:
  136. identifiers: ["ecowitt_gateway"]
  137.  
  138. - unique_id: weather_station_wind_gust
  139. state_topic: "ecowitt/gateway"
  140. name: "Wind Gust"
  141. unit_of_measurement: "mph"
  142. device_class: wind_speed
  143. state_class: measurement
  144. value_template: "{{ value.split('windgustmph=')[1].split('&')[0] | float(0) if 'windgustmph=' in value else none }}"
  145. force_update: true
  146. device:
  147. identifiers: ["ecowitt_gateway"]
  148.  
  149. - unique_id: weather_station_max_daily_gust
  150. state_topic: "ecowitt/gateway"
  151. name: "Wind Gust Daily Max"
  152. unit_of_measurement: "mph"
  153. device_class: wind_speed
  154. state_class: measurement
  155. value_template: "{{ value.split('maxdailygust=')[1].split('&')[0] | float(0) if 'maxdailygust=' in value else none }}"
  156. force_update: true
  157. device:
  158. identifiers: ["ecowitt_gateway"]
  159.  
  160. - unique_id: weather_station_solar_radiation
  161. state_topic: "ecowitt/gateway"
  162. name: "Solar Radiation"
  163. unit_of_measurement: "W/m²"
  164. device_class: irradiance
  165. state_class: measurement
  166. value_template: "{{ value.split('solarradiation=')[1].split('&')[0] | float(0) if 'solarradiation=' in value else none }}"
  167. force_update: true
  168. device:
  169. identifiers: ["ecowitt_gateway"]
  170.  
  171. - unique_id: weather_station_uv_index
  172. state_topic: "ecowitt/gateway"
  173. name: "UV Index"
  174. unit_of_measurement: ""
  175. icon: mdi:weather-sunny-alert
  176. state_class: measurement
  177. value_template: "{{ value.split('uv=')[1].split('&')[0] | int(0) if 'uv=' in value else none }}"
  178. force_update: true
  179. device:
  180. identifiers: ["ecowitt_gateway"]
  181.  
  182. - unique_id: weather_station_rain_rate
  183. state_topic: "ecowitt/gateway"
  184. name: "Rain Rate"
  185. unit_of_measurement: "in/h"
  186. device_class: precipitation_intensity
  187. state_class: measurement
  188. value_template: "{{ value.split('rrain_piezo=')[1].split('&')[0] | float(0) if 'rrain_piezo=' in value else none }}"
  189. force_update: true
  190. device:
  191. identifiers: ["ecowitt_gateway"]
  192.  
  193. - unique_id: weather_station_event_rain
  194. state_topic: "ecowitt/gateway"
  195. name: "Rain Event Total"
  196. unit_of_measurement: "in"
  197. device_class: precipitation
  198. state_class: total_increasing
  199. value_template: "{{ value.split('erain_piezo=')[1].split('&')[0] | float(0) if 'erain_piezo=' in value else none }}"
  200. force_update: true
  201. device:
  202. identifiers: ["ecowitt_gateway"]
  203.  
  204. - unique_id: weather_station_hourly_rain
  205. state_topic: "ecowitt/gateway"
  206. name: "Rain Acc. Hourly"
  207. unit_of_measurement: "in"
  208. device_class: precipitation
  209. state_class: measurement
  210. value_template: "{{ value.split('hrain_piezo=')[1].split('&')[0] | float(0) if 'hrain_piezo=' in value else none }}"
  211. force_update: true
  212. device:
  213. identifiers: ["ecowitt_gateway"]
  214.  
  215. - unique_id: weather_station_daily_rain
  216. state_topic: "ecowitt/gateway"
  217. name: "Rain Acc. Daily"
  218. unit_of_measurement: "in"
  219. device_class: precipitation
  220. state_class: total_increasing
  221. value_template: "{{ value.split('drain_piezo=')[1].split('&')[0] | float(0) if 'drain_piezo=' in value else none }}"
  222. force_update: true
  223. device:
  224. identifiers: ["ecowitt_gateway"]
  225.  
  226. - unique_id: weather_station_weekly_rain
  227. state_topic: "ecowitt/gateway"
  228. name: "Rain Acc. Weekly"
  229. unit_of_measurement: "in"
  230. device_class: precipitation
  231. state_class: total_increasing
  232. value_template: "{{ value.split('wrain_piezo=')[1].split('&')[0] | float(0) if 'wrain_piezo=' in value else none }}"
  233. force_update: true
  234. device:
  235. identifiers: ["ecowitt_gateway"]
  236.  
  237. - unique_id: weather_station_monthly_rain
  238. state_topic: "ecowitt/gateway"
  239. name: "Rain Acc. Monthly"
  240. unit_of_measurement: "in"
  241. device_class: precipitation
  242. state_class: total_increasing
  243. value_template: "{{ value.split('mrain_piezo=')[1].split('&')[0] | float(0) if 'mrain_piezo=' in value else none }}"
  244. force_update: true
  245. device:
  246. identifiers: ["ecowitt_gateway"]
  247.  
  248. - unique_id: weather_station_yearly_rain
  249. state_topic: "ecowitt/gateway"
  250. name: "Rain Acc. Yearly"
  251. unit_of_measurement: "in"
  252. device_class: precipitation
  253. state_class: total_increasing
  254. value_template: "{{ value.split('yrain_piezo=')[1].split('&')[0] | float(0) if 'yrain_piezo=' in value else none }}"
  255. force_update: true
  256. device:
  257. identifiers: ["ecowitt_gateway"]
  258.  
  259.  
  260. - unique_id: weather_station_ws90cap_volt
  261. state_topic: "ecowitt/gateway"
  262. name: "WS90 Capacitor Voltage"
  263. unit_of_measurement: "V"
  264. device_class: voltage
  265. entity_category: "diagnostic"
  266. state_class: measurement
  267. value_template: "{{ value.split('ws90cap_volt=')[1].split('&')[0] | float(0) if 'ws90cap_volt=' in value else none }}"
  268. force_update: true
  269. device:
  270. identifiers: ["ecowitt_gateway"]
  271.  
  272. - unique_id: weather_station_lightning_num
  273. state_topic: "ecowitt/gateway"
  274. name: "Lightning Strikes"
  275. unit_of_measurement: "strikes"
  276. icon: mdi:lightning-bolt
  277. state_class: total_increasing
  278. value_template: "{{ value.split('lightning_num=')[1].split('&')[0] | int(0) if 'lightning_num=' in value else none }}"
  279. force_update: true
  280. device:
  281. identifiers: ["ecowitt_gateway"]
  282.  
  283. - unique_id: weather_station_last_lightning_distance
  284. state_topic: "ecowitt/gateway"
  285. name: "Lightning Last Distance"
  286. unit_of_measurement: "mi"
  287. icon: mdi:lightning-bolt
  288. state_class: measurement
  289. value_template: >
  290. {% if 'lightning=' in value %}
  291. {{ (value.split('lightning=')[1].split('&')[0] | float(0) * 0.621371) | round(2) }}
  292. {% else %}
  293. none
  294. {% endif %}
  295. force_update: true
  296. device:
  297. identifiers: ["ecowitt_gateway"]
  298.  
  299. - unique_id: weather_station_last_lightning_time
  300. state_topic: "ecowitt/gateway"
  301. name: "Lightning Time"
  302. device_class: timestamp
  303. value_template: >
  304. {{ (value.split('lightning_time=')[1].split('&')[0] | int(0)) | timestamp_custom('%Y-%m-%dT%H:%M:%SZ', false) }}
  305. force_update: true
  306. device:
  307. identifiers: ["ecowitt_gateway"]
  308.  
  309. - unique_id: weather_station_wh57batt
  310. state_topic: "ecowitt/gateway"
  311. name: "WH57 Battery"
  312. unit_of_measurement: "V"
  313. entity_category: "diagnostic"
  314. device_class: voltage
  315. state_class: measurement
  316. value_template: "{{ value.split('wh57batt=')[1].split('&')[0] | float(0) if 'wh57batt=' in value else none }}"
  317. force_update: true
  318. device:
  319. identifiers: ["ecowitt_gateway"]
  320.  
  321. - unique_id: weather_station_wh90batt
  322. state_topic: "ecowitt/gateway"
  323. name: "WH90 Battery"
  324. unit_of_measurement: "V"
  325. device_class: voltage
  326. entity_category: "diagnostic"
  327. state_class: measurement
  328. value_template: "{{ value.split('wh90batt=')[1].split('&')[0] | float(0) if 'wh90batt=' in value else none }}"
  329. force_update: true
  330. device:
  331. identifiers: ["ecowitt_gateway"]
  332.  
  333. - unique_id: weather_station_runtime
  334. state_topic: "ecowitt/gateway"
  335. name: "Weather Station Runtime"
  336. unit_of_measurement: "s"
  337. icon: mdi:timer-sand
  338. state_class: total_increasing
  339. entity_category: "diagnostic"
  340. value_template: "{{ value.split('runtime=')[1].split('&')[0] | int(0) if 'runtime=' in value else none }}"
  341. force_update: true
  342. device:
  343. identifiers: ["ecowitt_gateway"]
  344.  
  345. - unique_id: weather_station_heap
  346. state_topic: "ecowitt/gateway"
  347. name: "Weather Station Heap"
  348. unit_of_measurement: "bytes"
  349. icon: mdi:memory
  350. state_class: measurement
  351. entity_category: "diagnostic"
  352. value_template: "{{ value.split('heap=')[1].split('&')[0] | int(0) if 'heap=' in value else none }}"
  353. force_update: true
  354. device:
  355. identifiers: ["ecowitt_gateway"]
  356.  
  357. - unique_id: weather_station_frequency
  358. state_topic: "ecowitt/gateway"
  359. name: "Frequency"
  360. entity_category: "diagnostic"
  361. icon: mdi:radio-tower
  362. value_template: "{{ value.split('freq=')[1].split('&')[0] if 'freq=' in value else none }}"
  363. force_update: true
  364. device:
  365. identifiers: ["ecowitt_gateway"]
  366.  
  367. - unique_id: weather_station_date_utc
  368. state_topic: "ecowitt/gateway"
  369. name: "Last Update"
  370. device_class: timestamp
  371. entity_category: "diagnostic"
  372. value_template: >
  373. {% if 'dateutc=' in value %}
  374. {% set dt_str = value.split('dateutc=')[1].split('&')[0] %}
  375. {% set dt_str_decoded = dt_str.replace('%20', ' ').replace('%3A', ':') %}
  376. {{ dt_str_decoded.replace(' ', 'T') ~ 'Z' }}
  377. {% else %}
  378. {{ none }}
  379. {% endif %}
  380. force_update: true
  381. device:
  382. identifiers: ["ecowitt_gateway"]
  383.  
  384. binary_sensor:
  385. - unique_id: weather_station_is_raining
  386. state_topic: "ecowitt/gateway"
  387. name: "Raining Now"
  388. device_class: moisture
  389. value_template: >
  390. {% if 'srain_piezo=' in value and value.split('srain_piezo=')[1].split('&')[0] == '1' %}
  391. ON
  392. {% else %}
  393. OFF
  394. {% endif %}
  395. force_update: true
  396. device:
  397. identifiers: ["ecowitt_gateway"]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement