Programming strategies vs Battery life
-
I'm using the python library to write a gateway between Flic buttons and some Yoctopuce products. It worked well so far, but I'm a bit worried about something: I added button battery monitoring and noticed that batteries level is dropping quite fast, at this rate, batteries won't last more than a few weeks.
So my question is: are there some programming strategies that will suck less energy than others? I found some mentions of active and passive modes, but there is no reference to such modes in the python API.
-
Ok, I assume that channel.auto_disconnect_time unit is seconds.
But I think that I eventually found out what was draining the batteries, in the python scan wizard exemple in the is_private case, the scanner is never removed. I suspect this forces all the buttons to stay active if no-one press on the foreign button for 7 sec. Since I fixed that with a timeout, batteries are felling much better
-
Passive mode is the way to go. It basically means setting the "auto disconnect timeout" to something other that infinity, for example 15 seconds. It means the button will disconnect 15 seconds after inactivity. When you later press it, it will connect again. This might result in slightly higher delay, so it's not good for games, but should be ok for light switches and similar.