I provide a template that can be used as a start for your own MQTT program on an ESP8266. It connects either through DHCP or via a static LAN IP.
It implements basic MQTT functions (subscribe and publish) and I have added a hoist of functions/MQTT messages that you might find useful.
For instance:
- IPnr
- MACnr
- ChipId
- Uptime
- Heartbeat
- TimeDate (internet), including the ‘Day of Year’
- RSSI
- Filename
- A number of memory and core functions
- HTTP-OTA Download here.
The WebOTA is quite basic, upon sending an update command via MQTT, the program seeks a bin file on a server that you need to specify. You can get a bin file from your program by pressing Alt-Ctrl-S in the Arduino-IDE.
The name the OTA expects -and what is generated by Alt-Ctrl-S – is based on the filename plus the board, followed by ‘bin’. So in this case that is “Template.ino.generic.bin”. If you compile it for a Wemos D1, that file will become “Template.ino.d1_mini.bin”
Great stuff. May I suggest to maybe in a next release replace the time part with the recent stuff from Andres Spiess (The guy with the Swiss accent)? Auto daylight saving, NTP handling, etc.
yes, I have seen his video. i need to watch that again with a bit more attentian as I was under the impression the setup I had gave me the correct time during the summer as well, so I was a bit confused by his recent video.