Update local time/DST info via MQTT

As an experiment, I wrote a short Linux script to run on my local MQTT broker. The script publishes an MQTT message that contains all of the information required for Particle systems to maintain local time and to perform DST transitions when they are scheduled.

The message is published with the retain flag set, so the script can be run on January 1st, and Particle devices will be sent the information each time they reboot and resubscribe to the topic.

I now have this working on one of my Xenons, and it is working better than expected. The DST transition code has not been tested yet, but I wanted to get this out there since a natural DST test will occur in a few days.

I have posted the script and code snippets copied from my Particle code. The information is here for anyone who is interested: https://github.com/rwpalmer/Set-MPU-Local-Time-via-MQTT

Please let me know if you have any recommendations or suggestions … or if you want to work together to take this to another level.

Mar 7th Update: I tested DST transitions today, and I made one correction to the code. The GitHub repository has been updated.