Sroose / homebridge-loxone-ws

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

homebridge not working with Loxone Beta 9.0.7.25 anymore #14

Open COMHOME opened 7 years ago

COMHOME commented 7 years ago

I'm unsure, what leads to the problem, but in fact you wanna try, it's public: Loxone Public Beta I asked Loxone about changes done to websocket or sth. else via the Beta-Feedback. If I get any news on that, i'll let you know...

pevecyan commented 7 years ago

Hey, anything new about this problem?

COMHOME commented 7 years ago

No. I tried node-red with loxone and homekit - that still works fine. I talked to loxone and they said, they didn't make changes to the websocket or sth. else.

Sroose commented 7 years ago

@COMHOME Hello this should be ok now after fix for #16 could you recheck?

Nexus2k commented 7 years ago

Can you publish the version 1.0.3 npm?

twischi commented 7 years ago

First of all: Thank you for the great tool and your efforts

@Nexus2k Maybe it will work for you installing it directly from GitHub until it is available at npm

(1) Change into your directory where current npm install is find it with sudo find / -name homebridge-loxone-ws for my setup i have to change to this directory: cd /usr/local/lib/node_modules

(2) Install it directly from git: sudo npm install git+https://git@github.com/Sroose/homebridge-loxone-ws.git

(3) Check if you have the 1.0.3 version npm list -g --depth=1

It should look like this:

├─┬ homebridge-loxone-ws@1.0.3 (git+https://git@github.com/Sroose/homebridge-loxone-ws.git#5f7f737af50f4747cb4c4bc6587c822d0e19f1db)
│ ├── node-lox-ws-api@0.4.2
│ ├── request@2.83.0
│ └── ws@1.1.4
Nexus2k commented 7 years ago

Confirmed working after installing 1.0.3 from github repo. Still doesn't detect my temperature sensors but that is a different issue.

bastelbert commented 7 years ago

Hi! First of all thanks for the great work! I followed the instructions to update homebridge-loxone-ws.git directly from git, went well so far. But after restarting the homebridge-service I get the following errors: Oct 13 09:55:41 loxberry homebridge[18360]: [10/13/2017, 9:55:41 AM] Homebridge is running on port 51826. Oct 13 09:55:41 loxberry homebridge[18360]: /usr/lib/node_modules/homebridge-loxone-ws/libs/WSListener.js:44 Oct 13 09:55:41 loxberry homebridge[18360]: throw new Error("LOXONE WS: connection error"); Oct 13 09:55:41 loxberry homebridge[18360]: ^ Oct 13 09:55:41 loxberry homebridge[18360]: Error: LOXONE WS: connection error Oct 13 09:55:41 loxberry homebridge[18360]: at API. (/usr/lib/node_modules/homebridge-loxone-ws/libs/WSListener.js:44:14) Oct 13 09:55:41 loxberry homebridge[18360]: at emitNone (events.js:86:13) Oct 13 09:55:41 loxberry homebridge[18360]: at API.emit (events.js:188:7) Oct 13 09:55:41 loxberry homebridge[18360]: at Connection. (/usr/lib/node_modules/homebridge-loxone-ws/node_modules/node-lox-ws-api/lib/API.js:97:14) Oct 13 09:55:41 loxberry homebridge[18360]: at emitOne (events.js:96:13) Oct 13 09:55:41 loxberry homebridge[18360]: at Connection.emit (events.js:191:7) Oct 13 09:55:41 loxberry homebridge[18360]: at WebSocketConnection. (/usr/lib/node_modules/homebridge-loxone-ws/node_modules/node-lox-ws-api/lib/Connection.js:99:14) Oct 13 09:55:41 loxberry homebridge[18360]: at emitOne (events.js:96:13) Oct 13 09:55:41 loxberry homebridge[18360]: at WebSocketConnection.emit (events.js:191:7) Oct 13 09:55:41 loxberry homebridge[18360]: at WebSocketConnection.handleSocketError (/usr/lib/node_modules/homebridge-loxone-ws/node_modules/websocket/lib/WebSocketConnection.js:342:14) Oct 13 09:55:41 loxberry homebridge[18360]: at emitOne (events.js:96:13) Oct 13 09:55:41 loxberry homebridge[18360]: at Socket.emit (events.js:191:7) Oct 13 09:55:41 loxberry homebridge[18360]: at Socket.writeAfterFIN [as write] (net.js:309:8) Oct 13 09:55:41 loxberry homebridge[18360]: at WebSocketConnection.sendFrame (/usr/lib/node_modules/homebridge-loxone-ws/node_modules/websocket/lib/WebSocketConnection.js:852:31) Oct 13 09:55:41 loxberry homebridge[18360]: at WebSocketConnection.fragmentAndSend (/usr/lib/node_modules/homebridge-loxone-ws/node_modules/websocket/lib/WebSocketConnection.js:788:14) Oct 13 09:55:41 loxberry homebridge[18360]: at WebSocketConnection.sendUTF (/usr/lib/node_modules/homebridge-loxone-ws/node_modules/websocket/lib/WebSocketConnection.js:728:10) Oct 13 09:55:41 loxberry systemd[1]: homebridge.service: main process exited, code=exited, status=1/FAILURE Oct 13 09:55:41 loxberry systemd[1]: Unit homebridge.service entered failed state.

twischi commented 7 years ago

@bastelbert Have you checked your "node-lox-ws-api"-Version? npm list -g --depth=1 What is your Version-Number?

bastelbert commented 7 years ago

seems to be correct:

├─┬ homebridge-loxone-ws@1.0.3 (git+https://git@github.com/Sroose/homebridge-loxone-ws.git#5f7f737af50f4747cb4c4bc6587c822d0e19f1db) │ ├── node-lox-ws-api@0.4.2 │ ├── request@2.83.0 │ └── ws@1.1.4

twischi commented 7 years ago

@bastelbert My homebrige-log file is fine. Did you check your homebridge config.json- File?

{    "bridge": {
        "name": "xxxx",
        "username": "yyyy",
        "port": 51826,
        "pin": "yyyy"   },
    "description": "Apple HomeKit Steuerung mit Siri des Loxone Smarthome",
    "platforms": [
        {  "platform": "homebridge-loxoneWs.LoxoneWs",
            "name": "Loxone",
            "host": "zzzz",
            "port": "80",
            "username": "AppleHome",
            "password": "xxxx"  }
    ] }
bastelbert commented 7 years ago

Problem solved! Don't know why, but now Homekit works again! I stopped the homebridge several hours ago, but I forgot to deactivate the automatic restart via crontab every 30 minutes. So the service started at some point correctly and since then it was restarted several times without any problems. Thanks again for the great work!

bastelbert commented 7 years ago

Homekit is dead again :( The homebridge service is now in a constant loop: It restarts automatically every 10 seconds, finds all accessories, shows the iOS pairing code and then there's this "LOXONE WS: connection error" again.

config.json- file seems to be ok. After downgrading to homebridge-loxone-ws 1.0.2 the service runs stable (but I can't control any accessories). Upgrade to 1.0.3 leads again to the same error during startup...

EDIT: After 5 minutes of continuous restarts the homebridge service could connect to Loxone and runs now stable again.

EDIT2: After a restart of my miniserver, the homebridge service is now again in the constant restart loop as described above. Approximately 100 restarts in the last 30 minutes, every time the same "LOXONE WS: connection error". Fun fact: homebridge already recognizes the new accessory I created in Loxone...

twischi commented 7 years ago

@bastelbert I have no further idea, there are a lot o modules used as you can see in homebridge-loxone-ws --> node_modules directory . Seems you have to wait for the npm update to latest version.

Sroose commented 7 years ago

The latest version in now on npm as v1.0.4

bastelbert commented 7 years ago

Thanks a lot! Installation went fine, but I've still got the same problem: Homebridge starts, connects to the Miniserver, finds all in Loxone defined accessories but instantly disconnets from the Miniserver with the error message stated above :( After some time (up to 90 minutes) of continuous automatic restarts the connection works stable and everything is fine.

alexohneander commented 7 years ago

Same Issue.

Nov 20 21:12:23 raspberrypi homebridge[3562]: at Connection.emit (events.js:159:13) Nov 20 21:12:23 raspberrypi homebridge[3562]: at WebSocketConnection.<anonymous> (/usr/lib/node_modules/homebridge-loxone-ws/n Nov 20 21:12:23 raspberrypi homebridge[3562]: at WebSocketConnection.emit (events.js:159:13) Nov 20 21:12:23 raspberrypi homebridge[3562]: at WebSocketConnection.handleSocketError (/usr/lib/node_modules/homebridge-loxon Nov 20 21:12:23 raspberrypi homebridge[3562]: at Socket.emit (events.js:159:13) Nov 20 21:12:23 raspberrypi homebridge[3562]: at Socket.writeAfterFIN [as write] (net.js:358:8)

avdz commented 7 years ago

I am also having the same issue here. Happy to provide some data if needed.

CodeCutterUK commented 6 years ago

I'm not sure if it's related but commenting out the line the exception is thrown helps - https://github.com/Sroose/homebridge-loxone-ws/blob/5f7f737af50f4747cb4c4bc6587c822d0e19f1db/libs/WSListener.js#L44

It looks like it might be something to do with a timeout somewhere.

StefanoSanchezZ commented 6 years ago

Just figured out that you can solve the problem (at least temporary) if you reboot your loxone miniserver! Afterwards a ONE-TIME start of homebridge will work. As soon as your raspberry will reboot or restart homebridge the same error will occur. I try to live with this bug... let's see when I'll have to reboot my miniserver again :)

LLPP65 commented 6 years ago

Hello,

Same here...

Great software! After a bit of configuration I have it doing most of what I want.

I am using the latest npm version of homebridge and home-bridge-loxone-ws. My miniserver is updated to the latest version, 9.1.x.

My main problem is that if I restart homebridge, it fails to connect to the mini server. I cannot connect until I reboot the miniserver, then everything works correctly.

I've tried applying the patches listed in pull request #28, but that hasn't fixed it.

Thanks in advance!

Jan 30 12:22:41 raspy3 systemd[1]: Starting Node.js HomeKit Server... Jan 30 12:22:41 raspy3 systemd[1]: Started Node.js HomeKit Server.

... avahi messages ...

Jan 30 12:22:44 raspy3 homebridge[22730]: [2018-1-30 12:22:44] Loaded plugin: homebridge-loxone-ws Jan 30 12:22:44 raspy3 homebridge[22730]: homebridge API version: 2.2 Jan 30 12:22:44 raspy3 homebridge[22730]: [2018-1-30 12:22:44] Registering platform 'homebridge-loxoneWs.LoxoneWs' Jan 30 12:22:44 raspy3 homebridge[22730]: [2018-1-30 12:22:44] --- Jan 30 12:22:44 raspy3 homebridge[22730]: [2018-1-30 12:22:44] Loaded config.json with 0 accessories and 1 platforms. Jan 30 12:22:44 raspy3 homebridge[22730]: [2018-1-30 12:22:44] --- Jan 30 12:22:44 raspy3 homebridge[22730]: [2018-1-30 12:22:44] Loading 1 platforms... Jan 30 12:22:44 raspy3 homebridge[22730]: [2018-1-30 12:22:44] [Loxone] Initializing LoxoneWs platform... Jan 30 12:22:44 raspy3 homebridge[22730]: [2018-1-30 12:22:44] [Loxone] LoxPlatform Init Jan 30 12:22:44 raspy3 homebridge[22730]: SETTING UP WS LISTENER Jan 30 12:22:44 raspy3 homebridge[22730]: New WS: 192.168.0.11:80 Jan 30 12:22:44 raspy3 homebridge[22730]: [2018-1-30 12:22:44] [Loxone] Getting Loxone configuration. Jan 30 12:22:44 raspy3 homebridge[22730]: [2018-1-30 12:22:44] [Loxone] Platform - Connecting to http://user:pass@192.168.0.11:80/data/LoxApp3.json Jan 30 12:22:44 raspy3 homebridge[22730]: [2018-1-30 12:22:44] [Loxone] LOXONE WS: connect

... lots of found accessories ...

Jan 30 12:22:45 raspy3 homebridge[22730]: Setup Payload: Jan 30 12:22:45 raspy3 homebridge[22730]: X-HM://xxxxxxxxxxxx Jan 30 12:22:45 raspy3 homebridge[22730]: Scan this code with your HomeKit app on your iOS device to pair with Homebridge: Jan 30 12:22:45 raspy3 homebridge[22730]: Or enter this code with your HomeKit app on your iOS device to pair with Homebridge: Jan 30 12:22:45 raspy3 homebridge[22730]: ┌────────────┐ Jan 30 12:22:45 raspy3 homebridge[22730]: │ xxx-xx-xxx │ Jan 30 12:22:45 raspy3 homebridge[22730]: └────────────┘ Jan 30 12:22:45 raspy3 homebridge[22730]: [2018-1-30 12:22:45] Homebridge is running on port 51826. Jan 30 12:22:45 raspy3 homebridge[22730]: /usr/lib/node_modules/homebridge-loxone-ws/libs/WSListener.js:44 Jan 30 12:22:45 raspy3 homebridge[22730]: throw new Error("LOXONE WS: connection error"); Jan 30 12:22:45 raspy3 homebridge[22730]: ^ Jan 30 12:22:45 raspy3 homebridge[22730]: Error: LOXONE WS: connection error Jan 30 12:22:45 raspy3 homebridge[22730]: at API. (/usr/lib/node_modules/homebridge-loxone-ws/libs/WSListener.js:44:14) Jan 30 12:22:45 raspy3 homebridge[22730]: at emitNone (events.js:106:13) Jan 30 12:22:45 raspy3 homebridge[22730]: at API.emit (events.js:208:7) Jan 30 12:22:45 raspy3 homebridge[22730]: at Connection. (/usr/lib/node_modules/homebridge-loxone-ws/node_modules/node-lox-ws-api/lib/API.js:98:14) Jan 30 12:22:45 raspy3 homebridge[22730]: at emitOne (events.js:116:13) Jan 30 12:22:45 raspy3 homebridge[22730]: at Connection.emit (events.js:211:7) Jan 30 12:22:45 raspy3 homebridge[22730]: at WebSocketConnection. (/usr/lib/node_modules/homebridge-loxone-ws/node_modules/node-lox-ws-api/lib/Connection.js:99:14) Jan 30 12:22:45 raspy3 homebridge[22730]: at emitOne (events.js:116:13) Jan 30 12:22:45 raspy3 homebridge[22730]: at WebSocketConnection.emit (events.js:211:7) Jan 30 12:22:45 raspy3 homebridge[22730]: at WebSocketConnection.handleSocketError (/usr/lib/node_modules/homebridge-loxone-ws/node_modules/websocket/lib/WebSocketConnection.js:347:14) Jan 30 12:22:45 raspy3 systemd[1]: homebridge.service: main process exited, code=exited, status=1/FAILURE Jan 30 12:22:45 raspy3 systemd[1]: Unit homebridge.service entered failed state. Jan 30 12:22:55 raspy3 systemd[1]: homebridge.service holdoff time over, scheduling restart. Jan 30 12:22:55 raspy3 systemd[1]: Stopping Node.js HomeKit Server...

Sroose commented 6 years ago

Please try release 1.0.5 and see if this is still an issue? Working for me now on Loxone 9.3

LLPP65 commented 6 years ago

I had already upgraded Loxone to 9.3 and just upgraded homebridge-loxone-ws to 1.0.5. I can now restart homebridge without restarting the miniserver. Thanks very much!

idoodler commented 6 years ago

Loxone just published its own node.js module that handles authentication, encryption and tokens in an easy way.

Its version 0.9 but it will work, I am using it in one of my own projects for a while now. (Yes, I am an Loxone employee...)

You may wanna check it out: LxCommunicator