Home Easy Interrupts everything!
Ok, so all the parts of the arduino code work fine – just not all at the same time! The setup is as follows:
An interrupt procedure gets the home easy (HE) signal, and sends it to a callback function. This converts the sender/recipient/state into strings, and then publishes the data to MQTT. Problem with this is it takes time, and may be interrupted by the next HE signal. This problem is exaggerated by the HE motion detectors, which send about 15 on/off messages one after the other. When this happens, MQTT is interrupted and it leaves the arduino in a very strange state – loop() is paused, and nothing happens until it receives another HE signal, which kicks the arduino back into action – but by that time, any signals like “turn off the central heating” will be lost, so my energy efficient house becomes boiling hot!
So, after lots of hitting my head against a wall, my solution is to add the data to a global “string”, and then in the loop() method, to read this string, split it up into the MQ topic and the data to send to it, and then send it. I have found the WString library crashes the arduino, so it’s all done by manipulating individual characters in the array. Really missing the simplicity of Java!
And there are more problems…
