Weather Station Data

And it eliminates more mqtt, a winner :slight_smile:

1 Like

User guide for making weather station via MQTT workā€¦

Home Assistant:

Weather station via WeewX:
ws1
ws2

1 STEP:
Set up weather station to the same network as WeewX will be set up and Home Assistant.
To set up EasyWeather use software: WS View



If data is sended to Weather Underground, then weather station is set upā€¦ Donā€™t worry, latter you can delete WU accountā€¦

2 STEP:
Set up router DNAT forwarding. To do this under EdgeRouter look pictures downā€¦ In other routers just use the same ports and of course your IP settingsā€¦


3 STEP:
Install Raspbian to the new docker station or to Raspberry Pi 2, 3 etcā€¦
Download link: https://www.raspberrypi.org/downloads/raspbian/
(use: Raspbian Buster with desktop and recommended software)

4 STEP:
Set up weewX on Raspbian OS.
User guide: http://www.weewx.com/docs/debian.htm

Before of use my backup files itā€™s good to install:
1: Install weewx, select ā€˜Simulatorā€™ driver
http://weewx.com/docs/usersguide.htm#installing
2: Download the interceptor driver
wget -O weewx-interceptor.zip https://github.com/matthewwall/weewx-interceptor/archive/master.zip
3: Install the driver (at installation choose simulator mode)
sudo wee_extension --install weewx-interceptor.zip
4: Configure the driver
sudo wee_config --reconfigure --driver=user.interceptor --no-prompt
5: Start weewx
sudo /etc/init.d/weewx start

You can download my predefined and ready-to-use WeewX backupā€¦ Just rewrite files and run weewX via Terminal commandā€¦ Also change IP, username etcā€¦ where data is sended via MQTT procotolā€¦

Files are located under: /etc/weewx

My complete weewX folder: https://gofile.io/?c=ZoqAsN
(ZIP password: home)

For copying use commandā€¦
gksudo in Terminal
pcmanfm on the Run text field. Pressing ok.

5 STEP:

Setup web serverā€¦ After 5 minutes you should have data in web site of raspberry where weewx runsā€¦

If the server is on the same machine

The reports generated by WeeWX can be served by a web server running on the same computer as WeeWX. These are instructions for making WeeWX reports available via the Apache web server. The process is similar for other web servers such as nginx or lighthttpd.

Install the Apache web server on the computer on which WeeWX is running. For example, on Debian systems:

sudo apt-get install apache2

Configure Apache to see the WeeWX reports.

    If WeeWX was installed from DEB or RPM package, no configuration should be necessary since the reports are placed in the directory /var/www/html/weewx, which is in the Apache DocumentRoot directory /var/www/html

    If WeeWX was installed using setup.py, you must tell Apache where to find the WeeWX reports. One method is to install an Apache configuration snippet:

    sudo cp util/apache/conf.d/weewx.conf /etc/apache2/conf.d

    Be sure that the path in the Apache configuration snippet matches the HTML_ROOT defined in the WeeWX configuration file. For example, the path for a default setup.py installation would look like this:

    Alias /weewx /home/weewx/public_html
    <Directory /home/weewx/public_html>
        Options FollowSymlinks
        AllowOverride None
    </Directory>

    Restart Apache to make the changes happen:

    sudo /etc/init.d/apache2 restart

Open the WeeWX URL in a web browser:

http://localhost/weewx

6 STEP:

After copying, set up your data, so edit file under weewx:
weewx.conf

To change desired port:
slika

To set up MQTT, so that data will be sended to Home Assistant. Also here you can set if you still want to receive data in WUnderground etcā€¦
slika

7 STEP:

At the end make backup for just in case of making some restoreā€¦
User guide: https://www.raspberrypi.org/magpi/back-up-raspberry-pi/

8 STEP:

Now itā€™s time to set up Home Assistantā€¦

My sensors, so that in lovelace looks like it looks:
sensor.relativna_vlaznost
sensor.pritisk
sensor.pritisk_visinomer
sensor.stopnja_padavin
sensor.stopnja_padavin_zadnja_ura
sensor.padavine_danes
sensor.soncno_sevanje
sensor.uv
sensor.temperatura
sensor.sunek_vetra
sensor.smer_vetra
sensor.hitrost_vetra

My code:

  - platform: mqtt
    name: "Relativna vlažnost"
    icon: mdi:water-percent
    state_topic: "weather/outHumidity"
    value_template: '{{ value | round(0) }}'
    unit_of_measurement: "%"

  - platform: mqtt
    name: "Pritisk (viŔinomer)"
    icon: mdi:gauge
    state_topic: "weather/altimeter_mbar"
    value_template: '{{ value | round(0) }}'
    unit_of_measurement: "mBar"

  - platform: mqtt
    name: "Pritisk"
    icon: mdi:gauge
    state_topic: "weather/pressure_mbar"
    value_template: '{{ value | round(0) }}'
    unit_of_measurement: "mBar"

  - platform: mqtt
    name: "Stopnja padavin"
    icon: mdi:umbrella-outline
    state_topic: "weather/rainRate_cm_per_hour"
    value_template: '{{ value | round(0) }}'
    unit_of_measurement: "mm/h"

  - platform: mqtt
    name: "Stopnja padavin (zadnja ura)"
    icon: mdi:umbrella
    state_topic: "weather/hourRain_cm"
    value_template: '{{ value | round(0) }}'
    unit_of_measurement: "mm/h"

  - platform: mqtt
    name: "Padavine (danes)"
    icon: mdi:umbrella
    state_topic: "weather/rain24_cm"
    value_template: '{{ value | round(0) }}'
    unit_of_measurement: "mm"

  - platform: mqtt
    name: "Temperatura"
    state_topic: "weather/outTemp_C"
    value_template: '{{ value | round(1) }}'
    unit_of_measurement: "Ā°C"

  - platform: mqtt
    name: "Sončno sevanje"
    icon: mdi:radioactive
    state_topic: "weather/radiation_Wpm2"
    value_template: '{{ value | round(1) }}'
    unit_of_measurement: "watts/mĀ²"

  - platform: mqtt
    name: "UV"
    icon: mdi:sunglasses
    state_topic: "weather/UV"
    value_template: '{{ value | round(1) }}'
    unit_of_measurement: "index"

  - platform: mqtt
    name: "Hitrost vetra"
    icon: mdi:weather-windy
    state_topic: "weather/windSpeed_kph"
    value_template: '{{ value | round(1) }}'
    unit_of_measurement: "km/h"

  - platform: mqtt
    name: "Sunek vetra"
    icon: mdi:weather-windy-variant
    state_topic: "weather/windGust_kph"
    value_template: '{{ value | round(1) }}'
    unit_of_measurement: "km/h"

  - platform: mqtt
    name: "Smer vetra"
    icon: mdi:wind-turbine
    state_topic: "weather/windDir"
    value_template: '{{ value | round(1) }}'
    unit_of_measurement: "Ā°"

Code for notify in case of high UV:

- id: '709'
  alias: VREME - visoka vrednost UV sevanja
  trigger:
    platform: numeric_state
    entity_id: sensor.uv
    above: '8'
    for:
      minutes: 15
  action:
      - service: notify.MY_DEVICE
        data:
          message: "Zaznana visoka vrednost UV sevanja - vrednost UV nad 8 od skupaj možnih 16."
          title: "VREME - UV sevanje"
      - service: notify.MY_OTHER_DEVICE
        data:
          message: "Zaznana visoka vrednost UV sevanja - vrednost UV nad 8 od skupaj možnih 16."
          title: "VREME - UV sevanje"

Some useful links:




https://jackstromberg.com/2018/06/setting-up-weewx-with-a-raspberry-pi/
http://weewx.com/docs/usersguide.htm
http://weewx.com/docs/debian.htm

Enjoyā€¦

10 Likes

Had a similar issue, and couldnā€™t get weewx to work, so I used node-red insteadā€¦

1 Like

If you want I can give you Virtualization station which can be used in QNAP or VMWare Player etcā€¦ you should only set up MQTT data and IP of Raspbian OS and voilaā€¦

Database can be used as MySQL on external server or local - based on settingsā€¦

Iā€™m using on MySQL on QNAP NASā€¦

hi,thanks for ur work,are your files no longer available
?

It would be great to have an addon or an integration in hacs for weewx, nobody knows something?

I can republish filesā€¦ if you need I can give you complete Image for QNAP NAS with complete working ecosystemā€¦

1 Like

Thanks again, im using the old hassio in docker with Ubuntu, Iā€™m not sure if it will work for me

Hi, I would like to give this a go! I checked and the files you uploaded are no longer there also I do have a QNAP as well as a Synology. I am currently running HA in a Container on the Synology I was running WeeWx on a Pi 4 and getting the data from a Davis IP Data Logger.
I would like to get HA and WeeWx running on the same box either in a container or VM.
Thanks for your help !
Mark

Today I will prepeare fileā€¦ Sorry for delay, I was awayā€¦

Hi Were you able to get to this? Thanks.

Prepearing fileā€¦ Will publish download link tommorowā€¦

Hi, now I managed to prepeare file and file server, so that you can download it.

So, open website:
www.vseznalec.si
Username:
homeassistant
Password:
virtualclone2020_weeWX%

For your access click on ā€œhomeassistantā€ folder.

Then you can download image. Also when you will set up virtual station on QNAP you will find instructions.txt on desktop in virtual machine.

I hope that you will succed.

Got it! Thanks kslb!

Hey guys do I have this idea right about this code on Github I noticed ?
Iā€™m not a coder of any note but this python code on Github seems to me to create a destination for any Ecowitt protocol compliant WiFi weather station like WH2900 or WS-2902 (and obviously the Ecowitt GW1000 gateway) on a RPi of to send data to, and then creates a .CSV file with the sent data ?

If thatā€™s right, is it possible to get HA to look for the .CSV file updates and read the new station sensor values ?
https://github.com/iz0qwm/ecowitt_http_gateway/blob/2628beaee63d78c14a38de780024c71bb1deeb48/README.md

Why to use CSV if you can use weeWX MQTT protocol?

I donā€™t like MQTT, got burned badly when changes where made for bureaucratic reasons, that screwed my sensors setup and caused me a LOT of rework and forced cludges at the time. Once bitten twice shy, so wonā€™t go there again, changed 90% of ESP devices from relying on MQTT to ESPhome and love it.

Hello kslb the code it is possible insert in a package file?
like this:

sensor:

- platform: mqtt
    name: "Relativna vlažnost"
    icon: mdi:water-percent
    state_topic: "weather/outHumidity"
    value_template: '{{ value | round(0) }}'
    unit_of_measurement: "%"

In which package file? I do not quite understand your questionā€¦

It is ok now, all code in package and work! thank you