Recovering from INSTEON bus jams

Forum rules

This is a legacy forum which is locked for new topics. New topics should be started in one of the other forums under Extending Indigo

Posted on
Sat Jun 22, 2013 12:54 pm
Perry The Cynic offline
Posts: 836
Joined: Apr 07, 2008

Recovering from INSTEON bus jams

I'm writing code that subscribes to INSTEON incoming commands, listens for KPL button presses, and does stuff. If the stuff involves sending INSTEON commands (say, I called device.turnOn() and it was an INSTEON switch), that tends to jam. The symptom is that nothing happens for a few seconds, then Indigo issues an error message about how the send failed, and my command didn't execute. (And my plugin doesn't get told - the turnOn method has long since returned with no comment.)

Is there a way for Indigo to tell me that my turnOn() command (or whatever) has failed? That would allow me to cleanly retry it. (Of course, I'm kind of wondering why Indigo isn't resending it, if it knows the send has failed. Yes, I understand that perhaps the command worked and the ACK got lost. But for turnOn() and their like, what's the harm?)

Without a failure notification, I must use timers. The problem is that while the bus is jammed, Indigo queues all commands for sending later. This means it queues my retransmissions, waits until the bus clears, and then sends them all. There's no way (is there?) to only queue a command if it's not already queued. And there's no way to find out that we're stalled and commands aren't currently going out (is there?). I'm flying blind. (Well, I'm flying on instruments, and all the instruments tell me is, "You're not there yet." :-))

I was wondering whether indigo.insteon.subscribeToOutgoing can help me, but it's unclear what it's actually telling me - is it "I queued your command," or "I sent your command to the modem," or "the modem has sent the command out," or "I've seen an ACK for this command"?

Cheers
-- perry

Posted on
Sat Jun 22, 2013 1:34 pm
matt (support) offline
Site Admin
User avatar
Posts: 21411
Joined: Jan 27, 2003
Location: Texas

Re: Recovering from INSTEON bus jams

Perry The Cynic wrote:
I was wondering whether indigo.insteon.subscribeToOutgoing can help me, but it's unclear what it's actually telling me - is it "I queued your command," or "I sent your command to the modem," or "the modem has sent the command out," or "I've seen an ACK for this command"?

That callback is dispatched after the command has been sent and ACK'd (or NAK'd, I think) onto the power line. So I think it will do what you want. Off the top of my head I don't recall the specifics, so you'll probably want to log the args to the Event Log to see what information you get to determine if it will help you detect the failures.

BTW, what you describe is what I think is an INSTEON retry collision race condition. I believe there is supposed to be a retry mechanism (at the transport layer) that does an exponential random backoff to avoid collisions but I'm not sure it works very well. So instead you get a long delay as the PowerLinc retries the command several times (well beyond the level of control Indigo has) but each retry collides with other controller's command. Maybe it works better in some firmware versions than others -- I'm not sure.

Image

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 14 guests