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
53 stars 16 forks source link

Item type was not synced initially and is therefore not available #66

Closed DerHexer closed 4 years ago

DerHexer commented 4 years ago

I'm running the latest version of Openhab 2 (1.5), Homebridge, homebridge-openhab2-complete and Node. Unfortunately I'm having the following error message, when starting Homebridge: "Unable to add accessory Sofa: Error: Not configuring binary sensor characteristic for Sofa: Item type was not synced initially and is therefore not available, skipping"

See the log below:

[17:59:18] pi@raspberrypi:~$ homebridge -I
[2020-1-1 18:00:32] Loaded config.json with 0 accessories and 2 platforms.
[2020-1-1 18:00:32] ---
[2020-1-1 18:00:32] Loaded plugin: homebridge-config-ui-x
[2020-1-1 18:00:32] Registering platform 'homebridge-config-ui-x.config'
[2020-1-1 18:00:32] ---
[2020-1-1 18:00:33] Loaded plugin: homebridge-openhab2-complete
[2020-1-1 18:00:33] Registering platform 'homebridge-openhab2-complete.openHAB2-Complete'
[2020-1-1 18:00:33] ---
[2020-1-1 18:00:33] Loading 2 platforms...
[2020-1-1 18:00:33] [openHAB2-Complete] Initializing openHAB2-Complete platform...
[2020-1-1 18:00:33] [openHAB2-Complete] Loading accessory types...
[2020-1-1 18:00:33] [openHAB2-Complete] Loading and activating accessory type airpurifier
[2020-1-1 18:00:33] [openHAB2-Complete] Loading and activating accessory type air
[2020-1-1 18:00:33] [openHAB2-Complete] Loading and activating accessory type co2
[2020-1-1 18:00:33] [openHAB2-Complete] Loading and activating accessory type co
[2020-1-1 18:00:33] [openHAB2-Complete] Loading and activating accessory type contact
[2020-1-1 18:00:33] [openHAB2-Complete] Loading and activating accessory type door
[2020-1-1 18:00:33] [openHAB2-Complete] Loading and activating accessory type fan
[2020-1-1 18:00:33] [openHAB2-Complete] Loading and activating accessory type faucet
[2020-1-1 18:00:33] [openHAB2-Complete] Loading and activating accessory type filter
[2020-1-1 18:00:33] [openHAB2-Complete] Loading and activating accessory type garage
[2020-1-1 18:00:33] [openHAB2-Complete] Loading and activating accessory type heatercooler
[2020-1-1 18:00:33] [openHAB2-Complete] Loading and activating accessory type humidifier
[2020-1-1 18:00:33] [openHAB2-Complete] Loading and activating accessory type humidity
[2020-1-1 18:00:33] [openHAB2-Complete] Loading and activating accessory type irrigation
[2020-1-1 18:00:33] [openHAB2-Complete] Loading and activating accessory type leak
[2020-1-1 18:00:33] [openHAB2-Complete] Loading and activating accessory type light
[2020-1-1 18:00:33] [openHAB2-Complete] Loading and activating accessory type lux
[2020-1-1 18:00:33] [openHAB2-Complete] Loading and activating accessory type lock
[2020-1-1 18:00:33] [openHAB2-Complete] Loading and activating accessory type microphone
[2020-1-1 18:00:33] [openHAB2-Complete] Loading and activating accessory type motion
[2020-1-1 18:00:33] [openHAB2-Complete] Loading and activating accessory type occupancy
[2020-1-1 18:00:33] [openHAB2-Complete] Loading and activating accessory type outlet
[2020-1-1 18:00:33] [openHAB2-Complete] Loading and activating accessory type security
[2020-1-1 18:00:33] [openHAB2-Complete] Loading and activating accessory type slat
[2020-1-1 18:00:33] [openHAB2-Complete] Loading and activating accessory type smoke
[2020-1-1 18:00:33] [openHAB2-Complete] Loading and activating accessory type speaker
[2020-1-1 18:00:33] [openHAB2-Complete] Loading and activating accessory type switch
[2020-1-1 18:00:33] [openHAB2-Complete] Loading and activating accessory type temp
[2020-1-1 18:00:33] [openHAB2-Complete] Loading and activating accessory type thermostat
[2020-1-1 18:00:33] [openHAB2-Complete] Loading and activating accessory type valve
[2020-1-1 18:00:33] [openHAB2-Complete] Loading and activating accessory type window
[2020-1-1 18:00:33] [openHAB2-Complete] Loading and activating accessory type windowcovering
[2020-1-1 18:00:33] [openHAB2-Complete] Waiting for openHAB host (http://192.168.160.84) to come online...
[2020-1-1 18:00:46] [openHAB2-Complete] openHAB host (http://192.168.160.84) is online, now syncing...
[2020-1-1 18:00:46] [openHAB2-Complete] Syncing all items & types from openHAB
[2020-1-1 18:00:47] [openHAB2-Complete] 'OpenHAB2 - Complete Edition' plugin loaded - Version 1.1.0
[2020-1-1 18:00:47] [openHAB2-Complete] ---
[2020-1-1 18:00:47] [openHAB2-Complete] Loading accessories from configuration, this might take a while...
[2020-1-1 18:00:47] [openHAB2-Complete] Unable to add accessory Sofa: Error: Not configuring binary sensor characteristic for Sofa: Item type was not synced initially and is therefore not available, skipping
[2020-1-1 18:00:47] [openHAB2-Complete] Syncing all item values from openHAB
[2020-1-1 18:00:47] [openHAB2-Complete] Finished loading 0 accessories from configuration
[2020-1-1 18:00:47] [openHAB2-Complete] ---
[2020-1-1 18:00:47] [Config] Initializing config platform...
[2020-1-1 18:00:47] [Config] Spawning homebridge-config-ui-x with PID 2009

The config looks like this: `

[...]
    "platforms": [
    {
            "platform": "openHAB2-Complete",
            "host": "http://192.168.160.84",
            "port": "8080",
            "accessories": [

                {
                    "name": "Sofa",
                    "type": "motion",
                    "item": "Switch_Sofa"
                }
            ]
       },

[...]

"Switch_Sofa" is the name used in openHAB2: Switch Switch_Sofa "Sofa" <switch> [ "Switchable" ]{ channel="hue:0010:XXXXXXXXXXX:XX:switch" }

I tried reinstalling a couple of times, changed the node version but still can't get it to work.

Any advise?

steilerDev commented 4 years ago

Could you please start homebridge in debug mode. This should expand the log and reveal the issue.

Regards,

Frank

steilerDev commented 4 years ago

Error happens in

https://github.com/steilerDev/homebridge-openhab2-complete/blob/826d797137dbea62f41afda268aed616d59e2f16/util/Accessory.js#L79-L85

with root potentially in

https://github.com/steilerDev/homebridge-openhab2-complete/blob/826d797137dbea62f41afda268aed616d59e2f16/util/OpenHAB.js#L189-L208

or

https://github.com/steilerDev/homebridge-openhab2-complete/blob/826d797137dbea62f41afda268aed616d59e2f16/util/OpenHAB.js#L307-L316

Debug logs required!

lonione commented 4 years ago

Hi, I'm seeing the same issue on a number of newly configured items. Debug logs show the following:

[2/24/2020, 5:38:49 PM] [openHAB2-Complete] Found accessory in config: 'Patio lights' (light)
[2/24/2020, 5:38:49 PM] [openHAB2-Complete] Creating new accessory: Patio lights
[2/24/2020, 5:38:49 PM] [openHAB2-Complete] Trying battery service for Patio lights
[2/24/2020, 5:38:49 PM] [openHAB2-Complete] Not configuring battery service for Patio lights: Not configuring battery warning characteristic for Patio lights: Required batteryItem for Patio lights not
 defined: {"item":"nikohomecontrol_onOff_address_intentionally_removed","name":"Patio lights","type":"light","serialNumber":"************","version":"1.1.0"}
[2/24/2020, 5:38:49 PM] [openHAB2-Complete] Creating lightbulb service for Patio lights
[2/24/2020, 5:38:49 PM] [openHAB2-Complete] Checking cache for nikohomecontrol_onOff_address_intentionally_removed
[2/24/2020, 5:38:49 PM] [openHAB2-Complete] No value stored for key nikohomecontrol_onOff_address_intentionally_removed
[2/24/2020, 5:38:49 PM] [openHAB2-Complete] Unable to add accessory Patio lights: Error: Not configuring binary characteristic for Patio lights: Item type was not synced initially and is therefore not
 available, skipping

Running openhab 2.5.2 + homebridge 0.4.50

lonione commented 4 years ago

I found the cause of the issue in my case: I referred incorrectly to the item. My "item" reference pointed to the openhab thing, not the channel. After correcting this, the error went away and the accessory was created and works fine.

Hi, I'm seeing the same issue on a number of newly configured items. Debug logs show the following:

[2/24/2020, 5:38:49 PM] [openHAB2-Complete] Found accessory in config: 'Patio lights' (light)
[2/24/2020, 5:38:49 PM] [openHAB2-Complete] Creating new accessory: Patio lights
[2/24/2020, 5:38:49 PM] [openHAB2-Complete] Trying battery service for Patio lights
[2/24/2020, 5:38:49 PM] [openHAB2-Complete] Not configuring battery service for Patio lights: Not configuring battery warning characteristic for Patio lights: Required batteryItem for Patio lights not
 defined: {"item":"nikohomecontrol_onOff_address_intentionally_removed","name":"Patio lights","type":"light","serialNumber":"************","version":"1.1.0"}
[2/24/2020, 5:38:49 PM] [openHAB2-Complete] Creating lightbulb service for Patio lights
[2/24/2020, 5:38:49 PM] [openHAB2-Complete] Checking cache for nikohomecontrol_onOff_address_intentionally_removed
[2/24/2020, 5:38:49 PM] [openHAB2-Complete] No value stored for key nikohomecontrol_onOff_address_intentionally_removed
[2/24/2020, 5:38:49 PM] [openHAB2-Complete] Unable to add accessory Patio lights: Error: Not configuring binary characteristic for Patio lights: Item type was not synced initially and is therefore not
 available, skipping

Running openhab 2.5.2 + homebridge 0.4.50