Skip to content

Using as a service

gary edited this page Aug 9, 2023 · 3 revisions

Using the Ecowitt gateway driver as a WeeWX service

Introduction

Most users will likely use the Ecowitt gateway driver as a driver to provide WeeWX with regular loop packets. Users with more than one station may choose to operate multiple WeeWX instances with each instance using a driver appropriate to the station concerned. However, in some cases the user may wish to operate a single WeeWX instance fed by multiple stations. Since any given WeeWX instance can only have a single driver, such installations must use one or more data services to obtain data from the station(s) not using a driver.

To this end the Ecowitt gateway driver has been developed to operate as either a WeeWX driver or as a WeeWX data service.

Using the Ecowitt gateway driver as a WeeWX service

To use the Ecowitt gateway driver as a WeeWX service:

  1. Install and configure WeeWX to use either the 'simulator' or another driver of your choice. Refer to https://weewx.com/docs/usersguide.htm#installing.

  2. Install the Ecowitt gateway driver using the wee_extension utility as follows:

    • Download the Ecowitt gateway driver extension package:

      $ wget -P /var/tmp https://github.com/gjr80/weewx-gw1000/releases/download/v0.6.0b2/gw1000-0.6.0b2.tar.gz
      
    • Install the Ecowitt gateway driver extension:

      $ wee_extension --install=/var/tmp/gw1000-0.6.0b2.tar.gz
      

      Note: Depending on your system/installation, the above command may need to be prefixed with sudo.

      Note: Depending on your WeeWX installation, wee_extension may need to be prefixed with the path to wee_extension.

  3. Edit weewx.conf:

    • confirm that a [GW1000] stanza exists as follows:

      [GW1000]
          # This section is for the Ecowitt Gateway driver.
          ip_address = xxx.xxx.xxx.xxx
          poll_interval = yy
      

      where xxx.xxx.xxx.xxx is the IP address of the Ecowitt gateway device to be used and yy is the poll interval in seconds. Add the [GW1000] stanza if it does not exist.

      Note: The Ecowitt gateway driver can use discovery to identify Ecowitt gateway devices on the same subnet used by the WeeWX machine. However, experience has shown such discovery to be fragile and at times Ecowitt gateway devices are not located. The recommended approach is to specify a fixed IP address for the Ecowitt gateway device concerned using the ip_address config option.

      Note: The Ecowitt gateway device will be polled using the interval (in seconds) specified by the optional poll_interval config option. If poll_interval is not specified the Ecowitt gateway device will be polled every 20 seconds.

      Note: Other config options may be used as per the Available config options wiki page.

    • under the [Engine] [[Services]] stanza add an entry user.gw1000.Gw1000Service to the data_services option. It should look something like:

      [Engine]
          [[Services]]
              ....
              data_services = user.gw1000.GatewayService
      

      or if there is already one or more data_services entries:

      [Engine]
          [[Services]]
              ....
              data_services = some.other.data_service, user.gw1000.GatewayService
      
  4. Test the Ecowitt gateway driver service by running the driver file directly using the --test-service command line option:

    $ PYTHONPATH=/home/weewx/bin python -m user.gw1000 --test-service
    

    for WeeWX setup.py installs or for WeeWX package installs use:

    $ PYTHONPATH=/usr/share/weewx python -m user.gw1000 --test-service
    

    Note: Whilst the driver file may be run independently of WeeWX, WeeWX and it's dependencies be must be installed. Consequently, if WeeWX 4.0.0 or later is installed the driver must be run under the same Python version as used by WeeWX. This may be different to the Python version invoked by the command python. This means that on some systems python in the above commands may need to be changed to python2 or python3.

    Note: If necessary you can specify the gateway device IP address using the --ip-address command line option. Such an IP address will override any IP address specified in the [GW1000] stanza in weewx.conf. Refer to the Ecowitt gateway driver help by using the --help command line option for further information.

    You should observe regular simulated loop packets augmented with data from the Ecowitt gateway device being used. Once finished press ctrl-c to exit.

    Note: The loop packets displayed consist of a sample loop packet with minimal fields augmented by actual data obtained from the Ecowitt gateway device. The driver specified in weewx.conf is not used.

    Note: You will only see loop packets and not archive records when running the driver directly with the --test-service command line option. This is because you are seeing sample driver data augmented with Ecowitt gateway driver data rather than WeeWX output.

  5. You may choose to run WeeWX directly to observe the loop packets and archive records generated by WeeWX. The loop packets and archive records will consist of data from the driver specified in weewx.conf augmented by data from the Ecowitt gateway driver service.

    Note: Depending on the frequency of the loop packets emitted by the in-use driver and the polling interval of the Ecowitt gateway driver service, it is possible that not all loop packets will include Ecowitt gateway device data. However, all archive records should include Ecowitt gateway device data.

  6. Once satisfied that the Ecowitt gateway driver service is operating correctly you can start the WeeWX daemon:

    $ sudo /etc/init.d/weewx start
    

    or

    $ sudo service weewx start
    

    or

    $ sudo systemctl start weewx
    
  7. WeeWX should now generate loop packets and archive records that include data from the Ecowitt gateway device.

    Note: Depending on the frequency of the loop packets emitted by the in-use driver and the polling interval of the Ecowitt gateway driver service, it is possible that not all loop packets will include Ecowitt gateway device data. However, all archive records should include Ecowitt gateway device data.