Database binding to get non-weather data.

51 views
Skip to first unread message

Peter Fletcher

unread,
Jul 15, 2025, 4:09:57 PMJul 15
to weewx-development
I have real-time data from my PV Solar installation being saved on a MySQL (actually mariadb) database on a NAS within my network. It would be nice if I could, in real time, pull the values in a couple of fields from this database and save them in my weewx database for trend display. I know that I can create a second weewx binding to a MySQL/mariadb database, but the structure of the database in question does not 'look' anything like that of a normal weewx database, so the default Manager would presumably not be able to work with it. Is there, or is it reasonably possible to write, a Manager that simply implements SELECTs on the managed database and returns the results to a user-written service that processes them?  If not, one could presumably import and use the regular MySQL connector within the service to grab the needed data.

Cameron D

unread,
Jul 15, 2025, 9:54:17 PMJul 15
to weewx-development
I have the same issue and have never bothered, mainly because I already had plotting interface to my solar data.  I use weather data to feed into the solar charts.
My difficulties are: time is not aligned and the interval is different.
Otherwise, since my weewx data is in mariaDB, I could run a cron job to regularly UPDATE a few fields in the weewx records.  I would not want to try that with sqlite db, although it might be safe if you have  a 5-minute interval.

If you have different intervals, I think the "simplest" path might be to have a new separate DB in weewx style that you duplicate the solar data into and then plot from that.  That way weewx can automatically handle its aggregate data tables.

Graham Eddy

unread,
Jul 15, 2025, 10:16:04 PMJul 15
to weewx-development
could write a simple weewx service that reads the NAS database and inserts the values into either loop or archive weewx packet.  add some columns to weewx database to store the values and data_type definitions in user/extensions.py. (if more than one NAS read between packets, have to summarise them to insert into next passing weewx packet. values don’t have to be inserted into every weewx packet)
⊣GE⊢

Graham Eddy

unread,
Jul 15, 2025, 10:22:28 PMJul 15
to weewx-development
instead of writing a weewx service, could use mqtt as middleware - write a little daemon to read the NAS database periodically and publish to mqtt, use contributed mqtt driver service in weewx to subscribe to them. (note that the mqtt messages could be subscribed to by other apps too, great way of making your data available)
⊣GE⊢

--
You received this message because you are subscribed to the Google Groups "weewx-development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to weewx-developm...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/weewx-development/9E10C697-509F-45BF-B332-04951AE7FFDF%40geddy.au.

Peter Fletcher

unread,
Jul 17, 2025, 9:51:32 AMJul 17
to weewx-development
Thanks! I do, also, have some graphical access to my solar data, but it involves logging in to my system provider's site - not a real problem, but inconvenient. Time alignment is not a problem - my local energy monitoring hardware records data to its memory on the minute, and I can access it very shortly thereafter. I think that I will probably add some functionality to my current user-written weewx services to grab and record a summary of the last 5 minutes' data for each archive record.

Peter Fletcher

unread,
Jul 17, 2025, 9:56:23 AMJul 17
to weewx-development
Since I have not found a need to use MQTT for anything else, learning to use it for this rather simple application seems like more effort than it deserves. As noted in another reply, I will probably add a couple of columns to my weewx database and grab the data at each archive interval directly from the energy monitoring hardware.
Reply all
Reply to author
Forward
0 new messages