MQTT to MySQL process historic data

I am trying to figure out if it is possible to use persistence with a script/rule to process bulk historic data and add it to the DB.

I have set up the connection fine for MQTT -> OH2 -> MySQL and on all real-time data it works great, the problem I have is my ESP has a schedule on it and turns the modem off for 7 hours, but it still logs and stores the sensor data and once it turns on the modem it takes that data in a JSON format ( {"date time " : “value”, "date time " : “value”} etc. ) and sends it to the broker.

My next step is to take these values and store them in the table but I am unsure of the possibility of doing this with OH or if I should just write a PHP Sub service to perform it independently of OH.

Has anyone tackled this?

Oh will add to the database with the persistence service with a time stamp of when the data is persisted.
You php route is probably better. Or from the ESP and send the data to SQL directly.

1 Like

yeah thought it may be, I like your idea of going strait from the esp, that’s excellent.

Thanks