Zacknetic / HomebridgeMagicHome-DynamicPlatform

Homebridge Plugin for MagicHome LED controllers and light bulbs
Apache License 2.0
61 stars 11 forks source link

[BUG] Blacklist Error on Startup #78

Closed fototeddy closed 3 years ago

fototeddy commented 3 years ago

Hey,

I just tried to install your Plugin into my Homebridge / HOOBS

direkt after install I got the following output in the Log

31.12.2020, 16:36:34 (node:81725) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'blacklistedUniqueIDs' of undefined
31.12.2020, 16:36:34 at HomebridgeMagichomeDynamicPlatform.isAllowed (/root/.hoobs/node_modules/homebridge-magichome-dynamic-platform/dist/platform.js:239:67)
31.12.2020, 16:36:34 at HomebridgeMagichomeDynamicPlatform.createNewAccessory (/root/.hoobs/node_modules/homebridge-magichome-dynamic-platform/dist/platform.js:324:19)
31.12.2020, 16:36:34 at runMicrotasks (<anonymous>)
31.12.2020, 16:36:34 at processTicksAndRejections (internal/process/task_queues.js:93:5)
31.12.2020, 16:36:34 (node:81725) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 9)
31.12.2020, 16:37:04 (node:81725) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'blacklistedUniqueIDs' of undefined
31.12.2020, 16:37:04 at HomebridgeMagichomeDynamicPlatform.isAllowed (/root/.hoobs/node_modules/homebridge-magichome-dynamic-platform/dist/platform.js:239:67)
31.12.2020, 16:37:04 at HomebridgeMagichomeDynamicPlatform.createNewAccessory (/root/.hoobs/node_modules/homebridge-magichome-dynamic-platform/dist/platform.js:324:19)
31.12.2020, 16:37:04 at runMicrotasks (<anonymous>)
31.12.2020, 16:37:04 at processTicksAndRejections (internal/process/task_queues.js:93:5)
31.12.2020, 16:37:04 (node:81725) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 10)

so the Plugin is not working. Any idea what I can do?

I Use Node v14.13.0 an HOOBS 3.3.1

Zacknetic commented 3 years ago

Looks like the config has been setup in an odd way. Could you please upload your config.json so I can repair it?

On Thu, Dec 31, 2020 at 10:42 AM fototeddy notifications@github.com wrote:

Hey,

I just tried to install your Plugin into my Homebridge / HOOBS

direkt after install I got the following output in the Log

31.12.2020, 16:36:34 (node:81725) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'blacklistedUniqueIDs' of undefined 31.12.2020, 16:36:34 at HomebridgeMagichomeDynamicPlatform.isAllowed (/root/.hoobs/node_modules/homebridge-magichome-dynamic-platform/dist/platform.js:239:67) 31.12.2020, 16:36:34 at HomebridgeMagichomeDynamicPlatform.createNewAccessory (/root/.hoobs/node_modules/homebridge-magichome-dynamic-platform/dist/platform.js:324:19) 31.12.2020, 16:36:34 at runMicrotasks () 31.12.2020, 16:36:34 at processTicksAndRejections (internal/process/task_queues.js:93:5) 31.12.2020, 16:36:34 (node:81725) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 9) 31.12.2020, 16:37:04 (node:81725) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'blacklistedUniqueIDs' of undefined 31.12.2020, 16:37:04 at HomebridgeMagichomeDynamicPlatform.isAllowed (/root/.hoobs/node_modules/homebridge-magichome-dynamic-platform/dist/platform.js:239:67) 31.12.2020, 16:37:04 at HomebridgeMagichomeDynamicPlatform.createNewAccessory (/root/.hoobs/node_modules/homebridge-magichome-dynamic-platform/dist/platform.js:324:19) 31.12.2020, 16:37:04 at runMicrotasks () 31.12.2020, 16:37:04 at processTicksAndRejections (internal/process/task_queues.js:93:5) 31.12.2020, 16:37:04 (node:81725) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 10)```

so the Plugin is not working. Any idea what I can do?

I Use Node v14.13.0 an HOOBS 3.3.1

— You are receiving this because you were assigned. Reply to this email directly, view it on GitHub https://github.com/Zacknetic/HomebridgeMagicHome-DynamicPlatform/issues/78, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABLCJV4XIBXEASEH6Y6Z3GDSXSLU3ANCNFSM4VPQRUIQ .

fototeddy commented 3 years ago

That Happend Right After installing the Plugin Without any additional Config Settings

Zacknetic commented 3 years ago

Got it. Could you please upload your config.json so I can repair it?

fototeddy commented 3 years ago

so this is my config that throws the errors

{
    "server": {
        "port": 80,
        "origin": "*",
        "autostart": 0,
        "home_setup_id": "XXXXXXXXXX",
        "polling_seconds": 5
    },
    "client": {
        "default_route": "status",
        "inactive_logoff": 30,
        "theme": "hoobs-light",
        "locale": "de",
        "temp_units": "celsius",
        "country_code": "DE",
        "postal_code": "xxxxx"
    },
    "bridge": {
        "name": "HOOBS",
        "port": XXXXXXXXXX,
        "pin": "XXXXXXXXXX",
        "manufacturer": "homebridge.io",
        "model": "homebridge",
        "username": "XXXXXXXXXX"
    },
    "description": "",
    "ports": {},
    "accessories": [
        {
            "accessory": "mqttthing",
            "type": "weatherStation",
            "name": "TuyaTemp",
            "url": "mqtt://192.168.5.xxx:1883",
            "topics": {
                "getCurrentTemperature": {
                    "topic": "tele/zbb/SENSOR",
                    "apply": "if (JSON.parse(message).ZbReceived['TuyaTemp']) { return JSON.parse(message).ZbReceived['TuyaTemp'].Temperature;}"
                },
                "getCurrentRelativeHumidity": {
                    "topic": "tele/zbb/SENSOR",
                    "apply": "if (JSON.parse(message).ZbReceived['TuyaTemp']) { return JSON.parse(message).ZbReceived['TuyaTemp'].Humidity;}"
                },
                "getBatteryLevel": {
                    "topic": "tele/zbb/SENSOR",
                    "apply": "if (JSON.parse(message).ZbReceived['TuyaTemp']) { return JSON.parse(message).ZbReceived['TuyaTemp'].BatteryPercentage;}"
                }
            },
            "history": "true"
        }
    ],
    "platforms": [

        {
            "platform": "homebridge-magichome-dynamic-platform",
            "plugin_map": {
                "plugin_name": "homebridge-magichome-dynamic-platform"
            },
            "pruning": {
                "pruneMissingCachedAccessories": false,
                "restartsBeforeMissingAccessoriesPruned": 3,
                "pruneAllAccessoriesNextRestart": false
            },
            "whiteEffects": {
                "simultaniousDevicesColorWhite": true,
                "colorWhiteThreshold": 10,
                "colorWhiteThresholdSimultaniousDevices": 50,
                "colorOffThresholdSimultaniousDevices": 5
            },
            "deviceManagement": {
                "blacklistOrWhitelist": "blacklist",
                "blacklistedUniqueIDs": []
            },
            "advancedOptions": {
                "namesWithMacAddress": false
            }
        }
    ]
}
Zacknetic commented 3 years ago

Got it, could you please change

"blacklistedUniqueIDs": []

to

"blacklistedUniqueIDs": [ " " ]

Let me know if this solves your issue. Somehow, that was missing. I will add a check for undefined config variables next push.

fototeddy commented 3 years ago

alright, that worked. Thx maybe the " " for blacklistedUniqueIDs can be added to the default config settings that are generated during installation