Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Rapid Messages will Crash the Client? #55
Hi! First of all, kudos on your great work.
I've been using your library to subscribe to an MQTT topic, and then relay the message to another Arduino "field unit" via RF links using RadioHead. Here's the sketch if you'd like to take look at it:
I use openHAB to publish messages to MQTT based on what switch I press on my handset. So, all goes well when I test one switch and just leave it alone. But when I mash on the controls and make openHAB spit out a bunch of messages rapidly, eventually the Arduino just goes silent, and I presume it's crashed.
I don't know what happened, maybe you could check it out and see if I crashed the client?
@swell-d, I simply created an item that I don't show on my UI, and use rules to compare it to the actual items in the UI. An example would make explaining easier:
I have an 8-channel relay attached to an Arduino which I complained about at the top of this thread. I currently have these items:
gRelays_Garage_RELAY01_Device01 gRelays_Garage_RELAY01_Device02 gRelays_Garage_RELAY01_Device03 gRelays_Garage_RELAY01_Device04 gRelays_Garage_RELAY01_Device05 gRelays_Garage_RELAY01_Device06 gRelays_Garage_RELAY01_Device07 gRelays_Garage_RELAY01_Device08
I add another item that I don't show on my UI:
At this point, I don't use any bindings on any items.
I create a rule that looks something like this:
rule "[Update RELAY.01]" when Time cron "10 * * * * ?" // check every 10 seconds then var int statusMask = 0 if (gRelays_Garage_RELAY01_Device01.state == ON) statusMask = statusMask + 1 if (gRelays_Garage_RELAY01_Device02.state == ON) statusMask = statusMask + 2 if (gRelays_Garage_RELAY01_Device03.state == ON) statusMask = statusMask + 4 if (gRelays_Garage_RELAY01_Device04.state == ON) statusMask = statusMask + 8 if (gRelays_Garage_RELAY01_Device05.state == ON) statusMask = statusMask + 16 if (gRelays_Garage_RELAY01_Device06.state == ON) statusMask = statusMask + 32 if (gRelays_Garage_RELAY01_Device07.state == ON) statusMask = statusMask + 64 if (gRelays_Garage_RELAY01_Device08.state == ON) statusMask = statusMask + 128 if (statusMask.toString() != gRelays_Garage_Status.state.toString()) sendCommand(gRelays_Garage_Status, statusMask) end
I can then use the
referenced this issue
Dec 20, 2015
I ran into this problem too but found a workaround using the mosquitto broker.
By sending the messages with a QOS of 1 and setting the mosquitto config variable max_inflight_messages to 1 results in the messages being delivered to the subscriber one at a time - i.e. message 2 will only be sent after the client ACKs message 1.
I have just experienced this issue. I have built a module with 8 relays and a command looks like "/VBCM/xxxxxxxx/01/set" = "on" where xxxxxxxx is the serial number and 01 is the channel number.
If I send all 8 channels,one after the other 1 time out of 3 it tends to lock up. Sometimes it resets the sketch, most of time it does not.
I can reproduce this pretty consistently so am going to see if I can debug it.
After some fairly extensive testing I find that I have a hardware issue and nothing is wrong with the library. It's all to do with my relay circuit, if I don't have the relays connected there is no problem.
So that's good news for the library, and I need to make some tweaks to my design.