DeutscheMark / homebridge-kodi

Kodi plugin for Homebridge
MIT License
28 stars 4 forks source link

Cannot read property ‘getCharacteristic’ #3

Closed i3laze closed 4 years ago

i3laze commented 4 years ago

Thanks for your efforts! Before I used legacy Kodi Callbacks add-on to fire shell scripts to push HomeBridge on Kodi events. That one not maintained anymore and got compatibility issues with Leia.

Your HB plugin does work (I see status and can play/pause from Home.app), however I got these error messages in HB and HB restarts like once a minute:

...
Joining mDNS multicast group on interface eth1.IPv4 with address 192.168.1.128.
New relevant interface eth1.IPv4 for mDNS.
Joining mDNS multicast group on interface eth0.IPv4 with address 172.16.0.2.
New relevant interface eth0.IPv4 for mDNS.
Network interface enumeration completed.
Registering new address record for 192.168.1.128 on eth1.IPv4.
Registering new address record for 172.16.0.2 on eth0.IPv4.
...
[11/13/2019, 7:17:14 PM] Homebridge is running on port 51826.
[11/13/2019, 7:17:14 PM] [Kodi] Kodi Version: 18.2
{ code: -32601, message: 'Method not found.' }
{ code: -32601, message: 'Method not found.' }
{ code: -32601, message: 'Method not found.' }
{ code: -32601, message: 'Method not found.' }
{ code: -32601, message: 'Method not found.' }
{ code: -32601, message: 'Method not found.' }
{ code: -32601, message: 'Method not found.' }
{ code: -32601, message: 'Method not found.' }
{ code: -32601, message: 'Method not found.' }
{ code: -32601, message: 'Method not found.' }
{ code: -32601, message: 'Method not found.' }
[11/13/2019, 7:17:14 PM] [Kodi] TypeError: Cannot read property 'getCharacteristic' of undefined
    at connection.kodiRequest.then.itemresult (/homebridge/node_modules/homebridge-kodi/index.js:135:49)
    at process._tickCallback (internal/process/next_tick.js:68:7)

[11/13/2019, 7:17:24 PM] [Kodi] TypeError: Cannot read property 'getCharacteristic' of undefined
    at connection.kodiRequest.then.result (/homebridge/node_modules/homebridge-kodi/index.js:307:41)
    at process._tickCallback (internal/process/next_tick.js:68:7)

[11/13/2019, 7:17:34 PM] [Kodi] TypeError: Cannot read property 'getCharacteristic' of undefined
    at connection.kodiRequest.then.result (/homebridge/node_modules/homebridge-kodi/index.js:307:41)
    at process._tickCallback (internal/process/next_tick.js:68:7)

[11/13/2019, 7:17:44 PM] [Kodi] TypeError: Cannot read property 'getCharacteristic' of undefined
    at connection.kodiRequest.then.result (/homebridge/node_modules/homebridge-kodi/index.js:307:41)
    at process._tickCallback (internal/process/next_tick.js:68:7)

[11/13/2019, 7:17:54 PM] [Kodi] TypeError: Cannot read property 'getCharacteristic' of undefined
    at connection.kodiRequest.then.result (/homebridge/node_modules/homebridge-kodi/index.js:307:41)
    at process._tickCallback (internal/process/next_tick.js:68:7)

[11/13/2019, 7:18:04 PM] [Kodi] TypeError: Cannot read property 'getCharacteristic' of undefined
    at connection.kodiRequest.then.result (/homebridge/node_modules/homebridge-kodi/index.js:307:41)
    at process._tickCallback (internal/process/next_tick.js:68:7)

[11/13/2019, 7:18:12 PM] [Балкон] Power state for 'Балкон' is false
[11/13/2019, 7:18:12 PM] [Балкон] Балкон  -  Activity Set :  true
[11/13/2019, 7:18:12 PM] [Kodi] Getting Kodi Player: false
[11/13/2019, 7:18:12 PM] [Kodi] Getting Kodi Player: 1 %
[11/13/2019, 7:18:14 PM] [Kodi] TypeError: Cannot read property 'getCharacteristic' of undefined
    at connection.kodiRequest.then.result (/homebridge/node_modules/homebridge-kodi/index.js:307:41)
    at process._tickCallback (internal/process/next_tick.js:68:7)

[11/13/2019, 7:18:20 PM] [Балкон] Power state for 'Балкон' is false
[11/13/2019, 7:18:20 PM] [Балкон] Балкон  -  Activity Set :  true
[11/13/2019, 7:18:20 PM] [Kodi] Getting Kodi Player: 1 %
[11/13/2019, 7:18:20 PM] [Kodi] Getting Kodi Player: false
[11/13/2019, 7:18:22 PM] [Kodi] Notification Received: Player.OnResume

[11/13/2019, 7:18:22 PM] TypeError: Cannot read property 'getCharacteristic' of undefined
    at KodiPlatform.<anonymous> (/homebridge/node_modules/homebridge-kodi/index.js:170:37)
    at Client.emit (/homebridge/node_modules/homebridge-kodi/node_modules/eventemitter3/index.js:181:35)
    at WebSocket.<anonymous> (/homebridge/node_modules/homebridge-kodi/node_modules/rpc-websockets/dist/lib/client.js:424:67)
    at WebSocket.emit (events.js:198:13)
    at Receiver.receiverOnMessage (/homebridge/node_modules/homebridge-kodi/node_modules/ws/lib/websocket.js:720:20)
    at Receiver.emit (events.js:198:13)
    at Receiver.dataMessage (/homebridge/node_modules/homebridge-kodi/node_modules/ws/lib/receiver.js:414:14)
    at Receiver.getData (/homebridge/node_modules/homebridge-kodi/node_modules/ws/lib/receiver.js:346:17)
    at Receiver.startLoop (/homebridge/node_modules/homebridge-kodi/node_modules/ws/lib/receiver.js:133:22)
    at Receiver._write (/homebridge/node_modules/homebridge-kodi/node_modules/ws/lib/receiver.js:69:10)

[11/13/2019, 7:18:22 PM] Got SIGTERM, shutting down Homebridge...
[11/13/2019, 7:18:24 PM] [Kodi] TypeError: Cannot read property 'getCharacteristic' of undefined
    at connection.kodiRequest.then.result (/homebridge/node_modules/homebridge-kodi/index.js:307:41)
    at process._tickCallback (internal/process/next_tick.js:68:7)

Starting homebridge in insecure mode...
-U /homebridge -P /homebridge/node_modules -C -I

[11/13/2019, 7:18:32 PM] Loaded config.json with 1 accessories and 2 platforms.
[11/13/2019, 7:18:32 PM] ---
[11/13/2019, 7:18:32 PM] Loaded plugin: homebridge-dummy
[11/13/2019, 7:18:32 PM] Registering accessory 'homebridge-dummy.DummySwitch'
[11/13/2019, 7:18:32 PM] ---
[11/13/2019, 7:18:32 PM] Loaded plugin: homebridge-kodi
[11/13/2019, 7:18:32 PM] Registering platform 'homebridge-kodi.Kodi'
[11/13/2019, 7:18:32 PM] ---
[11/13/2019, 7:18:33 PM] Loaded plugin: homebridge-mqtt-switch-tasmota

HomeBridge 0.4.50, Plugin 0.1.3, LibreElec 9.0.2, Kodi 18.2

P.S. I run HomeBridge in Docker right above Kodi (LibreElec) - my networking might be the cause: HB Container has both Bridge 172.16.0.2 and MacVlan 192.168.1.128 interfaces. First one isn’t used for mDNS bonjour stuff (probably, can’t do getCharasteristic), second has no connectivity with Docker host (Kodi IP) by design (macvlan). I use bridge gateway IP 172.16.0.1 as “host IP” setting:

    "mdns": {
        "interface": "192.168.1.128"
    }
.....
   {
            "platform": "Kodi",
            "name": "Kodi",
            "host": "172.16.0.1",
            "port": "8080",
            "username": "kodi",
            "password": "",
            "polling": 10
        }
DeutscheMark commented 4 years ago

It's a bug with the minimal config. Thanks for reporting. I'm fixing it with the next version. Sorry for the problems you're having. A workaround would be to set all accessories to true in the meantime.

{
        "platform": "Kodi",
        "name": "Kodi",
        "host": "172.16.0.1",
        "port": "8080",
        "username": "kodi",
        "password": "",
        "polling": 10,
        "playerPlay": true,
        "playerStop": true,
        "applicationVolume": true,
        "videoLibraryScan": true,
        "videoLibraryClean": true
    }
i3laze commented 4 years ago

0.1.4 indeed works just fine. Thank you! Now it’s time for me to introduce some new home automations) Like Kodi-Pause on Koogeek front door open or kitchen light toggle on Player.

However some regular warnings on startup still left:

[11/15/2019, 5:26:29 PM] [Kodi] Initializing Kodi platform...
Init Homebridge-Kodi
[11/15/2019, 5:26:29 PM] [Kodi] Adding Kodi Player
[11/15/2019, 5:26:29 PM] [Kodi] Adding PlayerLightbulbAccessory

HAP Warning: Characteristic 3deb7456-5196-497e-8f4e-efc455516c96 not in required or optional characteristics for service 00000043-0000-1000-8000-0026BB765291. Adding anyway.

HAP Warning: Characteristic 939cbbc9-382f-4574-903f-649ffbc24a1d not in required or optional characteristics for service 00000043-0000-1000-8000-0026BB765291. Adding anyway.

HAP Warning: Characteristic 1972fe3f-7fe6-4e30-acdf-951eb9aabb7a not in required or optional characteristics for service 00000043-0000-1000-8000-0026BB765291. Adding anyway.

HAP Warning: Characteristic 74341e3c-271d-4f3c-b84e-595b804b1f90 not in required or optional characteristics for service 00000043-0000-1000-8000-0026BB765291. Adding anyway.

HAP Warning: Characteristic cf1c85ad-ba54-48e8-9681-255278976584 not in required or optional characteristics for service 00000043-0000-1000-8000-0026BB765291. Adding anyway.

[11/15/2019, 5:26:29 PM] [Kodi] Starting Kodi Update with polling: 3 seconds
[11/15/2019, 5:26:29 PM] [Kodi] Kodi Accessories read.
[11/15/2019, 5:26:29 PM] [Kodi] Initializing platform accessory 'Kodi Player'...
[11/15/2019, 5:26:29 PM] [Config] Initializing config platform...
[11/15/2019, 5:26:29 PM] [Config] Running in Standalone Mode.
[11/15/2019, 5:26:29 PM] Loading 1 accessories...
...
[11/15/2019, 5:26:29 PM] Homebridge is running on port 51826.
[11/15/2019, 5:26:30 PM] [Kodi] Kodi Version: 18.2
{ code: -32601, message: 'Method not found.' }
{ code: -32601, message: 'Method not found.' }
{ code: -32601, message: 'Method not found.' }
{ code: -32601, message: 'Method not found.' }
{ code: -32601, message: 'Method not found.' }
{ code: -32601, message: 'Method not found.' }
{ code: -32601, message: 'Method not found.' }
{ code: -32601, message: 'Method not found.' }
{ code: -32601, message: 'Method not found.' }
{ code: -32601, message: 'Method not found.' }
{ code: -32601, message: 'Method not found.' }