Description
Originally reported by: RAJEEV TANDON (Bitbucket: rajtan, GitHub: rajtan)
There seems to be an issue in relay module.
When there is an incoming request (mqtt message for setting up a relay) - the code which is used to get the relayID seems to be erroneous (at least in my case). The code used to fetch the index of character having relayId is IMHO wrong. I have used the following code fragment to get the correct relayID.
#!arduino
relayID = topic[strlen(topic)-strlen(MQTT_USE_SETTER)-1] - '0'
This would manifest only when an MQTT message for setting up a relay status is received wherein an incorrect relay being triggered (usually relay 0 due to the following code) when some other one was intending the other relay.
I could also not understand the code to reset the relay to 0 if extracted Id was higher?
Anyone having this problem? Though I have fixed both of above for now.