I read the code for the Arduino, as well as the Python code for the 
Raspberry Pi, and it looks like they're using pubnub.com as an MQTT-like 
service. Basically a middle man between your IoT device and your computer, 
so it makes sense that they're using it.

If you didn't want to use pubnub, you could potentially have the device 
send an update to your website using a format similar to how weather 
underground does it. For example, 
yoursite.com/lightningupdate.php?lightningcount=<lightning 
counter>&lightningtimestamp=<lightning timestamp>&more-variables-here. The 
PHP file could submit that data to your database so your website can pull 
it from the database when a visitor loads your site. Something along those 
lines. 

I think your device is using an ESP8266 for its WiFi connectivity, so you 
could replace the pubnub stuff with an HTTP GET method from the ESP 
library. In your code, the section publishPubNubMessage is where they are 
publishing it to pubnub. You could instead format the message variable and 
format it like mentioned above. Then you need to do the HTTP GET. Maybe 
something 
along the lines of this 
<https://techtutorialsx.com/2016/07/17/esp8266-http-get-requests/>? The 
bits where you see http.begin(); and http.GET();

You could also keep the pubnub and add the HTTP GET portions to have it 
send the data in parallel. 

This does sound perfect for weewx though since it already uses a database 
and you can extend the the database for all these fields. The only 
challenge would be ingesting that data since you're already using a driver. 
I've never created a service, but I think a service can bind to the loop so 
it can input to the database much like a driver. 

So maybe a combination of many things could make this work for weewx?

1) Create a new service which runs an http server that can accept data from 
HTTP GET and submit to the loop. (Think a hybrid of the interceptor driver 
and the maxbotix service)
2) Re-program your arduino to use the http get as above and program it to 
submit to your weewx server instead of your web server
3) Figure out what variables you want to keep and how often you want to 
archive them and use those in the GET. Then update the service so it's 
aware of these variable names to submit.
4) Extend the weewx database schema for the variable data you want to save.
5) Update your weewx skin, or your website, to get this data from the 
database.

This is all speculation though since I don't own the hardware, but that's a 
couple potential workaround to get away from pubnub and still being able to 
get the data into a database.



On Saturday, August 18, 2018 at 11:06:10 AM UTC-4, bgra...@umw.edu wrote:
>
> Pat,
> I am attaching the software that comes with the SwitchDoc board. It seems 
> to work fine except it tries to send data to pubnub.com which I don't 
> want to do as I have my own web site. It logs into my local net with no 
> problem but I haven't figured out how to change from pubnub to my local 
> server.  If you have any suggestions then I would appreciate knowing what 
> you think.  Thanks.
> Bob
>
> On Friday, August 17, 2018 at 8:23:11 PM UTC-4, Pat wrote:
>>
>> I'm curious about this project. Which Arduino sketch are you using?
>>
>> On Friday, August 17, 2018 at 5:33:25 PM UTC-4, bgra...@umw.edu wrote:
>>>
>>> Thanks to everyone for the comments. With my limited experience I will 
>>> probably not attemp to add this to weewx since it’s running so well at 
>>> present. 
>>> I’ll probably try to setup my own web server to receive the AS3935 data 
>>> using MQTT if I can figure out how not to send to pubnub.com whch seems 
>>> to be programmed in the arduino sketch somewhere.
>>
>>

-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to