g30r93g / homebridge-panasonic

A Homebridge plugin for Panasonic Viera TV's. Written to support the new Homekit TV accessory.
MIT License
21 stars 3 forks source link

Question - JSON For Multiple Accessories #31

Closed GitWonder closed 4 years ago

GitWonder commented 4 years ago

Hi

I have multiple Viera TVs. How should the JSON look for these? I've tried

"accessories": [
    {
        "accessory": "Panasonic-TV",
        "name": "Living Room TV",
        "ipaddress": "10.0.0.18",
        "inputs": [
            {"id": "TV", "name": "TV", "type": "TV"},
            {"id" : "HDMI 1", "name": "Apple TV", "type": "HDMI"},
            {"id" : "Netflix", "name": "Netflix", "type": "APPLICATION", "appID": "0010000200000001"}
        ]
    }
    {
        "accessory": "Panasonic-TV",
        "name": "Bedroom TV",
        "ipaddress": "10.0.0.14",
        "inputs": [
            {"id": "TV", "name": "TV", "type": "TV"},
            {"id" : "HDMI 1", "name": "Fetch TV", "type": "HDMI"},
            {"id" : "Netflix", "name": "Netflix", "type": "APPLICATION", "appID": "0010000200000001"}
        ]
    }
]

But this gives me an error "Invalid JSON in an accessory"

I've tried adding it as two separate accessories under the same plugin and I get an error

[Homebridge] [28/01/2020, 8:19:11 am] Error: Cannot add a bridged Accessory with the same UUID as another bridged Accessory: a918e06a-8329-4773-8852-19c0491be5e9
    at Bridge.Accessory.addBridgedAccessory (/Users/redacted/.hoobs/node_modules/@hoobs/hap/lib/Accessory.js:268:13)
    at Server._loadAccessories (/Users/redacted/.hoobs/node_modules/@hoobs/homebridge/lib/server.js:272:22)
    at Server.run (/Users/redacted/.hoobs/node_modules/@hoobs/homebridge/lib/server.js:78:14)
    at module.exports (/Users/redacted/.hoobs/node_modules/@hoobs/homebridge/lib/cli.js:90:12)
    at Object.<anonymous> (/Users/redacted/.hoobs/node_modules/@hoobs/homebridge/bin/homebridge:10:63)
    at Module._compile (internal/modules/cjs/loader.js:1151:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1171:10)
    at Module.load (internal/modules/cjs/loader.js:1000:32)
    at Function.Module._load (internal/modules/cjs/loader.js:899:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)]

So I am a bit confused.

GitWonder commented 4 years ago

I have figured it out.

The sample JSON describes where the accessory sits in all the JSON but HOOBS 3 only wants the accessory bit of the JSON (I.e. after the accessories tag.

g30r93g commented 4 years ago

Could you possibly add some instructions to the Readme and I'll merge your branch in to help others with this issue? Would really help out and, of course, I'll credit you in the relevant section of the readme :)