Supereg/homebridge-http-switch

Multiple On or Off URL's with toggle switch

Closed this issue · 1 comments

Please add the ability to use multiple On or Off URL's with toggle switch.

If I understand you, that feature is already available. Here is an example how I did it. I needed the extra Method and Body for my application but you can just use a list of url's

    {
        "accessory": "HTTP-SWITCH",
        "name": "Movie Time",
        "switchType": "toggle",
        "onUrl": [
            {
                "method": "POST",
                "url": "http://192.168.1.20:80/YamahaRemoteControl/ctrl",
                "body": "<?xml version=\"1.0\" encoding=\"UTF-8\"?> <YAMAHA_AV cmd=\"PUT\"> <Main_Zone><Input><Input_Sel>HDMI2</Input_Sel></Input></Main_Zone></YAMAHA_AV>"
            },
            {
                "method": "POST",
                "url": "http://192.168.1.20:80/YamahaRemoteControl/ctrl",
                "body": "<?xml version= \"1.0\" encoding=\"UTF-8\"?><YAMAHA_AV cmd=\"PUT\"><Main_Zone><Power_Control><Power>On</Power></Power_Control></Main_Zone></YAMAHA_AV>"
            },
            {
                "method": "POST",
                "url": "http://192.168.1.20:80/YamahaRemoteControl/ctrl",
                "body": "<?xml version=\"1.0\" encoding=\"UTF-8\"?><YAMAHA_AV cmd=\"PUT\"><Main_Zone><Volume><Lvl><Val>-150</Val><Exp>1</Exp><Unit>dB</Unit></Lvl></Volume></Main_Zone></YAMAHA_AV>"
            },
            {
                "method": "POST",
                "url": "http://192.168.1.20:80/YamahaRemoteControl/ctrl",
                "body": "<?xml version=\"1.0\" encoding=\"UTF-8\"?> <YAMAHA_AV cmd=\"PUT\"> <Main_Zone><Volume><Zone_B><Mute>On</Mute></Zone_B></Volume></Main_Zone> </YAMAHA_AV>"
            },
            {
                "method": "POST",
                "url": "http://192.168.1.20:80/YamahaRemoteControl/ctrl",
                "body": "<?xml version=\"1.0\" encoding=\"UTF-8\"?><YAMAHA_AV cmd=\"PUT\"><Main_Zone><Volume><Mute>Off</Mute></Volume></Main_Zone></YAMAHA_AV>"
            }
        ],
        "offUrl": [
            {
                "method": "POST",
                "url": "http://192.168.1.20:80/YamahaRemoteControl/ctrl",
                "body": "<?xml version=\"1.0\" encoding=\"UTF-8\"?> <YAMAHA_AV cmd=\"PUT\"> <Main_Zone><Input><Input_Sel>HDMI1</Input_Sel></Input></Main_Zone></YAMAHA_AV>"
            },
            {
                "method": "POST",
                "url": "http://192.168.1.20:80/YamahaRemoteControl/ctrl",
                "body": "<?xml version= \"1.0\" encoding=\"UTF-8\"?><YAMAHA_AV cmd=\"PUT\"><Main_Zone><Power_Control><Power>Standby</Power></Power_Control></Main_Zone></YAMAHA_AV>"
            }
        ]
    },