rnilssoncx / homebridge-pico

Expose Lutron Pico Remotes in Homebridge: https://github.com/nfarina/homebridge
MIT License
63 stars 6 forks source link

New install issues #16

Closed DeltaEchoFour closed 3 years ago

DeltaEchoFour commented 3 years ago

I have a fully updated Homebridge 1.2.5 install running on a Pi 4. Using several plugins without issue.

I added homebridge-pico using config-ui-x. I set my hub’s IP address and bus logging to monitor in the config UI. I then restarted homebridge, only for it to fail to restart.

The following error is being logged:

TypeError: this.servers[key].switches is not iterable

This seems related to the empty switch block the UI sets up in config.json. If I remove the empty block by hand, I get a similar but different error about switches not being iterable.

How can I go about monitoring for the information I need to setup a pico?

Thanks!

rnilssoncx commented 3 years ago

I just tested with a server configured but no switches. Homebridge loads fine and I can monitor the bus as expected. You can just cut and past the pico config below to get started.

If you could post the config that was created and is causing your a problem I can take a look and see if there's something that can be improved for these initial setups.

{
    "bridge": {
        "name": "Homebridge xxxx",
        "username": "xx:xx:xx:xx:xx:xx",
        "port": 51524,
        "pin": "xxx-xx-xxx"
    },
    "accessories": [],
    "platforms": [
        {
            "name": "Config",
            "port": 8080,
            "platform": "config"
        },
        {
            "buslog": "monitor",
            "servers": [
                {
                    "switches": [
                    ],
                    "host": "x.x.x.x",
                    "port": 23
                }
            ],
            "platform": "Pico"
        }
    ]
}
DeltaEchoFour commented 3 years ago

Here's the snippet that's created by config-ui-x on a new install and having set buslog to Monitor and the IP address of the server.

{ "buslog": "monitor", "servers": [ { "switches": [ { "pico": [] } ], "host": "192.168.7.218", "port": 23 } ], "longname": false, "platform": "Pico" }

This causes the this error:

[01/02/2021, 23:12:03] TypeError: types[this.type] is not iterable at PicoRemote.getServices (/usr/local/lib/node_modules/homebridge-pico/accessory.js:71:29) at Server.createHAPAccessory (/usr/local/lib/node_modules/homebridge/src/server.ts:448:41) at /usr/local/lib/node_modules/homebridge/src/server.ts:433:34 at Array.forEach () at /usr/local/lib/node_modules/homebridge/src/server.ts:423:21 at /usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/src/lib/util/once.ts:10:18 at Pico.accessories (/usr/local/lib/node_modules/homebridge-pico/index.js:65:5) at /usr/local/lib/node_modules/homebridge/src/server.ts:418:24 at new Promise () at Server.loadPlatformAccessories (/usr/local/lib/node_modules/homebridge/src/server.ts:412:12) at /usr/local/lib/node_modules/homebridge/src/server.ts:400:28 at Array.forEach () at Server.loadPlatforms (/usr/local/lib/node_modules/homebridge/src/server.ts:372:27) at Server.start (/usr/local/lib/node_modules/homebridge/src/server.ts:151:29) at cli (/usr/local/lib/node_modules/homebridge/src/cli.ts:80:10) at Object. (/usr/local/lib/node_modules/homebridge/bin/homebridge:17:22)

DeltaEchoFour commented 3 years ago

Pasting this into config.json and updating the IP address does work!

    {
        "buslog": "monitor",
        "servers": [
            {
                "switches": [
                ],
                "host": "x.x.x.x",
                "port": 23
            }
        ],
        "platform": "Pico"
    }
]

}

rnilssoncx commented 3 years ago

This should now be fixed.