I've created a flow that tries to connect to a bluetooth device. If it fails it sends to a 2nd android device in same wifi with automagic a command to disconnect from this bluetooth device and after that it tries again to connect to the bluetooth device.
For some reason the last step always fails. It only connects when I start the flow again from the beginning. I've tested with two different android devices and two different bluetooth devices. I've tried to wait a long time before this step and also let the flow restart himself. Nothing helped. It works only and always if I manually restart the flow, even just a second after the 2nd android device has disconnected. It seems to be a bug.
This is the flow: http://automagic4android.com/flow.php?i ... da0b90b892
If you need this, the flow from other device: http://automagic4android.com/flow.php?i ... 7ae8d1050f
Conntection to a buetooth device fails sometimes
Moderator: Martin
Re: Conntection to a buetooth device fails sometimes
I found a workaround for this issue.
I created a second flow with periodic timer every two seconds. The main flow activates the second flow and ends after that. The second flow then connects and deactivates itself.
It doesn't work if the main flow starts the second flow.
I created a second flow with periodic timer every two seconds. The main flow activates the second flow and ends after that. The second flow then connects and deactivates itself.
It doesn't work if the main flow starts the second flow.
Re: Conntection to a buetooth device fails sometimes
Waiting 2 seconds before connecting to the BT device seems quite short since the other device has to properly disconnect from the BT device and the BT device has to go into a state that accepts a new connection.
Did you try to increase the Sleep/Pause in the first flow to a longer duration of 10-30 seconds?
You could also extend the first flow to connect to the BT device, then wait a few seconds and check with a condition Bluetooth Device Connected whether the connection was established and if not, try again.
Did you try to increase the Sleep/Pause in the first flow to a longer duration of 10-30 seconds?
You could also extend the first flow to connect to the BT device, then wait a few seconds and check with a condition Bluetooth Device Connected whether the connection was established and if not, try again.
Re: Conntection to a buetooth device fails sometimes
Also, jetzt auf Deutsch, ist leichter für mich.
Ich konnte den Fehler eingrenzen. Es kommt davon, dass ich im Flow drei HTTP-Requests gleichzeitig ausführe (weil ich mir nicht immer sicher sein kann, welche IP-Adresse das andere Android-Gerät hat, das bereits mit dem Bluetooth-Gerät verbunden ist), und dann drei Pfeile zur Aktion "Mit Bluetooth verbinden" zeigen. Wahrscheinlich versucht Automagic diese Aktion zur selben Zeit dreimal auszuführen, was dann zu dem Fehler führt. Es nützt auch nichts, länger zu warten oder es zehnmal zu versuchen. Wenn ich aber nur einen HTTP-Request dalasse, dann funktioniert es.
(Ich habe inzwischen meinen Geräten eine feste IP-Adresse vergeben, sodass sich das Problem für mich sowieso erübrigt.)
Ich konnte den Fehler eingrenzen. Es kommt davon, dass ich im Flow drei HTTP-Requests gleichzeitig ausführe (weil ich mir nicht immer sicher sein kann, welche IP-Adresse das andere Android-Gerät hat, das bereits mit dem Bluetooth-Gerät verbunden ist), und dann drei Pfeile zur Aktion "Mit Bluetooth verbinden" zeigen. Wahrscheinlich versucht Automagic diese Aktion zur selben Zeit dreimal auszuführen, was dann zu dem Fehler führt. Es nützt auch nichts, länger zu warten oder es zehnmal zu versuchen. Wenn ich aber nur einen HTTP-Request dalasse, dann funktioniert es.
(Ich habe inzwischen meinen Geräten eine feste IP-Adresse vergeben, sodass sich das Problem für mich sowieso erübrigt.)