Linking IFTTT with a habpanel button?

ok so here is the deal, some of my light switches do not have an actual binding or MQTT support, but they do have IFTTT support, so what I’m doing is trying to figure out how I can link a button to send an exec command through IFTTT to turn on and off the switches. I AM LOST. I have seen things on how to send commands from IFTTT to openhab, but nothing on how to send something from openhab to IFTTT via an exec button, the biggest problem is that there are 2 different webhooks to turn the light on and off. I’m not sure how to make one button do both either. Any advice or suggestions would be greatly appreciated!

Thanks in advance

1 Like

Use rules

rule "switch changes"
when
	Item myswitch changed to ON
then
	executeCommandLine("do something to IFTTT...")
end

ok this has led me in the right direction, but I still can’t seem to get it to function.

I have created a switch.items that has populated into habpanel, but the rule I created to go along with it does not seem to function. Below is my rule and I’m sure it’s totally wrong as I am learning this as I go.

Blockquote rule "switch changes"
when
Item “Hall_Light” changed to ON
then
ExecuteCommandLine(“curl -X POST https://maker.ifttt.com/trigger/hallon/with/key/XXXXXXXXXXXXXXXXXXXXXXXX”)
when
Item “Hall_light” changed to OFF
then
ExecuteCommandLine(“curl -X POST https://maker.ifttt.com/trigger/halloff/with/key/XXXXXXXXXXXXXXXXXXXXXXXX”)
end

Paste your Items definition.
You have to remove the quotes
And you need to separate your rules for ON or OFF.

rule "switch changes - ON"
when
    Item Hall_Light changed to ON
then
    ExecuteCommandLine(“curl -X POST https://maker.ifttt.com/trigger/hallon/with/key/XXXXXXXXXXXXXXXXXXXXXXXX”)
end

rule "switch changes - OFF"
when
    Item “Hall_light” changed to OFF
then
    ExecuteCommandLine(“curl -X POST https://maker.ifttt.com/trigger/halloff/with/key/XXXXXXXXXXXXXXXXXXXXXXXX”)
end

OR Combine it to a single “changed”

rule "switch changes"
when
    Item Hall_Light changed
then
    if (Hall_Light.state == ON)
        ExecuteCommandLine(“curl -X POST https://maker.ifttt.com/trigger/hallon/with/key/XXXXXXXXXXXXXXXXXXXXXXXX”)
    else
        ExecuteCommandLine(“curl -X POST https://maker.ifttt.com/trigger/hallon/with/key/XXXXXXXXXXXXXXXXXXXXXXXX”)
end

my items file from what I understand is pretty simple to just make a switch type

Switch Hall_Light

that’s all I have defined in the item file for the actual switch part.

The second rule from my post above should work.