Can I subscribe to weatherdata?

42 views
Skip to first unread message

Rainer Halanek

unread,
Feb 4, 2021, 11:35:31 AM2/4/21
to weewx-user
Hi,
I want that in a certain weather condition, e.g. wind > 50 km/h I switch a relais to turn something on or off. To write the code for switching the realais, I have everything I need. But this code needs as an input the wind speed. Can my program somehow subscribe to Weewx and get the wind data constantly?
Thanks, Rainer

vince

unread,
Feb 4, 2021, 11:50:54 AM2/4/21
to weewx-user
Output your data to MQTT and have your code subscribe to MQTT for that topic.

michael.k...@gmx.at

unread,
Feb 4, 2021, 11:52:47 AM2/4/21
to weewx-user
You can install https://github.com/weewx/weewx/wiki/mqtt and subscribe to e.g. weather/loop (or whatever your topic is) and extract windSpeed. You will receive windSpeed every time your hardware send loop data to weewx. With my WS-2810 this would be about every 3 seconds, my weatherflow tempest provides windSpeed every 3 seconds. Your switching device need to be mqtt enabled, you need a broker as well.
Other than that there are several other ways to let weewx do something when specific loop data arrives.

Rainer Halanek

unread,
Feb 4, 2021, 12:24:20 PM2/4/21
to weewx-user
Thanks for the quick and very helpful answers!

Cheers, Rainer

michael.k...@gmx.at

unread,
Feb 4, 2021, 12:39:27 PM2/4/21
to weewx-user
"With my WS-2810 this would be about every 3 seconds" => make that 30 seconds :) 
Reply all
Reply to author
Forward
0 new messages