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

TypeError: Cannot read property 'forEach' of undefined #30

Closed hartmood closed 5 years ago

hartmood commented 5 years ago

Describe the bug Homebridge Openhab2 Complete not loading

Configurations

  "bridge": {
    "name": "openHAB2",
    "username": "CC:22:3D:E3:CE:30",
    "port": 51826,
    "pin": "031-45-154"
  },

  "accessories": [
  ],

  "platforms": [
    {
      "platform": "openHAB2-Complete",
      "name": "openHAB2",
      "host": "192.168.179.90",
      "port": "8080",
      "sitemap": "Home"
    }
  ]
}

Logs:

[6/21/2019, 3:56:12 PM] TypeError: Cannot read property 'forEach' of undefined
    at OpenHABComplete.accessories (/usr/lib/node_modules/homebridge-openhab2-complete/index.js:85:23)
    at Server._loadPlatformAccessories (/usr/lib/node_modules/homebridge/lib/server.js:403:20)
    at Server._loadPlatforms (/usr/lib/node_modules/homebridge/lib/server.js:341:16)
    at Server.run (/usr/lib/node_modules/homebridge/lib/server.js:90:36)
    at module.exports (/usr/lib/node_modules/homebridge/lib/cli.js:59:10)
    at Object.<anonymous> (/usr/lib/node_modules/homebridge/bin/homebridge:17:22)
    at Module._compile (internal/modules/cjs/loader.js:689:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)

Environment (please complete the following information):

steilerDev commented 5 years ago

Your config.json is not correct. You are using the configuration of the other Homebridge OpenHAB plugin but my npm module.

Check out my README on how to correctly configure the plugin, or use the other plugin :)

hartmood commented 5 years ago

Thanks @steilerDev - There was also a bug with my Homebridge installation. I have it running now, at least with the switches that appear in my home app on iOS. However, my thermostats are ignored for some reason.


{
  "bridge": {
    "name": "Homebridge",
    "username": "CC:22:3D:E3:CE:30",
    "port": 51826,
    "pin": "031-45-154"
  },
  "ports": {
    "start": 52100,
    "end": 52150
  },
  "platforms": [
    {
      "platform": "openHAB2-Complete",
      "name": "openHAB",
      "host": "192.168.179.90",
      "port": "8080",
      "sitemap": "Home",
      "useLabelForName": true,
      "accessories": [
        {
          "type": "switch",
          "items": [
            {
              "name": "Alarm",
              "item": "Alarm"
            },
            {
              "name": "Wifi 2.4",
              "item": "fboxWifi24"
            }
          ]
        },
        {
          "type": "thermostat",
          "items": [
            {
              "name": "Thermostat EG",
              "currentTempItem": "zwave_device_414e6662_node14_sensor_temperature",
              "targetTempItem": "zwave_device_414e6662_node14_setpoint_heating",
              "tempUnit": "Celsius"
            },
            {
              "name": "Thermostat DG",
              "currentTempItem": "zwave_device_414e6662_node15_sensor_temperature",
              "targetTempItem": "zwave_device_414e6662_node15_setpoint_heating",
              "tempUnit": "Celsius"
            }
          ]
        }
      ]
    }
  ]
}
steilerDev commented 5 years ago

If you look into the log you can see an error along the lines of "heatingItem or cooling Item is required".

You have to specify a switch that shows, if the device is currently heating and/or cooling.

hartmood commented 5 years ago

@steilerDev Makes sense, thanks. Unfortunately my z-wave Thermostats from Eurotronic do not support this. See screenshot. Can I use a virtual switch that is set by a rule based on the dimmer?

Bildschirmfoto 2019-06-25 um 13 51 33
steilerDev commented 5 years ago

Of course you can use a virtual switch. Alternatively, if you don't care about seeing, if the thermostat is heating, just create a switch that is permanently off.