steilerDev / homebridge-openhab2-complete

A homebridge plugin for openHAB, that has the expectation to fully support all Services offered by Apple's Homekit Accessory Protocol (HAP)
GNU General Public License v3.0
52 stars 16 forks source link

Fatal error after update #5

Closed ChaosisKing closed 5 years ago

ChaosisKing commented 5 years ago

Today I updated the plugin from version v0.7.x to v0.8.2. This caused the home bridge instance on my raspy to hang. After rebooting home bridge fails to start permanently and felt into a loop of permanent restarting. I had to delete the complete "platform": "openHAB2-Complete" part of the config.json to bring up my Homebridge again. After adding a complete new "openHAB2-Complete"-Block in the config.json the problem occurred again. For better research I add parts of my config.json, log-file and default.items. Thanks in advance

* config.json**** platforms ... }, { "platform": "openHAB2-Complete", "host": "192.168.112.207", "port": "8081", "accessories": [ { "name": "LichtEsstisch", "type": "switch", "item": "GF_Kitchen_Light" } ] } ], ...

* default.items ** ... Switch GF_Kitchen_Light "Licht" (GF_Kitchen, gLight) ["Lighting", "Switchable"] {channel="zwave:device:c5113938:node3:switch_dimmer"} Dimmer GF_Kitchen_Dimmer "Dimmer" (GF_Kitchen, gDimmer) ["DimmableLight"] {channel="zwave:device:c5113938:node3:switch_dimmer"} ...

log-file Feb 09 19:52:10 raspberrypi homebridge[6169]: [2/9/2019, 7:52:10 PM] [People] WebHook: Started server on port '51828'. Feb 09 19:52:10 raspberrypi homebridge[6169]: [2/9/2019, 7:52:10 PM] [openHAB2-Complete] Initializing openHAB2-Complete platform... Feb 09 19:52:10 raspberrypi homebridge[6169]: [2/9/2019, 7:52:10 PM] [openHAB2-Complete] Loading accessory types... Feb 09 19:52:10 raspberrypi homebridge[6169]: [2/9/2019, 7:52:10 PM] [openHAB2-Complete] Loading and activating accessory co2 Feb 09 19:52:10 raspberrypi homebridge[6169]: [2/9/2019, 7:52:10 PM] [openHAB2-Complete] Loading and activating accessory co Feb 09 19:52:10 raspberrypi homebridge[6169]: [2/9/2019, 7:52:10 PM] [openHAB2-Complete] Loading and activating accessory contact Feb 09 19:52:10 raspberrypi homebridge[6169]: [2/9/2019, 7:52:10 PM] [openHAB2-Complete] Loading and activating accessory door Feb 09 19:52:10 raspberrypi homebridge[6169]: [2/9/2019, 7:52:10 PM] [openHAB2-Complete] Loading and activating accessory fan Feb 09 19:52:10 raspberrypi homebridge[6169]: [2/9/2019, 7:52:10 PM] [openHAB2-Complete] Loading and activating accessory filter Feb 09 19:52:10 raspberrypi homebridge[6169]: [2/9/2019, 7:52:10 PM] [openHAB2-Complete] Loading and activating accessory humidity Feb 09 19:52:11 raspberrypi homebridge[6169]: [2/9/2019, 7:52:10 PM] [openHAB2-Complete] Loading and activating accessory leak Feb 09 19:52:11 raspberrypi homebridge[6169]: [2/9/2019, 7:52:11 PM] [openHAB2-Complete] Loading and activating accessory light Feb 09 19:52:11 raspberrypi homebridge[6169]: [2/9/2019, 7:52:11 PM] [openHAB2-Complete] Loading and activating accessory lightSensor Feb 09 19:52:11 raspberrypi homebridge[6169]: [2/9/2019, 7:52:11 PM] [openHAB2-Complete] Loading and activating accessory lock Feb 09 19:52:11 raspberrypi homebridge[6169]: [2/9/2019, 7:52:11 PM] [openHAB2-Complete] Loading and activating accessory motion Feb 09 19:52:11 raspberrypi homebridge[6169]: [2/9/2019, 7:52:11 PM] [openHAB2-Complete] Loading and activating accessory occupancy Feb 09 19:52:11 raspberrypi homebridge[6169]: [2/9/2019, 7:52:11 PM] [openHAB2-Complete] Loading and activating accessory outlet Feb 09 19:52:11 raspberrypi homebridge[6169]: [2/9/2019, 7:52:11 PM] [openHAB2-Complete] Loading and activating accessory security Feb 09 19:52:11 raspberrypi homebridge[6169]: [2/9/2019, 7:52:11 PM] [openHAB2-Complete] Loading and activating accessory smoke Feb 09 19:52:11 raspberrypi homebridge[6169]: [2/9/2019, 7:52:11 PM] [openHAB2-Complete] Loading and activating accessory switch Feb 09 19:52:11 raspberrypi homebridge[6169]: [2/9/2019, 7:52:11 PM] [openHAB2-Complete] Loading and activating accessory temp Feb 09 19:52:11 raspberrypi homebridge[6169]: [2/9/2019, 7:52:11 PM] [openHAB2-Complete] Loading and activating accessory thermostat Feb 09 19:52:11 raspberrypi homebridge[6169]: [2/9/2019, 7:52:11 PM] [openHAB2-Complete] Loading and activating accessory window Feb 09 19:52:11 raspberrypi homebridge[6169]: [2/9/2019, 7:52:11 PM] [openHAB2-Complete] Loading and activating accessory windowcovering Feb 09 19:52:11 raspberrypi homebridge[6169]: [2/9/2019, 7:52:11 PM] [openHAB2-Complete] Waiting for openHAB host (192.168.112.207) to come online... Feb 09 19:52:13 raspberrypi homebridge[6169]: TypeError: Cannot set property 'flags' of undefined Feb 09 19:52:13 raspberrypi homebridge[6169]: at URL.onParseComplete (internal/url.js:224:13) Feb 09 19:52:13 raspberrypi homebridge[6169]: at URL.set [as href] (internal/url.js:443:7) Feb 09 19:52:13 raspberrypi systemd[1]: homebridge.service: Main process exited, code=exited, status=1/FAILURE Feb 09 19:52:13 raspberrypi systemd[1]: homebridge.service: Unit entered failed state. Feb 09 19:52:13 raspberrypi systemd[1]: homebridge.service: Failed with result 'exit-code'. Feb 09 19:52:23 raspberrypi systemd[1]: homebridge.service: Service hold-off time over, scheduling restart. Feb 09 19:52:23 raspberrypi systemd[1]: Stopped Node.js HomeKit Server. Feb 09 19:52:23 raspberrypi systemd[1]: Started Node.js HomeKit Server. Feb 09 19:52:25 raspberrypi homebridge[6234]: [2/9/2019, 7:52:25 PM] Loaded config.json with 6 accessories and 5 platforms. ...

steilerDev commented 5 years ago

Could you please start Homebridge in debug mode (homebridge -D) and post the log output again? Thanks!

svenwiegand commented 5 years ago

Have the same problem too. Starting with -D option produces nearly the same output:

[2/10/2019, 2:13:58 PM] Loaded config.json with 0 accessories and 1 platforms.
[2/10/2019, 2:13:59 PM] ---
[2/10/2019, 2:13:59 PM] Warning: skipping plugin found at '/usr/lib/node_modules/homebridge-openhab2-complete' since we already loaded the same plugin from '/usr/local/lib/node_modules/homebridge-openhab2-complete'.
[2/10/2019, 2:14:03 PM] Loaded plugin: homebridge-openhab2-complete
[2/10/2019, 2:14:03 PM] Registering platform 'homebridge-openhab2-complete.openHAB2-Complete'
[2/10/2019, 2:14:03 PM] ---
[2/10/2019, 2:14:03 PM] Loading 1 platforms...
[2/10/2019, 2:14:03 PM] [openHAB] Initializing openHAB2-Complete platform...
[2/10/2019, 2:14:03 PM] [openHAB] Loading accessory types...
[2/10/2019, 2:14:03 PM] [openHAB] Found accessory of type co2
[2/10/2019, 2:14:03 PM] [openHAB] Loading and activating accessory co2
[2/10/2019, 2:14:03 PM] [openHAB] Found accessory of type co
[2/10/2019, 2:14:03 PM] [openHAB] Loading and activating accessory co
[2/10/2019, 2:14:03 PM] [openHAB] Found accessory of type contact
[2/10/2019, 2:14:03 PM] [openHAB] Loading and activating accessory contact
[2/10/2019, 2:14:03 PM] [openHAB] Found accessory of type door
[2/10/2019, 2:14:03 PM] [openHAB] Loading and activating accessory door
[2/10/2019, 2:14:03 PM] [openHAB] Found accessory of type fan
[2/10/2019, 2:14:03 PM] [openHAB] Loading and activating accessory fan
[2/10/2019, 2:14:03 PM] [openHAB] Found accessory of type filter
[2/10/2019, 2:14:03 PM] [openHAB] Loading and activating accessory filter
[2/10/2019, 2:14:03 PM] [openHAB] Found accessory of type humidity
[2/10/2019, 2:14:03 PM] [openHAB] Loading and activating accessory humidity
[2/10/2019, 2:14:03 PM] [openHAB] Found accessory of type leak
[2/10/2019, 2:14:03 PM] [openHAB] Loading and activating accessory leak
[2/10/2019, 2:14:03 PM] [openHAB] Found accessory of type light
[2/10/2019, 2:14:03 PM] [openHAB] Loading and activating accessory light
[2/10/2019, 2:14:03 PM] [openHAB] Found accessory of type lightSensor
[2/10/2019, 2:14:03 PM] [openHAB] Loading and activating accessory lightSensor
[2/10/2019, 2:14:03 PM] [openHAB] Found accessory of type lock
[2/10/2019, 2:14:03 PM] [openHAB] Loading and activating accessory lock
[2/10/2019, 2:14:03 PM] [openHAB] Found accessory of type motion
[2/10/2019, 2:14:03 PM] [openHAB] Loading and activating accessory motion
[2/10/2019, 2:14:03 PM] [openHAB] Found accessory of type occupancy
[2/10/2019, 2:14:03 PM] [openHAB] Loading and activating accessory occupancy
[2/10/2019, 2:14:03 PM] [openHAB] Found accessory of type outlet
[2/10/2019, 2:14:03 PM] [openHAB] Loading and activating accessory outlet
[2/10/2019, 2:14:03 PM] [openHAB] Found accessory of type security
[2/10/2019, 2:14:03 PM] [openHAB] Loading and activating accessory security
[2/10/2019, 2:14:03 PM] [openHAB] Found accessory of type smoke
[2/10/2019, 2:14:03 PM] [openHAB] Loading and activating accessory smoke
[2/10/2019, 2:14:03 PM] [openHAB] Found accessory of type switch
[2/10/2019, 2:14:03 PM] [openHAB] Loading and activating accessory switch
[2/10/2019, 2:14:03 PM] [openHAB] Found accessory of type temp
[2/10/2019, 2:14:03 PM] [openHAB] Loading and activating accessory temp
[2/10/2019, 2:14:03 PM] [openHAB] Found accessory of type thermostat
[2/10/2019, 2:14:03 PM] [openHAB] Loading and activating accessory thermostat
[2/10/2019, 2:14:03 PM] [openHAB] Found accessory of type window
[2/10/2019, 2:14:03 PM] [openHAB] Loading and activating accessory window
[2/10/2019, 2:14:03 PM] [openHAB] Found accessory of type windowcovering
[2/10/2019, 2:14:03 PM] [openHAB] Loading and activating accessory windowcovering
[2/10/2019, 2:14:03 PM] [openHAB] Waiting for openHAB host (https://homecontrol) to come online...
[2/10/2019, 2:14:05 PM] [openHAB] Checking if openHAB host (https://homecontrol) is online...
internal/url.js:224
  ctx.flags = flags;
            ^

TypeError: Cannot set property 'flags' of undefined
    at URL.onParseComplete (internal/url.js:224:13)
    at URL.set [as href] (internal/url.js:444:7)
    at _clone (/usr/local/lib/node_modules/homebridge-openhab2-complete/node_modules/clone/clone.js:162:16)
    at clone (/usr/local/lib/node_modules/homebridge-openhab2-complete/node_modules/clone/clone.js:202:10)
    at OpenHAB.isOnline (/usr/local/lib/node_modules/homebridge-openhab2-complete/util/OpenHAB.js:49:21)
    at new OpenHABComplete (/usr/local/lib/node_modules/homebridge-openhab2-complete/index.js:71:45)
    at Server._loadPlatforms (/usr/local/lib/node_modules/homebridge/lib/server.js:326:32)
    at Server.run (/usr/local/lib/node_modules/homebridge/lib/server.js:86:36)
    at module.exports (/usr/local/lib/node_modules/homebridge/lib/cli.js:45:10)
    at Object.<anonymous> (/usr/local/lib/node_modules/homebridge/bin/homebridge:17:22)
svenwiegand commented 5 years ago

Another hint: Downgrading to 0.8.0 I have the same issue, but when downgrading to 0.7.0 I can start up homebridge.

svenwiegand commented 5 years ago

Sorry for „spamming“, but I noticed that in 0.7.0 the error is also there but shows up in a different manner: Homebridge starts up but initializing my one and only test item fails with this message in the output:

'OpenHAB2 - Complete Edition' plugin loaded - Version 0.7.0
[2/10/2019, 2:47:12 PM] [openHAB] ---
[2/10/2019, 2:47:12 PM] [openHAB] Creating lightbulb service for Licht im Flur
[2/10/2019, 2:47:12 PM] [openHAB] Unable to add accessory Licht im Flur: Error: Not configuring binary characteristic for Licht im Flur: Cannot set property 'flags' of undefined, skipping
[2/10/2019, 2:47:12 PM] Loading 0 accessories...
Setup Payload:
X-HM://0023RP49KM71L
Scan this code with your HomeKit app on your iOS device to pair with Homebridge:
…

Here is the content of my tiny config.js:

{
    "bridge": {
        "name": "Homebridge",
        "username": "CC:22:3D:E3:CE:30",
        "port": 51826,
        "pin": "111-11-111"
    },

    "description": "Unser openHAB als Apple Homekit",

    "accessories": [
    ],

    "platforms": [
        {
            "platform" : "openHAB2-Complete",
            "name" : "openHAB",
            "host" : "http://homecontrol",
            "port" : "8080",
            "accessories": [
                {
                    "name": "Licht im Flur",
                    "type": "light",
                    "item": "lichtFlur"
                }
            ]
        }
    ]
}
ChaosisKing commented 5 years ago
steilerDev commented 5 years ago

Thank you all for your input. Looking at the logs, it seems that there is an issue with one of the dependencies (clone) and I am not able to reproduce the issue. However I never liked using clone there and wanted to remove it anyway. Therefore I removed the dependency in my latest commit 0d56c45cafc34527421f305682d6a6509f334c24 on the V0.9.0 branch. This should fix your issue.

Could one of you please manually install the latest push on the V0.9.0 branch and test if it fixes your issue?

svenwiegand commented 5 years ago

Thanks @steilerDev. Unfortunately I don‘t really have an idea how to test a dev build.

I‘ve tried to checkout the V0.9.0 branch and do a npm install -g inside the working directory but I run into permission issues. Same for sudo npm install -g --unsafe-perm.

glitchracer commented 5 years ago

Hi,

don't know if this is the correct way:

npm uninstall -g homebridge-openhab2-complete

cd /usr/lib/node_modules

rm -rf homebridge-openhab2-complete

git clone -b V0.9.0 https://github.com/steilerDev/homebridge-openhab2-complete.git && cd homebridge-openhab2-complete && npm i

It works now!

svenwiegand commented 5 years ago

Thanks for the tip @glitchracer. For me it's working too now @steilerDev.

steilerDev commented 5 years ago

Great! Thanks for your input and if there are any other issues, feel free to open a new issue!

I will leave this one open, until I merge the V0.9.0 branch into master and bundle it in a new release. You will be notified as soon as you can switch back to the npm release!

ChaosisKing commented 5 years ago

Thanks for your support. I didn't made it to do the manual installation, but doesn't matter I´ll wait for the nom release.

steilerDev commented 5 years ago

Merged into master with d25d6df04dbc959da8cd1d74589541e40c89b31f and released as v0.9.0