neil-morrison44 / homebridge-am43-blinds-bluez

A homebridge plugin for AM43 blinds which only works on linux
MIT License
0 stars 1 forks source link

Homebridge crashes with plugin #5

Open prugala opened 1 year ago

prugala commented 1 year ago

Hello

I have a problem with plugin. Before I've used AM43 blinds with https://github.com/renssies/homebridge-am43-blinds on Raspberry Pi. Now I'm moving HB to new device with Intel CPU and external USB BT adapter.

Plugin can not find my blinds, so I tried to add config manually:

{
            "allowed_devices": [
                "02:13:0b:da:19:a4",
                "02:77:05:ae:9f:2a",
                "02:6d:91:97:8a:81"
            ],
            "scanning_timeout": 8,
            "hap_interaction_timeout": 90,
            "poll_interval": 300,
            "name": "am43-blinds-bluez",
            "platform": "am43-blinds-bluez"
        }

When HB starts plugin causes an error:

1/29/2023, 8:30:28 AM] TypeError: The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView. Received undefined
    at new NodeError (node:internal/errors:400:5)
    at Hash.update (node:internal/crypto/hash:109:11)
    at Object.generate (/var/lib/homebridge/node_modules/homebridge/node_modules/hap-nodejs/src/lib/util/uuid.ts:11:11)
    at /var/lib/homebridge/node_modules/homebridge-am43-blinds-bluez/dist/AM43Platform.js:79:51
    at new Promise (<anonymous>)
    at AM43Platform.initDevice (/var/lib/homebridge/node_modules/homebridge-am43-blinds-bluez/dist/AM43Platform.js:78:16)
    at AM43Platform.didFinishLaunching (/var/lib/homebridge/node_modules/homebridge-am43-blinds-bluez/dist/AM43Platform.js:60:39)
    at HomebridgeAPI.<anonymous> (/var/lib/homebridge/node_modules/homebridge-am43-blinds-bluez/dist/AM43Platform.js:36:49)
    at HomebridgeAPI.emit (node:events:525:35)
    at HomebridgeAPI.signalFinished (/var/lib/homebridge/node_modules/homebridge/src/api.ts:275:10)

When I'm scanning bt devices with bluetoothctl I see my blind: Blind, bedroom left, bedroom right:

[bluetooth]# scan on
Discovery started
[CHG] Controller 04:42:1A:55:C0:04 Discovering: yes
[NEW] Device B8:7C:6F:7C:6D:18 MiKettle
[NEW] Device 2A:E3:52:AA:7B:31 2A-E3-52-AA-7B-31
[NEW] Device 69:B2:BB:C9:C7:34 69-B2-BB-C9-C7-34
[NEW] Device 6C:29:B1:51:DB:0E 6C-29-B1-51-DB-0E
[NEW] Device 54:F6:90:5F:53:D6 54-F6-90-5F-53-D6
[NEW] Device 61:CF:19:02:A2:C5 61-CF-19-02-A2-C5
[NEW] Device 02:6D:91:97:8A:81 bedroom right
[NEW] Device 02:77:05:AE:9F:2A bedroom left
[NEW] Device 38:2D:82:3E:45:9E 38-2D-82-3E-45-9E
[NEW] Device C8:0F:10:AA:7C:CC MI_SCALE
[CHG] Device 6C:29:B1:51:DB:0E RSSI: -58
[NEW] Device 02:13:0B:DA:19:A4 Blind
[NEW] Device 04:FE:A1:0F:88:47 EDIFIER R1700BT
[CHG] Device 04:FE:A1:0F:88:47 RSSI: -62
[bluetooth]# scan off

Any ideas?

Btw. I see and can control blinds via app on my iPhone without problem.

prugala commented 1 year ago

I've tried with configuration:

{
            "allowed_devices": [
                {
                    "name": "Office blind",
                    "address": "02:13:0b:da:19:a4",
                    "pass_code": "8888",
                    "has_tilt": false,
                    "tilt_motor": {
                        "orientation": "vertical"
                    }
                }
            ],
            "hap_interaction_timeout": 90,
            "poll_interval": 300,
            "platform": "am43-blinds-bluez"
        }

And HB crashes with error:

DBusError: Disconnected early
    at _methodReturnHandlers.<computed> (/var/lib/homebridge/node_modules/homebridge-am43-blinds-bluez/node_modules/dbus-next/lib/bus.js:343:27)
    at handleMessage (/var/lib/homebridge/node_modules/homebridge-am43-blinds-bluez/node_modules/dbus-next/lib/bus.js:101:11)
    at EventEmitter.<anonymous> (/var/lib/homebridge/node_modules/homebridge-am43-blinds-bluez/node_modules/dbus-next/lib/bus.js:151:9)
    at EventEmitter.emit (node:events:513:28)
    at /var/lib/homebridge/node_modules/homebridge-am43-blinds-bluez/node_modules/dbus-next/lib/connection.js:132:14
    at USocket.<anonymous> (/var/lib/homebridge/node_modules/homebridge-am43-blinds-bluez/node_modules/dbus-next/lib/message.js:65:9)
    at USocket.emit (node:events:513:28)
    at emitReadable_ (node:internal/streams/readable:590:12)
    at processTicksAndRejections (node:internal/process/task_queues:81:21)
prugala commented 1 year ago

Update, I used Ubuntu server and bluetooth works better. Plugin finding blinds but I have error:

DBusError: Write not permitted
    at _methodReturnHandlers.<computed> (/var/lib/homebridge/node_modules/homebridge-am43-blinds-bluez/node_modules/dbus-next/lib/bus.js:343:27)
    at handleMessage (/var/lib/homebridge/node_modules/homebridge-am43-blinds-bluez/node_modules/dbus-next/lib/bus.js:101:11)
    at EventEmitter.<anonymous> (/var/lib/homebridge/node_modules/homebridge-am43-blinds-bluez/node_modules/dbus-next/lib/bus.js:151:9)
    at EventEmitter.emit (node:events:513:28)
    at /var/lib/homebridge/node_modules/homebridge-am43-blinds-bluez/node_modules/dbus-next/lib/connection.js:132:14
    at USocket.<anonymous> (/var/lib/homebridge/node_modules/homebridge-am43-blinds-bluez/node_modules/dbus-next/lib/message.js:65:9)
    at USocket.emit (node:events:513:28)
    at emitReadable_ (node:internal/streams/readable:590:12)
    at processTicksAndRejections (node:internal/process/task_queues:81:21)

sudobtmon` shows:

> HCI Event: Disconnect Complete (0x05) plen 4                                                                            #283 [hci0] 35.661681
        Status: Success (0x00)
        Handle: 17 Address: 02:77:05:AE:9F:2A (OUI 02-77-05)
        Reason: Connection Terminated By Local Host (0x16)