NorthernMan54 / homebridge-cmd-television

20 stars 1 forks source link

Error when using the plugin / Cannot read ATV activity status #23

Open saschafiedler opened 1 year ago

saschafiedler commented 1 year ago

I have successfully installed and configured the plugin according to the instructions, but I get the following error message when using it:

[21/10/2022, 21:47:16] [homebridge-cmd-television] This plugin threw an error from the characteristic 'Active Identifier': Unhandled error thrown inside write handler for characteristic: The "file" argument must be of type string. Received undefined. See https://homebridge.io/w/JtMGR for more info.
[21/10/2022, 21:47:16] [homebridge-cmd-television] TypeError: The "file" argument must be of type string. Received undefined
    at new NodeError (node:internal/errors:387:5)
    at validateString (node:internal/validators:162:11)
    at normalizeSpawnArguments (node:child_process:528:3)
    at spawn (node:child_process:726:13)
    at Object.execFile (node:child_process:331:17)
    at exec (node:child_process:228:25)
    at CmdTelevisionAccessory.setInput (/var/lib/homebridge/node_modules/homebridge-cmd-television/index.js:71:13)
    at ActiveIdentifier.emit (node:events:513:28)
    at /var/lib/homebridge/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Characteristic.ts:1725:16
    at new Promise (<anonymous>)
    at ActiveIdentifier.<anonymous> (/var/lib/homebridge/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Characteristic.ts:1723:14)
    at step (/var/lib/homebridge/node_modules/homebridge/node_modules/tslib/tslib.js:144:27)
    at Object.next (/var/lib/homebridge/node_modules/homebridge/node_modules/tslib/tslib.js:125:57)
    at /var/lib/homebridge/node_modules/homebridge/node_modules/tslib/tslib.js:118:75
    at new Promise (<anonymous>)
    at __awaiter (/var/lib/homebridge/node_modules/homebridge/node_modules/tslib/tslib.js:114:16)
    at ActiveIdentifier.Characteristic.handleSetRequest (/var/lib/homebridge/node_modules/homebridge/node_modules/hap-nodejs/dist/lib/Characteristic.js:824:38)
    at Bridge.<anonymous> (/var/lib/homebridge/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Accessory.ts:1812:29)
    at step (/var/lib/homebridge/node_modules/homebridge/node_modules/tslib/tslib.js:144:27)
    at Object.next (/var/lib/homebridge/node_modules/homebridge/node_modules/tslib/tslib.js:125:57)
    at /var/lib/homebridge/node_modules/homebridge/node_modules/tslib/tslib.js:118:75
    at new Promise (<anonymous>)`

Is the problem known and where is my error?

Do I understand the sample configuration file correctly, that I swap the MAC address with the one of my Apple TV?

NorthernMan54 commented 1 year ago

This is indicating that your config file is incorrect, can you share it ?

saschafiedler commented 1 year ago

Sure:

{
    "bridge": {
        "name": "Homebridge",
        "username": "xxx",
        "port": xxx,
        "pin": "xxx",
        "advertiser": "avahi"
    },
    "accessories": [
        {...}
        {
            "accessory": "cmd-television",
            "name": "Apple TV",
            "oncmd": "atvremote --id xx:xx:xx:xx:xx:xx (Wifi mac address) --airplay-credentials `cat ~/.homebridge/atv_airplay.cred` --companion-credentials `cat ~/.homebridge/atv_companion.cred` turn_on",
            "offcmd": "atvremote --id xx:xx:xx:xx:xx:xx (Wifi mac address) --airplay-credentials `cat ~/.homebridge/atv_airplay.cred` --companion-credentials `cat ~/.homebridge/atv_companion.cred` turn_off",
            "pausecmd": "atvremote --id xx:xx:xx:xx:xx:xx (Wifi mac address) --airplay-credentials `cat ~/.homebridge/atv_airplay.cred` --companion-credentials `cat ~/.homebridge/atv_companion.cred` pause",
            "playcmd": "atvremote --id xx:xx:xx:xx:xx:xx (Wifi mac address) --airplay-credentials `cat ~/.homebridge/atv_airplay.cred` --companion-credentials `cat ~/.homebridge/atv_companion.cred` play",
            "powerstatecmd": "atvremote --id xx:xx:xx:xx:xx:xx (Wifi mac address) --airplay-credentials `cat ~/.homebridge/atv_airplay.cred` --companion-credentials `cat ~/.homebridge/atv_companion.cred` power_state"
        }
    ],
    "platforms": [
            {...}
    ]
}
NorthernMan54 commented 1 year ago

Do you have this text in your config section ? (Wifi mac address)

Also I presume your running this on a Raspberry PI, and what version of homebridge are you running ?

saschafiedler commented 1 year ago

Do you have this text in your config section ? (Wifi mac address)

No. Just to clarify, that I used the in my case correct MAC address.

Also I presume you’re running this on a Raspberry PI, and what version of homebridge are you running ?

Yes, I do. Raspi 4 with a current version of Raspbian. I’m running 1.5.0 of Homebridge.

NorthernMan54 commented 1 year ago

I have been trying a couple of different things in an attempt to recreate your issue, but have not been successful.

My only other thought, is re-install the plugin again

Did you use the command sudo npm i -g https://github.com/NorthernMan54/homebridge-cmd-television ?