[Solved] Button Controller Loop

I've already solved this; I'm just posting it as a warning to others.

I'm just getting getting started with home automation and ran into a problem.

I set up a Button Controller (1.6) to make button toggle a switch when pressed. The problem was that when I pressed the button, it toggled the switch at a fast rate in an infinite loop. This is what the logs looked like (note how close together the timestamps are):

Here's how I had Button Controller configured:

Drilling down into the selected actions looked like this:

And going into "Control switches, buttons, capture/restore", you could see this:

See, down there, in the "Assign Buttons" section? That should probably be titled something like "Trigger Button Press", because that's what it actually does. I thought I was assigning Test Button to toggle the switch that was selected above.

It probably also shouldn't let you select the same button that would trigger this action in the first place, but it does. And that's what I told it to do.

So, I had set up Button Controller so that pressing Test Button would toggle Test Switch and trigger Test Button to be pressed, which would start the whole thing again, endlessly (until I rebooted the hub or changed/deleted the Button Controller configuration).

Removing the selected button from the "Assigned Buttons" section solves this problem and makes it so pressing the button just toggles the switch one time.

Hopefully this helps someone else who runs into the same problem.

1 Like

Why would you push a button the same button within the action of a button controller app?

1 Like

Because I've never done any home automation before and it was not obvious to me that that's what that option did.

There are lots of ways that one can create an infinite loop in automations. So many in fact, that it would not be possible to protect a user from his own mistakes. Where there is power to automate, there is power to goof it up. Hard to have the first without the latter.

Better documentation may help. Question: did you read the documentation before you set up Button Controller? Just curious, not criticizing or even suggesting that you should have. I would not have read it first. Point being, that even better documentation doesn't necessarily address these issues.

Better UI wording? Could be. Definitely open to suggestions on better wording for actions...

2 Likes

There are lots of ways that one can create an infinite loop in automations. So many in fact, that it would not be possible to protect a user from his own mistakes. Where there is power to automate, there is power to goof it up. Hard to have the first without the latter.

Fair enough, but it does seem like it could be possible to make sure a user isn't directly pointing the gun at their own foot, as in this case where a button press was set to directly trigger itself again.

Better documentation may help. Question: did you read the documentation before you set up Button Controller? Just curious, not criticizing or even suggesting that you should have. I would not have read it first. Point being, that even better documentation doesn't necessarily address these issues.

At first I just tried to use it without reading about it. It wasn't very clear how to use it, so I searched for an example. I found one, somewhere, but it seemed to be for an older version, or was somehow incomplete, or not doing quite what I was after. Regardless, following that example didn't work.

I then searched for more information, and did find this. Unfortunately, that is also pretty incomplete. It really needs to go into a lot more detail in step 6 (misconfiguring the action in step 6 is what got me in trouble in the first place).

Linking to that documentation (even in its current state) from the UI might be useful.

I even searched for the source code to Button Controller so I could try to see what the options actually did and maybe use that to understand where I went wrong. If it's available, I didn't find it.

In the end, I realized on my own what that option might be doing and fixed it. That's why I wrote this post: my searches for the problem didn't turn up anything useful in solving my problem. Maybe if someone else runs into the same problem, they'll find this post and be able to solve their problem quicker than I did.

Better UI wording? Could be. Definitely open to suggestions on better wording for actions...

For me, "Trigger Button Press" (or something similar) would have been much more clear than the current "Assign Buttons" label.

1 Like

The documentation is linked for each app from the ? at upper right when the app is open. We will take a look at the wording as well.

1 Like