I need some code written for the ESP32(and ideally for the ESP8266 too) to be coded using the Arduino IDE. The code is to connect to an MQTT server and listen for commands and when it receives them, parse the command and send the command via infrared.
Captive portal for setting wifi credentials - available for a time after pressing a button
Connect to an MQTT server based on host name
Use an encrypted connection if available
Preferably use version 1.2 suitable for being hosted by Amazon
Identify using the wifi MAC address and a password
If the device does not have the password, it will need to do a http request to get the password based on the MAC address
Keep connected to the MQTT server, reconnecting if required
On reception of the command, parse it, send an ack and send the message via an infrared led
Have the capability to flash a visible LED under software control
Monitor a 1-Wire temperature sensor and send the data base via MQTT based on a timer
Send the access point name and password via SSID
The server will send some parameters which will need to be stored and used.
Send an MQTT message when a I/O pin is active and hasn’t been active recently
Send received IR back as an MQTT message
An active portal when a button is pressed is essential for setting wifi
Over The Air updates to Amazon AWS S3 triggered via MQTT messages
Source code in LUA will be provided to describe most of the desired functionality.