Skip to content

Community supplied examples

erwinloh edited this page Feb 21, 2021 · 11 revisions

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

  1. Use case, A 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]"
            }
        }
    }
  1. Use case, B Flo (new) 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"
           }
       }
     },
    
  2. Use case, Yamaha NP controller

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
    }
  1. Use case, Kas Locks

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

[FACTORY_NAME] is obtained from 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]"
}
Clone this wiki locally