Sroose / homebridge-loxone-ws

Websocket based Loxone plugin for homebridge
MIT License
39 stars 26 forks source link

Error with ws-api? #24

Open avdz opened 6 years ago

avdz commented 6 years ago

I'm not really sure what is happening and I do not understand javascript enough to really be able to situate the problem but whenever I try to start homebridge (with the loon plugin) I get one of the following two errors: I think it might have something to do with the ws-api you're using but maybe it's best if you create a new issue there if that's the case.

/usr/local/lib/node_modules/homebridge-loxone-ws/node_modules/node-lox-ws-api/lib/API.js:190
    this.connection.send(this._auth.prepare_control_command(control, command));
                                    ^

TypeError: Cannot read property 'prepare_control_command' of undefined
    at API.send_control_command (/usr/local/lib/node_modules/homebridge-loxone-ws/node_modules/node-lox-ws-api/lib/API.js:190:37)
    at API.send_cmd (/usr/local/lib/node_modules/homebridge-loxone-ws/node_modules/node-lox-ws-api/lib/API.js:203:10)
    at WSListener.sendCommand (/usr/local/lib/node_modules/homebridge-loxone-ws/libs/WSListener.js:113:13)
    at DimmerItem.setItemState (/usr/local/lib/node_modules/homebridge-loxone-ws/items/DimmerItem.js:95:22)
    at emitMany (events.js:147:13)
    at Characteristic.Brightness.emit (events.js:224:7)
    at Characteristic.Brightness.Characteristic.setValue (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/lib/Characteristic.js:292:10)
    at DimmerItem.getOtherServices (/usr/local/lib/node_modules/homebridge-loxone-ws/items/DimmerItem.js:54:10)
    at DimmerItem.AbstractItem.getServices (/usr/local/lib/node_modules/homebridge-loxone-ws/items/AbstractItem.js:30:30)
    at Server._createAccessory (/usr/local/lib/node_modules/homebridge/lib/server.js:388:36)

       throw new Error("LOXONE WS: connection error");
       ^

Error: LOXONE WS: connection error
    at API.<anonymous> (/usr/local/lib/node_modules/homebridge-loxone-ws/libs/WSListener.js:44:14)
    at emitNone (events.js:106:13)
    at API.emit (events.js:208:7)
    at Connection.<anonymous> (/usr/local/lib/node_modules/homebridge-loxone-ws/node_modules/node-lox-ws-api/lib/API.js:98:14)
    at emitOne (events.js:116:13)
    at Connection.emit (events.js:211:7)
    at WebSocketConnection.<anonymous> (/usr/local/lib/node_modules/homebridge-loxone-ws/node_modules/node-lox-ws-api/lib/Connection.js:99:14)
    at emitOne (events.js:116:13)
    at WebSocketConnection.emit (events.js:211:7)
    at WebSocketConnection.handleSocketError (/usr/local/lib/node_modules/homebridge-loxone-ws/node_modules/websocket/lib/WebSocketConnection.js:347:14)```
koraysels commented 6 years ago

I have the same! anybody got a fix ?

koraysels commented 6 years ago

I downgraded to v 1.0.2 and the error is gone...

$ sudo npm install -g homebridge-loxone-ws@1.0.2

thomasgodon commented 6 years ago

also got the same error. should we update ws api?

Nexus2k commented 6 years ago

+1, have the same error. Downgrade to 1.0.2 works...

EDIT: 1.0.2 doesn't work, the mini server doesn't accept the commands (doesn't process them): I'm on Firmware 9.0.9.26

The DimmerItem has a bug that tries to set the State before the connection is established. https://github.com/Sroose/homebridge-loxone-ws/pull/28 for the fix

Sroose commented 6 years ago

Should be solved in release 1.0.5.

rtrompier commented 6 years ago

Hello,

I confirm, it's solved for me in 1.0.5 ;)

madito commented 5 years ago

Hi!

I have the similar problem;

homebridge-loxone-ws: 1.0.5 Loxone Miniserver: 10.0.9.24

[2019-3-17 18:47:27] [Loxone] [blinds] iOS - send message to Cortina in Cocina: ManualPosition/0 /usr/lib/node_modules/homebridge-loxone-ws/node_modules/node-lox-ws-api/lib/API.js:190 this.connection.send(this._auth.prepare_control_command(control, command)); ^

TypeError: Cannot read property 'send' of undefined at API.send_control_command (/usr/lib/node_modules/homebridge-loxone-ws/node_modules/node-lox-ws-api/lib/API.js:190:21) at API.send_cmd (/usr/lib/node_modules/homebridge-loxone-ws/node_modules/node-lox-ws-api/lib/API.js:203:10) at WSListener.sendCommand (/usr/lib/node_modules/homebridge-loxone-ws/libs/WSListener.js:140:13) at BlindsItem.setItem (/usr/lib/node_modules/homebridge-loxone-ws/items/BlindsItem.js:127:22) at emitMany (events.js:147:13) at Characteristic.TargetPosition.emit (events.js:224:7) at Characteristic.TargetPosition.Characteristic.setValue (/usr/lib/node_modules/homebridge/node_modules/hap-nodejs/lib/Characteristic.js:321:10) at Bridge. (/usr/lib/node_modules/homebridge/node_modules/hap-nodejs/lib/Accessory.js:873:22) at Array.forEach () at Bridge.Accessory._handleSetCharacteristics (/usr/lib/node_modules/homebridge/node_modules/hap-nodejs/lib/Accessory.js:813:8)