Skip to content

Simple HTTP gateway that receives data from GW-1000 with Ecowitt protocol and resend data to Meteotemplate or csv, json, ecc.

Notifications You must be signed in to change notification settings

iz0qwm/ecowitt_http_gateway

Repository files navigation

ecowitt_http_gateway

Simple HTTP gateway that receives data from GW1000 with Ecowitt protocol and resend data to Meteotemplate or csv, json, ecc.
Example on: http://www.kwos.org/poggiocorese_ecowitt

Install this gateway if you have a web server at home, like a Raspberry or something where you want to store weather data

The GW1000 allows sending data both to Ecowitt.net and Wunderground, even to an external site as long as you select one of the two previous protocols.
We know the Wunderground protocol and we know that it doesn't send UV and PM2.5 data, nor ground temperature or other additional sensors, so you need to select the Ecowitt protocol.

Now to permit this script to work, we need a web server to which the GW1000 need to send data.

REQUIREMENTS
The web server must have these possibilities:

  • create a directory named /data/report (es. /var/www/html/data/report )
  • in this directory will be put the index.php file

So, the web site will look like: http://192.168.2.185/data/report/index.php
In the GW1000 configuration it will be necessary writing only the IP address, es. 192.168.1.4 and specify the update rate.

I recommend having this web server on a raspberry, in the same network of the GW1000, so the script can also be used to store data without losing them in case of Internet connection failure
When the GW1000 will contact the web site, the index.php will do these functions:

  1. creates a .JSON file in /var/log/ecowitt ( overwrited every update, contains only last data )
  2. creates a .CSV file in /var/log/ecowitt ( appended every update, contains all data )
  3. converts in metric all data a resend to a Meteotemplate web site on Internet
  4. can create and send via FTP a file for the weather station registered on Meteonetwork.it
  5. creates a weewx.txt file in /var/log/ecowitt for the ecowitt.py driver for WeeWX

HOW TO INSTALL:

  • Install Apache
  • Install PHP
  • Install jq ( for JSON query )
  • Create directory Es. /var/www/html/data/report/
  • Create /var/log/ecowitt with chmod 777
  • Put file: index.php in /var/www/html/data/report/
  • Configure index.php
  • Configure GW1000 to send data to your server

Note:
Look in /var/log/ecowitt to read fields using 'jq'
jq -r '.tempc' weather_XXXXXXXXXXXXXXXX.json

ecowitt WeeWX driver

The code has been written in Python 2.7.x. If you use Python 3, you have to convert it with 2to3 utility: https://docs.python.org/2/library/2to3.html

This driver uses the Customized Upload method of GW1000. It can be every where in the network. It doesn't use any sniffing, interception method.

Called ecowitt.py
This driver works in two modes:

  • normal: reads data from a file generated by the ecowitt_http_gateway - Usually /var/log/ecowitt/weewx.txt
    name=value pair, for example:

outTemp=79.3
barometer=29.719
pressure=29.719
outHumidity=70

  • server: open a socket server that receives directly the GW1000. Configure it in the weewx.conf
    with the IP address where the GW1000 will connect to. Configure the GW1000 with the IP and the port, put / on the path.

Automatic extension installation

Run the extension installer:

sudo wee_extension --install weewx-ecowitt-x.x.tgz

Modify weewx.conf:

[Station]
     station_type = ecowitt

Check the automatic addition at the end of weewx.conf:


[ecowitt]
     poll_interval = 65                    # number of seconds, just a little more than the GW1000 update time
     path = /var/log/ecowitt/weewx.txt     # location of data file generated by ecowitt_http_gateway used in mode=normal
     driver = weewx.drivers.ecowitt
     mode = normal                         # normal = use with ecowitt_http_gateway - server = directly connected to GW1000
     address = 192.168.2.185               # IP address of the PC where weewx is running in mode=server, to which GW1000 will connect to                
     port = 9999                           # port to which GW1000 will connect to in mode=server

Restart weewx


sudo /etc/init.d/weewx stop
sudo /etc/init.d/weewx start

Manual installation

To use this driver, put the ecowitt.py file in the weewx drivers directory (i.e. /usr/share/weewx/weewx/drivers ), then make
the following changes to weewx.conf:

[Station]
     station_type = ecowitt
[ecowitt]
     poll_interval = 65                    # number of seconds, just a little more than the GW1000 update time
     path = /var/log/ecowitt/weewx.txt     # location of data file generated by ecowitt_http_gateway
     driver = weewx.drivers.ecowitt
     mode = normal                         # normal = use with ecowitt_http_gateway - server = directly connected to GW1000
     address = 192.168.2.185               # IP address of the PC where weewx is running in mode=server, to which GW1000 will connect to                
     port = 9999                           # port to which GW1000 will connect to in mode=server

In the weewx.conf or skinf.conf use the following Labels

[Labels]
                [[Generic]]
                # Sensor status indicators
                txBatteryStatus      = WH51-Soil
                windBatteryStatus    = WS80-Temp/Wind
                rainBatteryStatus    = WH40-Rain
                outTempBatteryStatus = WH31_1-Temp/Hum
                inTempBatteryStatus  = Inside Temperature
                consBatteryVoltage   = WS80-Temp/Wind
                heatingVoltage       = WH51-Soil
                supplyVoltage        = WH40-Rain

NOTE
If you don't want to use the ecowitt_http_gateway, you can use the Interceptor driver to sniff data of your GW1000, or you can use the API broadcast methos driver that uses the same protocol used by VSView, WeeWx must stay on the same network of the GW1000.

ecowitt Meteotemplate plugin

Simple plugin for Meteotemplate, wonderful template developed by Jachym.

Install this plugin if you don't want to install the previous gateway and weewx, or if you only need to update your Meteotemplate web site. You will not store any data locally in your network

  • Download it from the repository
  • Install it in the plugin directory of your template website, just like another plugin. (put in your plugins directory only the directory called ecowitt without the version number: Meteotemplate/ecowitt_x.x/ecowitt)
  • Go in the Plugin setup page, via Admin Panel of Meteotemplate
  • Configure it
  • Configure the GW1000 with the setup you read in the Plugin page. The web server port ususally is 80

Example of plugin page Example of plugin admin page Example of plugin admin page

ecowitt Meteotemplate blocks

Remember to update the ecowitt Meteotemplate plugin to the latest version (or the index.php if you have your own webserver) Example of airquality block page Example of airquality block page

Example of modules block page Example of modules block page Example of modules block page

NOTE from the issue forum

Googling: https://fhem.de/ Is a server for home automation

If you already have a Meteotemplate webserver you can use 3 mode of uploading mode:

  1. use the Meteotemplate plugin and configure GW1000 to send data to directly.
    Follow only the section with title: ecowitt Meteotemplate plugin
    example: http://www.kwos.org/meteotemplateweb/api.php
    Note: You have all extra sensors like soilmoisture, PM25

  2. have a raspberry at home, in the internal network, with a webserver where there is the index.php
    Follow only the section with the title: ecowitt_http_gateway
    In this case you don't need the Meteotemplate plugin but you have to configure the index.php to send data via api to Meteotemplate.
    example: http//192.168.2.185/data/report/
    Note1: You have all extra sensors like soilmoisture, PM25 sent to Meteotemplate
    Note2: You can also send data to a weewx without extra sensors

  3. have a raspberry at home with weewx and weewx driver for GW1000.
    Follow both the sections: ecowitt_http_gateway and ecowitt WeeWX driver
    Then configure weewx with the Meteotemplate plugin released here:
    https://github.com/matthewwall/weewx-meteotemplate
    Note: you don't have the extra sensors

About

Simple HTTP gateway that receives data from GW-1000 with Ecowitt protocol and resend data to Meteotemplate or csv, json, ecc.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published