homekit2mqtt icon indicating copy to clipboard operation
homekit2mqtt copied to clipboard

AirPurifier Service causing crash

Open sillyfrog opened this issue 6 years ago • 1 comments

I'm having an issue getting the AirPurifier service going at all.

I have cut it down to the bare minimum (as below), and getting this error:

2019-02-10 16:25:57.225 <info>  homekit2mqtt 1.1.2 starting
2019-02-10 16:25:57.227 <info>  mqtt trying to connect mqtt://127.0.0.1
2019-02-10 16:25:57.325 <info>  using hap-nodejs version 0.4.47
2019-02-10 16:25:57.341 <debug> mqtt subscribe #
2019-02-10 16:25:57.358 <info>  http server listening on port 51888
2019-02-10 16:25:57.360 <info>  mqtt offline
2019-02-10 16:25:58.345 <debug> mqtt unsubscribe #
2019-02-10 16:25:58.349 <info>  loading HomeKit to MQTT mapping file /homekit2mqtt/homekit2mqtt.json
2019-02-10 16:25:58.351 <debug> creating new accessory "Some Room" "parent" d8fd39d0-bbdd-42dc-b322-d8b11390a4c5
2019-02-10 16:25:58.356 <debug> loading services/AirPurifier.js
2019-02-10 16:25:58.357 <debug> adding service AirPurifier to accessory Some Room
/usr/lib/node_modules/homekit2mqtt/characteristics/index.js:28
    const characteristic = service.getCharacteristic(Characteristic[charName]);
                                  ^

TypeError: Cannot read property 'getCharacteristic' of undefined
    at module.exports (/usr/lib/node_modules/homekit2mqtt/characteristics/index.js:28:35)
    at Object.createService_AirPurifier [as AirPurifier] (/usr/lib/node_modules/homekit2mqtt/services/AirPurifier.js:17:38)
    at accConfig.services.forEach (/usr/lib/node_modules/homekit2mqtt/index.js:348:34)
    at Array.forEach (native)
    at Object.keys.forEach.id (/usr/lib/node_modules/homekit2mqtt/index.js:337:28)
    at Array.forEach (native)
    at createBridge (/usr/lib/node_modules/homekit2mqtt/index.js:330:26)
    at Timeout.start [as _onTimeout] (/usr/lib/node_modules/homekit2mqtt/index.js:454:5)
    at ontimeout (timers.js:386:11)
    at tryOnTimeout (timers.js:250:5)
{
  "parent": {
    "id": "room",
    "name": "Some Room",
    "category": 1,
    "payloadIdentify": "",
    "services": [
      {
        "name": "AP",
        "service": "AirPurifier",
        "topic": {
        },
        "json": {
        },
        "payload": {
        },
        "config": {},
        "props": {}
      }
    ]
  }
}

I'm running with node v6.16.0. And have a bunch of other accessories that are working fine.

I have tried a bunch of things (obviously including what I think is a valid config, using the web UI and manual creation), and I can't get anything to work.

I've also looked at the code - but don't know node at all and have not even figured out how anything works. Not sure what else to try at this stage - if you can provide any assistance that would be appreciated.

Thanks!

sillyfrog avatar Feb 10 '19 06:02 sillyfrog

I have noticed that the "FanV2" offers similar functionality, and it's working - so I'm using that for the moment. I'm guessing the clue for the fix is going to be there, I plan to look when I get a chance. Cheers

sillyfrog avatar Feb 13 '19 04:02 sillyfrog