50ButtonsEach / hax-with-flic-osx

Basic Flic application for Mac.
105 stars 13 forks source link

Button doesn't work after a few hours of inactivity #6

Closed patricks closed 8 years ago

patricks commented 8 years ago

Hi,

I have build a little script to which acts as light switch for my hue lights. Everything worked as expected, but a few hours later I wasn't able to switch the lights. So I checked my Mac Mini, it was running without any problems. So I tried the flic button again and it worked again.

Is there any timeout for the bluetooth connection?

ps: I will create a separate PR for the hue switch script

AntonMeier commented 8 years ago

Ok, so actually this app is not very smart in a sense. It is possible that the bluetooth connection might disconnect for various reasons. If you happen to press the button when it does not have an active connection, then those click events will be queued up on the button itself and then delivered when the button connects again. The problem that you are seeing is happening because the app will actually discard events that were queued up and only allow "live" events. This may sound stupid, but in fact I wanted to avoid that people by mistake queue up large number of events (if you press the button when it is not within range) that then would all be delivered and trigger scripts once the connection is established.

What I should do, and will do, is to allow queued events but with an age limit (perhaps selectable). On top of that some kind of cool-down as well to avoid spamming scripts.

Hope you can live with it for now :P

AntonMeier commented 8 years ago

Fixed in version 0.1.5