kiwi-cam/homebridge-broadlink-rm

Setting up "interval" and "sendCount" for "inputs" under "tv" accessory

Closed this issue · 3 comments

I have a receiver that requires me to click on "input" several times to change the input back to the right one. Would it be possible to allow using"interval" and "sendCount" configurations (similar to switch accessories) on the input function under TV accessories?

Something like this:

            {
                "name": "Sound System",
                "type": "tv",
                "subType": "stb",
                "host": "192.168.68.71",
                "data": {
                    "off": "DATA",
                    "on": "DATA",
                    "volume": {
                        "up": "DATA",
                        "down": "DATA"
                    },
                    "inputs": [
                        {
                            "name": "TV",
                            "type": "other",
                            "data": "DATA"
                        },
                        {
                            "name": "Record Player",
                            "type": "other",
                            "data": "DATA",

                            "sendCount": 4,
                            "interval": 1

                        }
                    ]
                }
            }

Absolutely, this should work. Just a small tweak to the syntax required:

            {
                "name": "Sound System",
                "type": "tv",
                "subType": "stb",
                "host": "192.168.68.71",
                "data": {
                    "off": "DATA",
                    "on": "DATA",
                    "volume": {
                        "up": "DATA",
                        "down": "DATA"
                    },
                    "inputs": [
                        {
                            "name": "TV",
                            "type": "other",
                            "data": "DATA"
                        },
                        {
                            "name": "Record Player",
                            "type": "other",
                            "data": {
                              "data": "DATA",
                              "sendCount": 4,
                              "interval": 1
                            }
                        }
                    ]
                }
            }

https://broadlink.kiwicam.nz/#advanced-hex-structure

Ahhhh you got me so excited; unfortunately it doesn't seem to be working.

Here's my config:

                {
                    "name": "Surround Sound",
                    "type": "tv",
                    "subType": "stb",
                    "host": "192.168.68.87",
                    "data": {
                        "off": "DATA",
                        "on": "DATA",
                        "volume": {
                            "up": "DATA",
                            "down": "DATA"
                        },
                        "inputs": [
                            {
                                "name": "TV",
                                "type": "other",
                                "data": "DATA"
                            },
                            {
                                "name": "Record Player",
                                "type": "other",
                                "data": {
                                    "data": "DATA",
                                    "sendCount": 4,
                                    "interval": 1
                                }
                            }
                        ]
                    }
                }

It sends the 'TV' accessory HEX code just fine, but now it doesn't send any HEX code at all for 'Record Player' accessory. Previously, it would send the codes fine without the "sendCount" or "interval" configs.

Should I turn this into a bug? hahaha

Nevermind, it worked! Turns out that it needed square [] brackets!

{
                    "name": "Surround Sound",
                    "type": "tv",
                    "subType": "stb",
                    "host": "192.168.68.87",
                    "data": {
                        "off": "DATA",
                        "on": "DATA",
                        "volume": {
                            "up": "DATA",
                            "down": "DATA"
                        },
                        "inputs": [
                            {
                                "name": "TV",
                                "type": "other",
                                "data": "DATA"
                            },
                            {
                                "name": "Record Player",
                                "type": "other",
                                "data": [
                                    {
                                        "data": "DATA",
                                        "sendCount": 5,
                                        "interval": 0.5
                                    }
                                ]
                            }
                        ]
                    }
                }