This is what happens.
Establish a web socket with the WeatherFlow server.
Subscribe to events.
On data received, parse the data and store it in MySQL.
That being said, there is a LOT of code involved to do each step.
Here is some sample data received via the socket.
{“status”:{“status_code”:0,“status_message”:“SUCCESS”},“device_id”:5590,“type”:“obs_sky”,“source”:“cache”,“summary”:{“precip_total_1h”:0.0,“precip_total_24h”:0.0,“precip_high_24h”:0.0},“obs”:[[1511715825,null,1,0,0.31,0.56,0.89,53,3.17,1,183,0]]}
{“status”:{“status_code”:0,“status_message”:“SUCCESS”},“device_id”:3337,“type”:“obs_air”,“source”:“cache”,“summary”:{“pressure_trend”:“steady”,“pressure_high_24h”:829.4,“pressure_low_24h”:825.7,“strike_count_3h”:0},“obs”:[[1511715832,828.9,12.4,42,0,0,3.05,1]]}
{“type”:“ack”,“id”:“SK-00007032”}
{“type”:“ack”,“id”:“SK-00007032_rwd”}
{“type”:“ack”,“id”:“AR-00005119”}
{“device_id”:5590,“serial_number”:“SK-00007032”,“type”:“rapid_wind”,“hub_sn”:“HB-00004516”,“ob”:[1511715850,0.72,77]}
{“device_id”:5172,“source”:“mqtt”,“serial_number”:“SK-00007419”,“type”:“evt_precip”,“hub_sn”:“HB-00001483”,“evt”:[1510542299]}
{“device_id”:2356,“source”:“mqtt”,“serial_number”:“AR-00006577”,“type”:“evt_strike”,“hub_sn”:“HB-00000666”,“evt”:[1510607208,1,41525]}
{“summary”:{“precip_total_1h”:0.0,“precip_total_24h”:0.0,“precip_high_24h”:0.0},“serial_number”:“SK-00007032”,“hub_sn”:“HB-00004516”,“type”:“obs_sky”,“source”:“mqtt”,“obs”:[[1511715884,null,1,0.0,0.4,0.56,1.16,51,3.17,1,190,0.0]],“device_id”:5590,“firmware_revision”:26}
{“summary”:{“pressure_trend”:“steady”,“pressure_high_24h”:829.4,“pressure_low_24h”:825.7,“strike_count_3h”:0},“serial_number”:“AR-00005119”,“hub_sn”:“HB-00004516”,“type”:“obs_air”,“source”:“mqtt”,“obs”:[[1511715892,828.9,12.5,42,0,0,3.05,1]],“device_id”:3337,“firmware_revision”:20}
This data has to be parsed and put into variables, which in turn are stored in the proper table. I store the data in the units it comes in and later convert the data to different units.
You are doing a lot more than just getting data from WeatherFlow so I’m not sure how much help I can be.