[New Binding] AM43 Blind Drive Motor Binding

Well it confirms that bluez is kinda unreliable for the bluetooth binding and reflects the same experience that I’m having. Not much I can do about it since since I can’t modify the code in bluez. I’m still working on finding ways to mitigate the issues by making changes to the bluetooth binding. Thanks for your help though.

If there are any features you would like me to add. Please let me know. I can implement anything the Blinds Engine app can do.

Small announcement. My Bluetooth fixes were merged into the openhab codebase. :confetti_ball:
Also, I’ve been refactoring the am43 binding to make it more stable and I seemed to have solved the notification issue that I’ve been having. Or at least I think solved, I’ve been running 12+ hours with no issues :crossed_fingers:.
I’ve uploaded the lastest am43, bluetooth, and bluez bindings which can be found using the links in my initial post.

1 Like

The hard work has its result; working flawless!
Just wanted to let you know, very greatful for your efforts.

Thanks for the feedback, you have been a great help!

I’m starting to question the quality of the these AM43 devices; Of the two I have, one of them consistently has connection issues and the other (which has had no issues up until this point) decided to die on my yesterday. Luckily it came back to life when I opened it up and disconnected power/battery then reconnected them.
These AM43 motors have started to flood the market and I’m a bit concerned why it is being pushed so hard when there are such common problems with them. I’m betting the one with the connection problem is a hardware issue while the second one is a software issue that hopefully could be fixed with a firmware update. There is no indication (from what I can tell) that the firmware can be updated through bluetooth so my only option would be to get a new device if the issue persists.
Anyone else experiencing similar issues?

Edit: So I got a replacement for the motor with a hardware issue and my light sensor is working again. But it has come to my attention that somehow the location that I put the motor in is somehow a bluetooth dead-zone. I suspect some kind of RF black magic going on so I’ll see if I can sort that out. But at least everything is working for now and binding has been working like a champ.

Good news, I solved my bluetooth reception issue. I got a LM1010 and a +12db antenna. It might be kinda overkill since now I pick up all the bluetooth devices from the neighborhood, but hey, it works!

It doesn’t hurt anyone, ‘au contraire’ .
Doo you think the instable link is mainly caused by the BT link?

I made sure to test the motors before I mounted them to the wall and they never had connection issues during testing. So I can only conclude that the issues had to do with motor placement and not the motors themselves.

That makes sense; in my case there is a lot space (house walk path) and possible signal distortion, inbetween motor and RPI-BT, causing longer times of working fine and shoter periodes of needed restarts.
Will have a look at the BT blaster you mentioned.

What do you mean by restarts? Restarting the AM43 or the raspberry pi?

In some of the AM43 troubleshooting I’ve found online they mention that it is possible for the motor to become overloaded and shutdown as a result. It was never specified whether this ‘overload’ was from the motor overheating or a failsafe for over-voltage, though I suspect they are referring to an over-voltage failsafe against the solar panel.

Should have written; connection lost between Rpi and AM43, looping and not able to reconnect autmatic.
Connection restored after restart of Rpi, not even once required to restarted my AM43.

I’ve been spending a lot of time trying to diagnose and deal with Rpi bluetooth issues. Before you feel the need to restart the system try running dmesg and systemctl status bluetooth on the command line and see if any red text pops up. You might be running into a memory issue on your bluetooth but I’d have to see your logs before I could be sure.

Took a few days to have the issue again.

/var/log/openhab2/openhab.log
2020-02-28 19:47:54.472 [hingStatusInfoChangedEvent] - 'bluetooth:am43:adapter1:motor1' changed from OFFLINE: Device is not connected. to OFFLINE (COMMUNICATION_ERROR)
2020-02-28 19:47:54.480 [hingStatusInfoChangedEvent] - 'bluetooth:am43:adapter1:motor1' changed from OFFLINE (COMMUNICATION_ERROR) to OFFLINE: Device is not connected.

dmesg
[  531.220862] Bluetooth: hci0: Frame reassembly failed (-84)
[  531.220901] Bluetooth: hci0: Frame reassembly failed (-84)
[  531.221024] Bluetooth: hci0: Frame reassembly failed (-84)
[  531.221125] Bluetooth: hci0: Frame reassembly failed (-84)
[  531.221242] Bluetooth: hci0: Frame reassembly failed (-84)
[  718.580781] Bluetooth: hci0: Frame reassembly failed (-84)
[  718.582003] Bluetooth: hci0: Frame reassembly failed (-84)
[  806.239801] Bluetooth: hci0: Frame reassembly failed (-84)
[  806.239857] Bluetooth: hci0: Frame reassembly failed (-84)
[  806.239958] Bluetooth: hci0: Frame reassembly failed (-84)
[  806.239991] Bluetooth: hci0: Frame reassembly failed (-84)
[ 1104.392734] Bluetooth: hci0: Frame reassembly failed (-84)
[ 1104.392769] Bluetooth: hci0: Frame reassembly failed (-84)
[ 1104.392859] Bluetooth: hci0: Frame reassembly failed (-84)
[ 1104.392898] Bluetooth: hci0: Frame reassembly failed (-84)
[ 1444.128364] Bluetooth: hci0: Frame reassembly failed (-84)
[ 1444.128420] Bluetooth: hci0: Frame reassembly failed (-84)
[ 1444.128505] Bluetooth: hci0: Frame reassembly failed (-84)
[ 1444.128548] Bluetooth: hci0: Frame reassembly failed (-84)
[ 2969.591156] Bluetooth: hci0: failed to disable LE scan: status 0x1f
[ 2969.591162] Bluetooth: hci0: command 0x200c tx timeout
[ 3089.254969] Bluetooth: hci0: Frame reassembly failed (-84)
[ 3089.255051] Bluetooth: hci0: Frame reassembly failed (-84)
[86789.778644] Bluetooth: hci0: Frame reassembly failed (-84)
[186990.240699] Bluetooth: hci0: Frame reassembly failed (-84)

systemctl status bluetooth
● bluetooth.service - Bluetooth service
   Loaded: loaded (/lib/systemd/system/bluetooth.service; enabled; vendor preset: enabled)
   Active: active (running) since Tue 2020-02-25 19:17:58 CET; 3 days ago
     Docs: man:bluetoothd(8)
 Main PID: 440 (bluetoothd)
   Status: "Running"
    Tasks: 1 (limit: 2319)
   Memory: 2.6M
   CGroup: /system.slice/bluetooth.service
           └─440 /usr/lib/bluetooth/bluetoothd

Feb 25 19:17:58 openhabianpi systemd[1]: Starting Bluetooth service...
Feb 25 19:17:58 openhabianpi bluetoothd[440]: Bluetooth daemon 5.43
Feb 25 19:17:58 openhabianpi systemd[1]: Started Bluetooth service.
Feb 25 19:17:58 openhabianpi bluetoothd[440]: Starting SDP server
Feb 25 19:17:58 openhabianpi bluetoothd[440]: Can't load plugin /usr/lib/arm-linux-gnueabihf/bluetooth/plugins/sixaxis.so: /usr/lib/arm-linux-gnueabihf/bluetooth/plugins/sixaxis.so: undefi
Feb 25 19:17:58 openhabianpi bluetoothd[440]: Bluetooth management interface 1.14 initialized
Feb 25 19:17:58 openhabianpi bluetoothd[440]: Failed to obtain handles for "Service Changed" characteristic
Feb 25 19:17:58 openhabianpi bluetoothd[440]: Sap driver initialization failed.
Feb 25 19:17:58 openhabianpi bluetoothd[440]: sap-server: Operation not permitted (1)
Feb 25 19:17:58 openhabianpi bluetoothd[440]: Failed to set privacy: Rejected (0x0b)
~
~
lines 1-21/21 (END)

Can’t say I’ve seen that error before. But you are in luck since a lot of other people have had that issue and I was able to find a solution that they have posted.

edit /usr/bin/btuart and change the 921600 to 460800 (or 230400, 115200 etc.). Unless you are streaming audio it shouldn’t be too restricting.

Hopefully this solves your problem, otherwise I would suggest getting an external bluetooth dongle.

Changed to the half of maximum; 460800.
Will keep you posted! Thanks for the suggestion/effort!

Great News! The AM43 binding was just merged into the official 2.5.x codebase.
:confetti_ball: The AM43 is now an official binding! :confetti_ball:

3 Likes

Uninterrupted operation for 7 days, and counting…

Congrats with the ‘official’ binding reward! :wink:

1 Like

Hi I have opneHAB version 2.5.3.1 but this AM43 binding is not there. do you know why? Thanks

It is included as part of the bluetooth binding. So just installing the bluetooth binding should allow you to discover am43 motors.