Recording External Temperatures

98 views
Skip to first unread message

Mike Revitt

unread,
Jan 13, 2021, 4:07:23 AM1/13/21
to weewx-user
In my never ending quest to extend WeeWX, I have purchased Ann Ecowitt weather station and set it up so that it records the temperature in my Caravan. This works perfectly but records the data on the Ecowitt website.

I have now managed to extend this to publish the weather stats into a directory on my Raspberry PI where WeeWX runs and intend to add another user extension to read this and upload it to extraTemp2 and if I can find a way will also record the humidity.

The question is this, currently I record my Raspberry PI CPU temperature using event.record['extraTemp1'] = cpu.temperature and I guess the current time is used as the timestamp, but Ecowitt records the temperature every 60 seconds, so is there a way to add the record and give it a timestamp at the same time.

Also any suggestions on where to store the humidity as this is possibly more important than the temperature

Then it is a simple task of reading all files in the directory and processing them

Thanks in advance

steep...@gmail.com

unread,
Jan 13, 2021, 4:25:18 AM1/13/21
to weewx...@googlegroups.com

Have you seen this extension for the Ecowitt API? Excellent implementation that may save you a lot of time.

 

https://github.com/gjr80/weewx-gw1000

 

Sent from Mail for Windows 10

--
You received this message because you are subscribed to the Google Groups "weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to weewx-user+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/0b5e4eae-7fd1-46b7-b736-cc34867a5eddn%40googlegroups.com.

 

Mike Revitt

unread,
Jan 13, 2021, 4:37:06 AM1/13/21
to weewx-user
I have seen that thanks, but I already run a Vantage Vue and didn't think you could read data from 2 data sources as part of the main engine

steep...@gmail.com

unread,
Jan 13, 2021, 5:08:47 AM1/13/21
to weewx...@googlegroups.com

You can only run one driver, however weewx-gw1000 can also be run as a service. Quote from the repository: -

 

              ‘The GW1000 driver can be operated as a traditional WeeWX driver where it is the source of loop data or it can be operated as a WeeWX service where it is used to augment loop data produced by another driver’.

Mike Revitt

unread,
Jan 13, 2021, 6:09:29 AM1/13/21
to weewx-user
That sounds interesting, is there some documentation that shows how to control where the data goes when running it as a service?

steep...@gmail.com

unread,
Jan 13, 2021, 6:41:37 AM1/13/21
to weewx...@googlegroups.com

Have a look at the wiki https://github.com/gjr80/weewx-gw1000/wiki which tells you how to setup as a service. Regarding data my personal suggestion would be to create an additional database for Ecowitt and bind to that. You could then pull data from each database as and when you require it, even integrate the two sets of database into one website.

vince

unread,
Jan 13, 2021, 1:45:37 PM1/13/21
to weewx-user
On Wednesday, January 13, 2021 at 3:09:29 AM UTC-8 mi...@cougar.eu.com wrote:
That sounds interesting, is there some documentation that shows how to control where the data goes when running it as a service?



Here's the mapping I use as a driver, FWIW.   Works great.   You'd probably want to also override the inside temp and inside humidity items to extraTempN and extraHumidN for your scenario where you want the Ecowitt items to add to your Davis measurements.  Maybe more items such as the battery status as I did below.

I'd lean toward disagree with Ian's suggestion to use a secondary db, as it's not really needed, but there are lots of ways to get there.

I specify the gateway ip address since it's on a different subnet than the weewx pi.

# Options for 'GW1000'
[GW1000]
    driver = user.gw1000
    ip_address = 192.168.2.20
    port = 45000
    poll_interval = 20

    #--- the defaults map inTemp, inHumidity, outTemp, outHumidity
    #--- and the extraTemp1-8 and soilMostN items automagically
    #--- but we need to add the battery status mappings
    [[field_map_extensions]]
        # outTemp
        outTempBatteryStatus = wh26_batt
        # extraTemp1-8
        batteryStatus1 = wh31_ch1_batt
        batteryStatus2 = wh31_ch2_batt
        # soilMost1 = channel autoselects on first use
        batteryStatus8 = wh51_ch1_batt



Mike Revitt

unread,
Jan 15, 2021, 4:56:13 AM1/15/21
to weewx-user
Thank you both for your advice and input.

In the end I have taken a bit of advice from both you you and some other information I found online, and in the interests of keeping things simple have managed to get my Ecowitt uploading data files to a directory on the raspberry Pi and have written a small python script that reads these and inserts them into the database, and this is run as a service very similar to the way I insert the CPU temperature

One thing I am keen to try is using the config file to define the directory as you show above Vince, but that will have to wait till I have time to experiment on my "spare" raspberry Pi. Not trying that on my live system. So for the time being the directory is defined as a constant

steeple ian

unread,
Jan 15, 2021, 5:25:03 AM1/15/21
to weewx...@googlegroups.com
Mike,
I would be very interested to see that code you have written to insert data into the database. I am currently using FilePile but always interested in looking at alternative ways. 
Ian

--
You received this message because you are subscribed to the Google Groups "weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to weewx-user+...@googlegroups.com.

Mike Revitt

unread,
Jan 15, 2021, 8:11:12 AM1/15/21
to weewx-user
This is the service that I wrote and I put it in bin/user, I plan to write this up when I get the. time but this will give you an idea of how I add the service.

My Ecowitt uploads to /var/www/html/ecowitt

I then read every file in the directory, deleting all but the most recent which I then read

I parse the file and insert the data into the database fields, and as there is not a extraHumid3 I used extraHumid1 instead.

Hope this helps

ecowitt.py

vince

unread,
Jan 15, 2021, 12:41:03 PM1/15/21
to weewx-user
On Friday, January 15, 2021 at 1:56:13 AM UTC-8 mi...@cougar.eu.com wrote:
One thing I am keen to try is using the config file to define the directory as you show above Vince, but that will have to wait till I have time to experiment on my "spare" raspberry Pi. Not trying that on my live system. So for the time being the directory is defined as a constant


This is a good example of why running a virtualized weewx is great.   You could spin up a quick Vagrant/VirtualBox VM using the Simulator driver and add your draft extension to it.   No need for a spare pi.   Get everything working and then add/update your custom code on your production (so to speak) pi.

My Vagrant configs for centos7/8, debian10, ubuntu1804/2004 are on GitHub if you wanted those for either pre-packaged or setup.py variants.   The provisioner scripts can also be used standalone to add weewx to a base os of that flavor.  Might be worth a look.


Mike Revitt

unread,
Jan 16, 2021, 8:55:11 AM1/16/21
to weewx-user
Great idea Vince,

I used to use Virtual Box all the time but these days tend to spin up EC2 hosts, but hadn't even thought of that for WeeWX testing, so definitely going to give that a go

And as I know a few have asked, I have finished documenting what I did here

vince

unread,
Jan 16, 2021, 1:04:27 PM1/16/21
to weewx-user
On Saturday, January 16, 2021 at 5:55:11 AM UTC-8 mi...@cougar.eu.com wrote:
I used to use Virtual Box all the time but these days tend to spin up EC2 hosts, but hadn't even thought of that for WeeWX testing, so definitely going to give that a go

Yup.  You could probably use the provisioner scripts I have in my repo as a userdata script in EC2 or Lightsail.   I'd do it via Terraform but there are many ways of course.

Nice thing about Vagrant/VirtualBox is that once you have those two packages installed and have cloned my repo, it's just "vagrant up" to boot+configure a VM, and "vagrant destroy" to delete them. 

Mike Revitt

unread,
Jan 16, 2021, 2:05:40 PM1/16/21
to weewx-user
I tend to use Cloud Formation with a User Data script. If I can get it working I will share the template on here
Reply all
Reply to author
Forward
0 new messages