entmike / homebridge-cmdaccessory

Command plugin for HomeBridge to appear as different accessories (Switch, Lock, Window Blinds, Lights, etc)
16 stars 5 forks source link

Homebridge crashes every time #8

Open iPhilBln opened 6 years ago

iPhilBln commented 6 years ago

Everytime I got this error message after I unlock the LockMachanism:

[2018-8-25 19:04:58] Homebridge is running on port 51826.
[2018-8-25 19:05:16] [Haustür] Haustür is on.
[2018-8-25 19:05:16] [Haustür] Haustür is on.
[2018-8-25 19:06:17] [Haustür] 0
[2018-8-25 19:06:17] [Haustür] Haustür is turned off.
[2018-8-25 19:06:18] [Haustür] This probably won't work yet.
/usr/lib/node_modules/homebridge-cmdaccessory/index.js:309
                self.accessories[thisSwitch.name].getService(Service[that.config.type])
                                                                                 ^

TypeError: Cannot read property 'type' of undefined
    at Timeout._onTimeout (/usr/lib/node_modules/homebridge-cmdaccessory/index.js:309:70)
    at ontimeout (timers.js:498:11)
    at tryOnTimeout (timers.js:323:5)
    at Timer.listOnTimeout (timers.js:290:5)

This is my config.json:

{  
         "platform":"cmdAccessory",
         "name":"Haustür",
         "switches":[  
            {  
               "name":"Haustür",
               "off_cmd":"/home/pi/Haustür/haustür1.sh",
               "polling":true,
               "interval":1,
               "manufacturer":"Apple",
               "type":"LockMechanism"
            }
         ]
      },

Whats wrong?

oskameDEV commented 5 years ago

I'm trying out this plugin myself and had the same issue, adding

"off_cmd": "0", "state_cmd": "0",

to each accessory will get rid of that error, not sure what is better to put there than a 0

iPhilBln commented 5 years ago

For me the best way was to put in an empty bash script.