great example and I also started reading your blog thank you.
I want to try this but i got an error. I tried with v1.9 and last version of pubsubclient. Do I need other libraries?
In file included from C:\xxx\Desktop\MqttTimer\MqttTimer.ino:39:0:
sketch\globals.h: In function 'void ConnectMQTT()':
globals.h:195: error: 'MQTT' has not been declared
while (!client.connect(MQTT::Connect(config.clientID).set_auth(config.MQTTuser, config.MQTTpass)) && retries--)
^
In file included from C:\xxx\Desktop\MqttTimer\MqttTimer.ino:40:0:
sketch\MQTTHandler.h: At global scope:
MQTTHandler.h:7: error: 'MQTT' does not name a type
void callback(const MQTT::Publish& pub)
^
MQTTHandler.h:7: error: expected unqualified-id before '&' token
void callback(const MQTT::Publish& pub)
^
MQTTHandler.h:7: error: expected ')' before '&' token
MQTTHandler.h:7: error: expected initializer before 'pub'
void callback(const MQTT::Publish& pub)
^
exit status 1
'MQTT' has not been declared