Skip to content

Community supplied examples

Andi edited this page Feb 16, 2023 · 11 revisions

This site is designate for people to share their configuration, so anybody can easily setup popular systems in a few minutes.

1. Flo

Here is the config I ended up with to control my Flo which turns on and off water to my home. Since it lacks open APIs, I used ifttt to change states of the unit and apilio to store the state.

{
    "accessory": "HTTP-SWITCH", 
    "name": "Flo",
    "switchType": "stateful",
    "pullInterval": 5000,
    "debug": true,
    "statusPattern": "true",
    "onUrl": {
        "url": "https://maker.ifttt.com/trigger/[trigger_removed]/with/key/[key_removed]",
        "method": "GET"
    },
    "offUrl": {
        "url": "https://maker.ifttt.com/trigger[trigger_removed]/with/key/[key_removed]",
        "method": "GET"
    },
    "statusUrl": {
        "url": "https://api.apilio.com/api/v1/boolean_variables/Flo",
        "method": "GET",
        "headers": {
            "Accept": "application/json",
            "Authorization": "Basic [token_removed]"
        }
    }
}

Flo is dropping their IFTTT integration so I had to use their API directly. Note I added a statusPattern which in this case matches either home or sleep states as ON and anything else (away in this case) as OFF.

{
    "accessory": "HTTP-SWITCH",
    "name": "Flo",
    "switchType": "stateful",
    "statusCache": 10,
    "pullInterval": 5000,
    "debug": true,
    "statusPattern": "{.*\"target\".*\"(home|sleep)\".*}",
    "onUrl": {
        "url": "https://api-gw.meetflo.com/api/v2/locations/***/systemMode",
        "method": "POST",
        "headers": {
            "authorization": "***",
            "Content-Type": "application/json"
        },
        "body": {
            "target": "home"
        }
    },
    "offUrl": {
        "url": "https://api-gw.meetflo.com/api/v2/locations/***3/systemMode",
        "method": "POST",
        "headers": {
            "authorization": "***",
            "Content-Type": "application/json"
        },
        "body": {
            "target": "away"
        }
    },
    "statusUrl": {
        "url": "https://api-gw.meetflo.com/api/v2/locations/***?expand=",
        "method": "GET",
        "headers": {
            "authorization": "e****",
            "Content-Type": "application/json"
        }
    }
}

Here is the config I ended up with to control my CRX-N560 which I can turn on/off with Homekit:

{
    "accessory": "HTTP-SWITCH", 
    "name": "Yamaha N560",
    "switchType": "stateful",
    "onUrl": {
        "url": "http://[yourlocalip]/YamahaRemoteControl/ctrl",
        "method": "POST",
        "body": "<?xml version=\"1.0\" encoding=\"utf-8\"?><YAMAHA_AV cmd=\"PUT\"><System><Power_Control><Power>On</Power></Power_Control></System></YAMAHA_AV>",
        "headers": {
            "Content-Type": "text/xml"
        }
    },
    "offUrl": {
        "url": "http://[yourlocalip]/YamahaRemoteControl/ctrl",
        "method": "POST",
        "body": "<?xml version=\"1.0\" encoding=\"utf-8\"?><YAMAHA_AV cmd=\"PUT\"><System><Power_Control><Power>Standby</Power></Power_Control></System></YAMAHA_AV>",
        "headers": {
            "Content-Type": "text/xml"
        }
    },
    "statusUrl": {
        "url": "http://[yourlocalip]/YamahaRemoteControl/ctrl",
        "method": "POST",
        "body": "<?xml version=\"1.0\" encoding=\"utf-8\"?><YAMAHA_AV cmd=\"GET\"><System><Basic_Status>GetParam</Basic_Status></System></YAMAHA_AV>",
        "headers": {
            "Content-Type": "text/xml"
        }
    },
    "statusPattern": "<Power>On</Power>",
    "debug": true
}

I can unlock my Kas Locks (striker and magnet) using the native Kas Cloud Web API in Homekit.

[FACTORY_NAME] is the ID of your lock, and is obtained from the Kas Cloud app interface. It either starts with ‘SS’ or ‘UL’.

Replace [API_KEY] with your API Key retrieved from the Kas Cloud App. Use the Static API Key, NOT the Dynamic API Key.

{
    "accessory": "HTTP-SWITCH",
    "name": "Pedestrian Gate",
    "switchType": "stateless",
    "timeout": 15000,
    "onUrl": "https://cloud.kas.com.au/api/lockCommand/remoteUnlock/[FACTORY_NAME]/[API_KEY]"
}

5. IFTT NAS Example

Taken from homebridge-http-switch#103.

{
    "accessory": "HTTP-SWITCH",
    "name": "NAS temp warning",
    "switchType": "stateless",
    "serialNumber": "SW002",
    "timeout": 1000,
    "debug": true,
    "method": "POST",
    "headers": {
        "Content-Type": "application/json"
    },
    "onUrl": {
        "url": "https://maker.ifttt.com/trigger/homealert/with/key/***",
        "method": "POST",
        "headers": {
            "Content-Type": "application/json"
        },
        "body": {
            "value1": "🔥  NAS is running hot 🔥",
            "value2": "temperature is over 95",
            "value3": "https://sflanders.net/wp-content/uploads/2015/11/synology-150x150.png"
        }
    }
}

6. Yamaha Receiver

Taken from homebridge-http-switch#105.

{
    "accessory": "HTTP-SWITCH",
    "name": "Yamaha TEST",
    "switchType": "stateful",
    "onUrl": {
        "method": "POST",
        "headers": {
            "Content-Type": "text/xml"
        },
        "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>"
    },
    "offUrl": {
        "method": "POST",
        "headers": {
            "Content-Type": "text/xml"
        },
        "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>"
    },
    "statusUrl": {
        "method": "POST",
        "headers": {
            "Content-Type": "text/xml"
        },
        "url": "http://192.168.1.20:80/YamahaRemoteControl/ctrl",
        "body": "<?xml version=\"1.0\" encoding=\"utf-8\"?><YAMAHA_AV cmd=\"GET\"><Main_Zone><Basic_Status>GetParam</Basic_Status></Main_Zone></YAMAHA_AV>"
    },
    "statusPattern": "<Power>On</Power>",
    "debug": true,
    "pullInterval": 3000
}

8. ntfy.sh

Taken from homebridge-http-switch#113.

{
    "accessory": "HTTP-SWITCH",
    "name": "JSONTest",
    "switchType": "stateless",
    "serialNumber": "SW002",
    "timeout": 1000,
    "debug": true,
    "method": "POST",
    "onUrl":
    {
        "url": "https://ntfy.sh/",
        "method": "POST",
        "headers":
        {
            "Content-Type": "application/json"
        },
        "body":
        {
            "topic": "your_topic",
            "title": "🔥  NAS is running hot 🔥",
            "message": "temperature is over 95",
            "attach": "https://sflanders.net/wp-content/uploads/2015/11/synology-150x150.png"
        }
    }
}