oyooyo / keyble

Command line tools and library for controlling eqiva eQ-3 Bluetooth smart locks
90 stars 28 forks source link

MQTT Service stopped working after a few seconds #18

Closed Micky79NRW closed 3 years ago

Micky79NRW commented 4 years ago

I installed keyble and if I use it not as an MQTT Service it works fine.

As MQTT Service it works a few seconds, then no commands are received or published. I figured out, that the problem is solved, when I use the parameter -adt 0.

And of course when I set it to -adt 3, the connections lost after this time (3s) when I set it to 10 then after 10s. Looks like keyble have problems to reconnect after auto disconnect.

Question: How much more is the battery usage withe -adt 0 ??? Is it significant?

Best Regards Micky

oyooyo commented 4 years ago

As MQTT Service it works a few seconds, then no commands are received or published. I figured out, that the problem is solved, when I use the parameter -adt 0.

Looks like keyble have problems to reconnect after auto disconnect. Indeed, sounds like a problem with reconnecting.

Right now I've got no idea what might be the problem though. You could try running keyble-sendcommand with a "DEBUG=" prefix to get some debug output: `DEBUG= keyble-sendcommand ` Not sure if that's actually going to provide any useful hints on the problem, but since I have no other ideas, I'm afraid that's the only advice I can give right now.

oyooyo commented 4 years ago

Question: How much more is the battery usage withe -adt 0 ??? Is it significant?

I forgot to answer that part. Apart from being a workaround for your problem, using -adt 0 should drastically reduce the time until the commands are actually being executed. But personally, I do not use the -adt 0 setting, since it causes the vendor's smartphone app from being able to connect to the smart door lock.

However, there is one user who claims to have used keyble with the -adt 0 setting, and gave a short report (in german language): https://www.mikrocontroller.net/topic/458856#5793250

Unfortunately, his report does not really help estimating how much difference using the -adt 0 setting makes on the battery. In his case, the battery lasted about 3,5 months - that may sound little at first, but which is actually quite good, since he said that during this time, the lock was operated around 250-300 times per week, which seems extremely much. Since operating the smart door lock is what's mainly draining the battery, I assume that the batteries would have lasted much longer if the smart door lock was only being operated a few times per day, as the vendor was assuming in his battery life estimates.

oyooyo commented 3 years ago

Closing this for now. Future versions will use a somewhat different codebase, and I currently assume that future versions will not have this issue.

gusman80 commented 2 years ago

hey, i just wanted you to know that using mqtt service and the service freezing after issuing the first command can be worked arround by -C 1 parameter at mosquitto_sub!

/usr/bin/mosquitto_sub -h $mqtt_server -t "Smartlock/action" -C 1 | /usr/local/bin/keyble-sendcommand --address $address --user_id $user_id --user_key $key --auto_disconnect_time 10 | /usr/bin/mosquitto_pub -h $mqtt_server -l -r -t "Smartlock/status"

cheeers!