So as a follow-up... I decided to do this in node.js after all to keep everything local.
On my Unraid NAS/server I made a node.js docker container to run the node.js app. I'm fairly green on custom docker containers, but this one was really easy since it just needs to run the one node.js app file.
The node.js app is pretty simple. It just listens on UDP/50222 (weatherflow port) for the UDP broadcasts from Weatherflow and then uses MakerAPI to shove the values I need into a virtual omnisensor device.
Here is the node.js app in case it is helpful for anyone else. My code is sloppy, but it seems to work as I'm getting lux updates once per minute. Right now I'm only pulling in the illuminance/brightness value, I'll go back and add in the lightning strike data later as I have a few family things I need to run off to.
Weatherflow broadcasts the values once per minute, and I've found the lux readings both accurate and repeatable (and read up to 100K+ lux, which is more than anyone likely needs), so it may be useful for some lighting (or other?) automation - assuming the once per minute update rate is acceptable.
var http = require("http");
var PORT = 50222;
var HOST = '0.0.0.0';var dgram = require('dgram');
var server = dgram.createSocket('udp4');server.on('listening', function() {
var address = server.address();
console.log('UDP Server listening on ' + address.address + ':' + address.port);
});server.on('message', function(message, remote) {
var obj = JSON.parse(message);
if (obj.type=="obs_sky") {
var lux = obj.obs[0][1];
var urldata = 'http://192.168.2.xxx/apps/api/xxx/devices/xxx/setIlluminance/'
urldata += lux;
urldata += '?access_token=xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxx';http.get(urldata, (res) => { const { statusCode } = res; const contentType = res.headers['content-type']; let error; if (statusCode !== 200) { error = new Error('Request Failed.\n' + `Status Code: ${statusCode}`); } else if (!/^application\/json/.test(contentType)) { error = new Error('Invalid content-type.\n' + `Expected application/json but received ${contentType}`); } if (error) { console.error(error.message); // Consume response data to free up memory res.resume(); return; } });
}
});server.bind(PORT, HOST);
What the data looks like (is mostly cloudy today. ):