pkmnct / homebridge-television-universal-control

This Homebridge plugin enables control of one or more compatible devices using one "Television" in HomeKit.
Apache License 2.0
9 stars 3 forks source link

Plugin Crashing on boot using LIRC #8

Closed M-Whitaker closed 10 months ago

M-Whitaker commented 3 years ago

Hi,

Just trying to setup LIRC to work with this plugin. LIRC is installed on the same Raspberry Pi as Homebridge however even with the simplest of configs I get the following callback...

TypeError: Cannot read property 'forEach' of undefined
    at new Television (/usr/lib/node_modules/homebridge-television-universal-control/src/platformAccessory.ts:275:24)
    at TelevisionUniversalControl.discoverDevices (/usr/lib/node_modules/homebridge-television-universal-control/src/platform.ts:88:9)
    at HomebridgeAPI.<anonymous> (/usr/lib/node_modules/homebridge-television-universal-control/src/platform.ts:39:12)
    at HomebridgeAPI.emit (events.js:327:22)
    at HomebridgeAPI.signalFinished (/usr/lib/node_modules/homebridge/src/api.ts:251:10)
    at Server.start (/usr/lib/node_modules/homebridge/src/server.ts:160:14)
    at cli (/usr/lib/node_modules/homebridge/src/cli.ts:80:10)
    at Object.<anonymous> (/usr/lib/node_modules/homebridge/bin/homebridge:17:22)
    at Module._compile (internal/modules/cjs/loader.js:1063:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)

Is there an example config that should always work or is it a case of if there is not a fully configured TV then the plugin will crash?

p.s my current config looks like this:

{
            "groups": [
                {
                    "name": "Living Room TV",
                    "devices": {
                        "lirc": [
                            {
                                "name": "Samsung UE40ES5700",
                                "remote": "UE40ES5700"
                            }
                        ]
                    },
                    "power": {
                        "on": {
                            "commands": [
                                {
                                    "lirc": [
                                        {
                                            "commands": [
                                                "KEY_POWER"
                                            ],
                                            "device": "Samsung UE40ES5700"
                                        }
                                    ]
                                }
                            ]
                        },
                        "off": {
                            "commands": []
                        }
                    },
                    "speaker": {
                        "mute_on": {
                            "commands": []
                        },
                        "mute_off": {
                            "commands": []
                        },
                        "volume_up": {
                            "commands": []
                        },
                        "volume_down": {
                            "commands": []
                        }
                    }
                }
            ],
            "platform": "TelevisionUniversalControl"
}

Many thanks for the help

asherkin commented 3 years ago

This error is because you need at least an empty inputs key for your group.

"inputs": [],

(I ran into this as well, and #12 changes it to be optional as part of the other changes.)