kiwi-cam / homebridge-broadlink-rm

[This fork supports TV accessories] Broadlink RM Mini and Pro plugin for homebridge: https://github.com/nfarina/homebridge
Apache License 2.0
304 stars 96 forks source link

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

Closed xhi-nico closed 1 year ago

xhi-nico commented 1 year ago

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

                        }
                    ]
                }
            }
kiwi-cam commented 1 year ago

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

xhi-nico commented 1 year ago

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

xhi-nico commented 1 year ago

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
                                    }
                                ]
                            }
                        ]
                    }
                }