hoobs-org / HOOBS

Build your Smart Home with HOOBS. Connect over 2,000 Accessories to your favorite Ecosystem.
https://hoobs.org
GNU General Public License v3.0
552 stars 51 forks source link

Homebridge crashes on auto-start after upgrading from v2 to v3 #464

Closed mayhew132 closed 4 years ago

mayhew132 commented 4 years ago

Description After upgrading my Hoobs installation from v2 to v3 the Homebridge service now crashes on first launch (I end up having to start the service manually from the Web UI).

Version Version 3.1.20

Did you upgrade Yes

Pervious version 2.1 (I think)

Did you orginally upgrade to HOOBS 3 from HOOBS 2.1.1? Yes

What device are you using? Custom Install

If this is a custom install, what's your operating system? Raspbian Buster 4.19.58-v7+

List your plugins homebridge-hive homebridge-smartthings-tonesto7

Post your config

{
    "server": {
        "port": 8080,
        "origin": "*",
        "autostart": 15,
        "home_setup_id": "X-HM://0023ISYWYGL40",
        "polling_seconds": 5
    },
    "client": {
        "default_route": "status",
        "inactive_logoff": 30,
        "theme": "hoobs-light",
        "locale": "en",
        "temp_units": "celsius",
        "country_code": "GB",
        "postal_code": "xxxxxx"
    },
    "bridge": {
        "name": "HOOBS",
        "username": "CC:22:3D:E3:CE:30",
        "port": 51826,
        "pin": "031-45-154"
    },
    "description": "This file is used for plugin configuration.",
    "ports": {},
    "accessories": [
        {
            "accessory": "HiveThermostat",
            "username": "xxxxxx",
            "password": "xxxxxx",
            "name": "Hive Thermostat",
            "plugin_map": {
                "plugin_name": "homebridge-hive",
                "index": 0
            }
        }
    ],
    "platforms": [
        {
            "name": "SmartThings",
            "app_url": "https://graph-eu01-euwest1.api.smartthings.com:443/api/smartapps/installations/",
            "app_id": "xxxxxxxxx",
            "access_token": "xxxxx",
            "direct_ip": "xxxxxx",
            "direct_port": 8000,
            "debug": true,
            "update_method": "direct",
            "platform": "SmartThings"
        }
    ]
}

Post your log

[2/2/2020, 8:32:39 PM] HOOBS listning on port 8080.
[Homebridge] [2/2/2020, 8:32:56 PM] Loaded config.json with 1 accessories and 1 platforms.
[Homebridge] [2/2/2020, 8:32:56 PM] Loaded plugin: "homebridge-hive"
[Homebridge] [2/2/2020, 8:32:56 PM] Registering accessory "homebridge-hive.HiveThermostat"
[Homebridge] [2/2/2020, 8:32:57 PM] Loaded plugin: "homebridge-smartthings-tonesto7"
[Homebridge] Homebridge Version: 2.4
[Homebridge] [2/2/2020, 8:32:57 PM] Registering platform "homebridge-smartthings.SmartThings"
[Homebridge] [2/2/2020, 8:32:57 PM] Loading 1 platforms...
[Homebridge] [2/2/2020, 8:32:57 PM] [SmartThings] Initializing SmartThings platform...
[Homebridge] [2/2/2020, 8:32:57 PM] [SmartThings] Fetching SmartThings devices.
[Homebridge] [2/2/2020, 8:32:57 PM] Loading 1 accessories...
[Homebridge] [2/2/2020, 8:32:57 PM] [Hive Thermostat] Initializing HiveThermostat accessory...
[Homebridge] [2/2/2020, 8:32:57 PM] [Hive Thermostat] Logging into Hive...
[Homebridge] [2/2/2020, 8:32:57 PM] API launched
[Homebridge] error at req:  getaddrinfo EAI_AGAIN graph-eu01-euwest1.api.smartthings.com graph-eu01-euwest1.api.smartthings.com:443
[Homebridge] [2/2/2020, 8:32:57 PM] [SmartThings] Invalid Response from API call
[Homebridge] [2/2/2020, 8:32:57 PM] [SmartThings] Unknown Capabilities: []
[Homebridge] [2/2/2020, 8:32:57 PM] [SmartThings] update_method: direct
[Homebridge] [2/2/2020, 8:32:58 PM] Service is running on port 51826.
[Homebridge] [2/2/2020, 8:32:58 PM] [SmartThings] Direct Connect Is Listening On xxxxx:8000
[Homebridge] error at req:  getaddrinfo EAI_AGAIN graph-eu01-euwest1.api.smartthings.com graph-eu01-euwest1.api.smartthings.com:443
[Homebridge] [2/2/2020, 8:32:58 PM] [Hive Thermostat] Could not log into Hive
[Homebridge] [2/2/2020, 8:32:58 PM] [Hive Thermostat] JSON Parse Error
undefined
[Homebridge] [2/2/2020, 8:33:22 PM] [SmartThings] Change Event: (Living Room Motion Sensor) [MOTION] is inactive
[Homebridge] [2/2/2020, 8:33:22 PM] [SmartThings] Change Event: (Living Room Motion Sensor) [MOTION] is active
[Homebridge] [2/2/2020, 8:33:22 PM] [SmartThings] Change Event: (Conservatory Thermostat) [TEMPERATURE] is 25.0
[Homebridge] [2/2/2020, 8:33:23 PM] [Hive Thermostat] Failed to read stateHeatingRelay
[Homebridge] [2/2/2020, 8:33:23 PM] [Hive Thermostat] Current state is 0
[Homebridge] [2/2/2020, 8:33:23 PM] [Hive Thermostat] Fetching data from Hive API
[Homebridge] [2/2/2020, 8:33:23 PM] [Hive Thermostat] Failed to read activeHeatCoolMode
[Homebridge] [2/2/2020, 8:33:23 PM] [Hive Thermostat] Target state is 0
[Homebridge] [2/2/2020, 8:33:23 PM] [Hive Thermostat] Unable to find temperature
[Homebridge] [2/2/2020, 8:33:23 PM] [Hive Thermostat] Failed to read targetHeatTemperature
[Homebridge] [2/2/2020, 8:33:23 PM] [Hive Thermostat] Target temperature is -30
[Homebridge] [2/2/2020, 8:33:29 PM] [Hive Thermostat] Logging into Hive...
[Homebridge] [2/2/2020, 8:33:32 PM] [SmartThings] Change Event: (Living Room Motion Sensor) [MOTION] is inactive
[Homebridge] [2/2/2020, 8:33:43 PM] [Hive Thermostat] Fetching data from Hive API
[Homebridge] [2/2/2020, 8:33:49 PM] [Hive Thermostat] Current state is 0
[Homebridge] [2/2/2020, 8:33:49 PM] Error: This callback function has already been called by someone else; it can only be called one time.
    at /home/hoobs/.hoobs/node_modules/@hoobs/hap/lib/util/once.js:12:13
    at HiveThermostat.<anonymous> (/home/hoobs/.hoobs/node_modules/homebridge-hive/index.js:221:6)
    at HiveThermostat.<anonymous> (/home/hoobs/.hoobs/node_modules/homebridge-hive/index.js:119:30)
    at HiveThermostat.<anonymous> (/home/hoobs/.hoobs/node_modules/homebridge-hive/index.js:140:8)
    at Request.self.callback (/home/hoobs/.hoobs/node_modules/homebridge-hive/node_modules/request/request.js:185:22)
    at Request.emit (events.js:198:13)
    at Request.<anonymous> (/home/hoobs/.hoobs/node_modules/homebridge-hive/node_modules/request/request.js:1161:10)
    at Request.emit (events.js:198:13)
    at IncomingMessage.<anonymous> (/home/hoobs/.hoobs/node_modules/homebridge-hive/node_modules/request/request.js:1083:12)
    at Object.onceWrapper (events.js:286:20)
    at IncomingMessage.emit (events.js:203:15)
    at endReadableNT (_stream_readable.js:1129:12)
    at process._tickCallback (internal/process/next_tick.js:63:19)
[Homebridge] [2/2/2020, 8:33:49 PM] Got SIGTERM, shutting down service...

Additional context

If I then go and click 'Start Service' the service starts up fine:

[Homebridge] [2/2/2020, 8:34:09 PM] Loaded config.json with 1 accessories and 1 platforms.
[Homebridge] [2/2/2020, 8:34:10 PM] Loaded plugin: "homebridge-hive"
[Homebridge] [2/2/2020, 8:34:10 PM] Registering accessory "homebridge-hive.HiveThermostat"
[Homebridge] [2/2/2020, 8:34:11 PM] Loaded plugin: "homebridge-smartthings-tonesto7"
[Homebridge] Homebridge Version: 2.4
[Homebridge] [2/2/2020, 8:34:11 PM] Registering platform "homebridge-smartthings.SmartThings"
[Homebridge] [2/2/2020, 8:34:11 PM] Loading 1 platforms...
[Homebridge] [2/2/2020, 8:34:11 PM] [SmartThings] Initializing SmartThings platform...
[Homebridge] [2/2/2020, 8:34:11 PM] [SmartThings] Fetching SmartThings devices.
[Homebridge] [2/2/2020, 8:34:11 PM] Loading 1 accessories...
[Homebridge] [2/2/2020, 8:34:11 PM] [Hive Thermostat] Initializing HiveThermostat accessory...
[Homebridge] [2/2/2020, 8:34:11 PM] [Hive Thermostat] Logging into Hive...
[Homebridge] [2/2/2020, 8:34:11 PM] API launched
[Homebridge] [2/2/2020, 8:34:16 PM] [Hive Thermostat] Logged In
[Homebridge] [2/2/2020, 8:34:16 PM] [Hive Thermostat] Fetching data from Hive API
[Homebridge] [2/2/2020, 8:34:20 PM] [SmartThings] Unknown Capabilities: ["Tone","Signal Strength","Power Source","Three Axis","Smoke Detector","Occupancy Sensor","Outlet","Timed Session","Window Shade Preset","WindowShade"]
[Homebridge] [2/2/2020, 8:34:21 PM] [SmartThings] update_method: direct
[Homebridge] [2/2/2020, 8:34:21 PM] Service is running on port 51826.
[Homebridge] [2/2/2020, 8:34:21 PM] [SmartThings] Direct Connect Is Listening On xxxxx:8000
[Homebridge] [2/2/2020, 8:34:22 PM] [Hive Thermostat] Found thermostat 74aebe67-002a-4b4d-a4cc-edc9db955e02. Current temperature is 21.2, set to 20
[Homebridge] [2/2/2020, 8:34:26 PM] [SmartThings] SmartThings Hub Communication Established
mayhew132 commented 4 years ago

Another note, every time the Homebridge server is reset it forgets all the Room/Device type configuration in the iOS Home app.

mayhew132 commented 4 years ago

Since upgrading to SmartThings Homebridge v2 plugin and deleting the homebridge-hive plugin the issue seems to have been resolved. It must be an incompatibility with the new version on the legacy Hive plugin.