2

I'm novice about homebridge.

I managed to run it with no errors on a Raspberry Pi 3 and "homebridge-lifx" plug in runs like a charm!

Now I need to find out how the plugin "homebridge-ifttt-webhooks" works. I read "README.md" but I cannot understand how this works. What I want to do is to appear a new HomeKit button on my iPhone and when I push it, I want to trigger a webhooks link e.g.

"maker.ifttt.com/trigger/heat_on/with/key/fVi8awmhXVDTwIxxxxxxxxxvj1Pxtw" 

which triggers an IFTTT recipe. Can someone please help me with the steps? What should I do to make plug in work? Your help is really appreciated!

2

I take it you're struggling with the configuration rather than the actual installation, which is achieved by running npm i -g homebridge-ifttt as noted in the documentation.

An example of the configuration file you need is given in their repo, although there is little explanation:

{
    "bridge": {
        "name": "HomebridgeIFTTT",
        "username": "CC:22:3D:E3:CE:30",
        "port": 51826,
        "pin": "031-45-154"
    },

    "description": "This is an example configuration file. You can use this as a template for creating your own configuration file.",

    "platforms": [{
        "platform": "IFTTT",
        "name": "IFTTT",
        "makerkey": "PUT KEY OF YOUR MAKER CHANNEL HERE",
        "accessories": [{
            "name": "Accessory 1",
            "buttons": [{
                "caption": "A1-1",
                "trigger": "test"
            }]
        }]
    }],
    "accessories": []
}

I checked the source, and the URLs are built like this:

var url = "https://maker.ifttt.com/trigger/"+c+"/with/key/"+this.makerkey;

In essence, that means that the example button above captioned A1-1 will call the address:

https://maker.ifttt.com/trigger/test/with/key/YOUR_MAKER_CHANNEL_KEY

where YOUR_MAKER_CHANNEL_KEY is the one you put with "makerkey" in the configuration.

You need to put the above config.json in ~/.homebridge/config.json, but since there is only one config file, you'll need to also put in the bits for your Lifx plugin. You can do that by taking this bit of the above configuration:

{
    "platform": "IFTTT",
    "name": "IFTTT",
    "makerkey": "PUT KEY OF YOUR MAKER CHANNEL HERE",
    "accessories": [{
        "name": "Accessory 1",
        "buttons": [{
            "caption": "A1-1",
            "trigger": "test"
        }]
    }]
}

And putting it after the last platform block in your code. Say your current config looks like this:

"platforms": [{
    "platform": "lifx",
    ...
}],

You have to put a comma after the }, just before the ] that pairs with the opening [ for "platforms". If you're having trouble with that, edit your question to include your current configuration file.


The amended code for you is:

{
    "bridge": {
        "name": "Homebridge",
        "username": "CC:22:3D:E3:CE:30",
        "port": 51826,
        "pin": "053-73-874"
    },
    "platforms": [{
        "platform": "LifxLan",
        "name": "LIFX"
    }, {
        "platform": "IFTTT",
        "name": "IFTTT",
        "makerkey": "fVi8awmhXVxxxxwIcPCOEvxxxxxxxxCRvfMXqv1fek",
        "accessories": [{
            "name": "Accessory 1",
            "buttons": [{
                "caption": "A1-1",
                "trigger": "heat_on"
            }]
        }]
    }]
}

To add additional accessories, you need to add more blocks inside the "accessories" key, like this (I've clipped all but the relevant bits to make it more obvious):

"accessories": [{
    "name": "Accessory 1",
    "buttons": [{
       "caption": "A1-1",
       "trigger": "test"
    }, {
    "name": "Heat Off",
     "buttons": [{
      "caption": "A1-1",
      "trigger": "heat_off"
    }]
}]

Just like before, to add new items to the list, you simply put a comma after the last element, and add a new object with {}. If you want to learn more about the format: it's called JSON, and you can find tutorials on how to write it here. In brief, [ ... ] represents a list of things, and { ... } represents an object, which has keys and values.

8
  • Thank you so much for your extended explanation. I was able to finally find config.json file and try to find a solution. After some tries, i couldn't make it run. Can you please check my code and tell me what doing wrong? Code that works without editing: { "bridge": { "name": "Homebridge", "username": "CC:22:3D:E3:CE:30", "port": 51826, "pin": "053-73-874" }, "accessories": [ ], "platforms": [ { "platform" : "LifxLan", "name" : "LIFX" } ] }
    – Sakis
    Jan 26 '18 at 17:36
  • After using the code above i edited config.json file like this: { "bridge": { "name": "Homebridge", "username": "CC:22:3D:E3:CE:30", "port": 51826, "pin": "053-73-874" }, "platforms": [{ "platform": "LifxLan", "name": "LIFX" }], "platform": "IFTTT", "name": "IFTTT", "makerkey": "fVi8awmhXVxxxxwIcPCOEvxxxxxxxxCRvfMXqv1fek", "accessories": [{ "name": "Accessory 1", "buttons": [{ "caption": "A1-1", "trigger": "heat_on" }] }] }
    – Sakis
    Jan 26 '18 at 17:38
  • What i want to do, is to run this link: maker.ifttt.com/trigger/heat_on/with/key/… Can you please point my mistakes? Thank you so much for your help!
    – Sakis
    Jan 26 '18 at 17:38
  • @Sakis There were a couple of missing braces; I've edited my post to add the correct code for you to the bottom.
    – Aurora0001
    Jan 26 '18 at 17:45
  • 1
    Thank you for your help! I really appreciate it! Have a great day!
    – Sakis
    Jan 27 '18 at 12:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.