Capture data directly from your weatherstation

Since a month I am using Home Assistant. After reading a lot of the fragmented documentation and with some help on the forum, finally I got my Ventus W830 weatherstation connected. Data is directly send to HA!!! So this configuration does NOT require that you register your PWS to cloud accounts, like WeatherUnderground (support will finish in the near future!), Ecowitt (also displays your indoor sensors in the cloud!), WeatherCloud, WOW, etc, or the use of WeeWX (extra software).
In general, if your PWS is supplied with EasyWeather software, it is likely that the PWS will work with this configuration.

Your PWS needs to be connected to your network. This can be done by using the WS View app.

WS View (WS Tool)

If supported by your PWS, connect your PWS with WS View (and also the ‘older’ WS Tool) to your router by wifi, so that your PWS can upload weather data to Domoticz.

  1. Install WS View on your mobile device
  1. , or WS Tool
  1. Follow the instructions to connect your PWS to your router
  2. Goto to Device List in Menu and choose your PWS
  3. Click on Next untill you are on on the Customized page
  4. Choose Enable
  5. For Protocol Type Same As choose Ecowitt
  • With Ecowitt the data will be send with a POST. Wunderground is using a GET, which is not (yet) supported by a HA webhook.
  1. For Server IP / Hostname enter your HA Server ip address, eg. 192.168.0.10
  2. For Path enter: /api/webhook/pws
  3. Port enter a port number 8123
  4. Upload Interval, leave it 60 seconds
  5. Click on Save

Place the following in your configuration.yaml:

template:
  - trigger:
      - platform: webhook
        webhook_id: pws
    sensor:
      #
      # --------------------------------------------------------------------------------
      #
      # Temperature
      - name: "PWS - Temperature"
        device_class: temperature
        state: "{{ ((trigger.data.tempf | float - 32) / 1.8) | round(1) }}"
        unit_of_measurement: "°C"
      - name: "PWS - Temperature (indoor)"
        device_class: temperature
        state: "{{ ((trigger.data.tempinf | float - 32) / 1.8) | round(1) }}"
        unit_of_measurement: "°C"
      #
      # --------------------------------------------------------------------------------
      #
      # Humidity
      - name: "PWS - Humidity"
        device_class: humidity
        state: "{{ trigger.data.humidity }}"
        unit_of_measurement: "%"
      - name: "PWS - Humidity (indoor)"
        device_class: humidity
        state: "{{ trigger.data.humidityin }}"
        unit_of_measurement: "%"
      #
      # --------------------------------------------------------------------------------
      #
      # Barometer
      - name: "PWS - Barometer (relative)"
        device_class: pressure
        state: "{{ (trigger.data.baromrelin | float * 33.86) | round(1) }}"
        unit_of_measurement: "hPa"
      - name: "PWS - Barometer (absolute)"
        device_class: pressure
        state: "{{ (trigger.data.baromabsin | float * 33.86) | round(1) }}"
        unit_of_measurement: "hPa"
      #
      # --------------------------------------------------------------------------------
      #
      # Rain
      - name: "PWS - Rainrate"
        state: "{{ (trigger.data.rainratein | float * 25.4) | round(0) }}"
        unit_of_measurement: "mm/h"
      - name: "PWS - Rain"
        state: "{{ (trigger.data.dailyrainin | float * 25.4) | round(0) }}"
        unit_of_measurement: "mm"
      #
      # --------------------------------------------------------------------------------
      #
      # Sun
      - name: "PWS - Solar radiation"
        device_class: illuminance
        state: "{{ trigger.data.solarradiation }}"
        unit_of_measurement: "W/m²"
      - name: "PWS - UV"
        device_class: illuminance
        state: "{{ trigger.data.uv }}"
        unit_of_measurement: "UV Index"
      #
      # --------------------------------------------------------------------------------
      #
      # Wind
      - name: "PWS - Wind speed"
        state: "{{ (trigger.data.windspeedmph | float * 0.44704) | round(1) }}"
        unit_of_measurement: "m/s"
      - name: "PWS - Wind gust"
        state: "{{ (trigger.data.windgustmph | float * 0.44704) | round(1) }}"
        unit_of_measurement: "m/s"
      - name: "PWS - Wind direction"
        state: "{{ trigger.data.winddir }}"
        unit_of_measurement: "°"
      #
      # --------------------------------------------------------------------------------
      #
      # Misc
      - name: "PWS - Stationtype"
        state: "{{ trigger.data.stationtype }}"
        unit_of_measurement: ""
      #
      # --------------------------------------------------------------------------------
      #
      # Ecowitt does not support the extra information as with Wunderground, so lets calculate them
      #
      # Dewpoint
      #   https://www.ajdesigner.com/phphumidity/dewpoint_equation_dewpoint_temperature.php
      - name: "PWS - Dewpoint"
        state: "{{ ((trigger.data.humidity | float / 100) ** (1 / 8) * (112 + 0.9 * ((trigger.data.tempf | float - 32) / 1.8)) + 0.1 * ((trigger.data.tempf | float - 32) / 1.8) - 112) | round(1) }}"
        unit_of_measurement: "°C"

Place the following lines in the customize.yaml, to get better icons for some entities:

sensor.pws_wind_speed:
  icon: mdi:weather-windy
sensor.pws_wind_gust:
  icon: mdi:weather-windy
sensor.pws_wind_direction:
  icon: mdi:weather-windy
sensor.pws_rainrate:
  icon: mdi:weather-rainy
sensor.pws_rain:
  icon: mdi:weather-rainy

Result

Text

9 Likes

I added more possibilities. Information now available on Xorfor/HA-PWS: Capture data directly from your PWS (github.com)

3 Likes

Thank you so much. Ecowitt stopped loading with the most recent update yet this works just fine so thank yo!

1 Like

Works fine !!!

Thank you.

Works like a charm :slight_smile:

Thnx a lot!!!

Does this work with a https secured HA?
No matter what I enter @ Server IP / Hostname (https://my.ha.instance or 192.168.x.y), the webhook doesn’t get triggered.
EasyWeather version 1.6.4; configuration as in post #1, base station is connected to the internet, same subnet as HA server.
Maybe I missed something?

@Ghafla Are you sure you selected Ecowitt as protocol?

I hope so:

@Ghafla Please use for Server IP / Hostname: the ip address of your HA server, so just xxx.xxx.xxx.xxx, whithout http, etc. Your PWS should be on the same network, to send its data to HA. Be aware that it will cost 1-2 minutes before EastWeather sends data after en update of the settings.

I changed to pure IP address - still nothing.
How can I test if the webhook gets called at all?
If I check with ngrep for the weatherstation’s ip, nothing gets logged.
The station can be pinged though (from the server and even from other subnets).

@Ghafla To trigger this webhook in HA, you can try something like:

curl -X POST -d “model: ‘WS123’” http://xxx.xxx.xxx.xxx:pppp/api/webhook/pws

on you pc, where xxx.xxx.xxx.xxx is the ip address of your HA server and pppp is the port number of your HA installation (default=8123), these are also entered in WS View. Also check your url when you open HA in your browser! There you will see the same values.
I think the syntax of curl is not correct, but this will at least trigger HA.

Please check the conversion inch to mm
It should be times 25.4 (not 2.54)
Thank you

    - name: "PWS - Rainrate"
      state: "{{ (trigger.data.rainratein | float * 25.4) | round(1) }}"
      unit_of_measurement: "mm/h"
    - name: "PWS - Rain"
      state: "{{ (trigger.data.dailyrainin | float * 25.4) | round(1) }}"
      unit_of_measurement: "mm"

@yashijoe Thnx!!! You are right. On Github is was already correct. Is now also correct in this post.

1 Like

If I try http://IP:8123 or http://my.ha-instance.net:8123 I get an empty response (curl err 52: empty response) b/c HA is set up to use https.
Excerpt from configuration.yaml:

http:
  server_host: 0.0.0.0 #IPv4 only
  ssl_certificate: /sslcerts/fullchain.pem
  ssl_key: /sslcerts/privkey.pem
  cors_allowed_origins:
    - https://google.com
    - https://www.home-assistant.io
  ip_ban_enabled: false
  login_attempts_threshold: 5

HA resides in a docker container with network_mode: host, not behind a reverse proxy. Thus I have no option to reach it w/o https.

If I curl -X POST -d “model: ‘WS123’” https://my.ha-instance.net:8123/api/webhook/pws I get the errors in the log complaining about missing attributes in the JSON.
That means the webhook works (via Rest API) and your sensors apparently too.

So the (general) question remains: how do I throw the data into a SSL secured HA container?
Will I have to revert back to a (rather not rock solid) reverse-proxy setup?
Or spoof the ecowitt.net DNS to my HA instance?

Since the weather station (a WS2900 v2 btw) nicely updated the measurements to ecowitt.net but stayed reluctant to publish locally (even with a trailing slash after the webhook) I installed Ecowitt Weather Station integration for home-assistant v.0.7 via HACS and am happy now.
Maybe because it opens an own port with no full blown https webserver acting up. Anyway.
@Xorfor A pity it didn’t work your way (which is the hacky way I like) but… it’s done finally.
Thanks for your patience!

1 Like

Is there a PWS which works without an additional display? I do not need the“GUI base station“ since all can be visualized in HA…

I think this may be a good option for what you are looking for. wth3-halley: Search Result | eBay I have no experience with this model but it replaces the screen with a rf to wifi gateway, I hope it helps.

Has anyone been able to solve this with HA with SSL

Thanks in advanced

Went like a breeze (pun intended).
Thanks so much for the how too Xorfor.
Cheers Andy

1 Like