Vera & IFTTT integration - it can be done today!

It’s a bit clunky but by using a combination of PLEG, LUA and Webhooks you can use a Vera device today as a trigger for an IFTTT device. If you’re a member of the Vera IFTTT beta program then you can also use IFTTT triggers for a Vera device. Here’s the basic process:

  1. Choose which Vera device you want to use as a trigger, I’m using a Virtual Switch but it could be a temperature device, or an energy meter it really doesn’t matter
  2. Configure a PLEG routine to detect/trigger that device’s state that you’re interested in and set up a PLEG condition for that detection - it could be On or Off, or temperature > 20c - you’ll need a condition for each state you want a trigger for
  3. Don’t setup an action yet, we’ll come back to that
  4. Go to IFTTT and configure your device if you’ve not already done so that you want to trigger - this could be a non-vera Device, or even Twitter or Facebook (I’m using a SONOFF basic light switch on the eWeLink Applet which doesn’t integrate into Vera)
  5. Whilst in IFTTT configure a new Webhooks Applet (you’ll find this on the search) for each state you want an action on e.g. One for ON and one for OFF - name them appropriately and note down these names. Link the ‘THAT’ part of this applet to the state of your device in 4) so for example if you’ve called your new Webhooks applet Light_On then link that to the on action on the IFTTT device in 4)
  6. Whilst in IFTTT go Home, then search and type in Webhooks again…don’t create any new one, but click on the Documentation part at the top right…you’ll get a new window pop up with some code on it.
  7. Copy the top bit…it will look something like this https://maker.ifttt.com/trigger/{event}/with/key/123456someuniquecode789
  8. Change the part {event} to be the name you called the new Applet in 5) and copy to your clipboard e.g. https://maker.ifttt.com/trigger/wifi_switch_on/with/key/123456someuniquecode789
  9. Flip back to Vera, you should still be in the same PLEG routine you created in 2) - create an action for the Condition you set up.
  10. Choose LUA and paste the URL from 8) so it looks like this local status, result = luup.inet.wget(“https://maker.ifttt.com/trigger/wifi_switch_on/with/key/123456someuniquecode789”, 5)
  11. Save it and restart LUUP (you’ll also need to redo the last few steps for any other repeat actions/conditions/triggers you’ve got)

You’re done !!

Now when your local Vera condition/trigger happens the device action on IFTTT will also work.

If you’re part of the Vera IFTTT beta program you can also use the IFTTT device in 4) to trigger an action/device back in your Vera system. For those of you that aren’t on the Beta you’re not missing out on much other than the ability to turn a device on/off and fire a Scene, plus of course the integrated authentication between IFTTT and Vera security relays.

Yes it’s clunky but yes it does work whilst we wait further news (q1 2018 I heard) on Native Vera IFTTT integration.

With IFTTT the world of home integration has just got much bigger !!

Cheers

David

1 Like

What about the other way around?
I want external device to trigger action on Vera.

[quote=“kwieto, post:2, topic:198860”]What about the other way around?
I want external device to trigger action on Vera.[/quote]

You can do this with Webhooks, use the action ‘Make a web request’ to your Vera’s address. I created a test applet to announce an arriving Uber over Sonos. But you should be able to do any Vera action with a url similar to this:

http://<external_ip>:3480/data_request?id=action&DeviceNum=57&serviceId=urn:micasaverde-com:serviceId:Sonos1&action=Say&Volume=60&Text=Your%20 {{RideType}}%20is%20arriving%20in%20 {{PickupEta}}.%20Look%20for%20 {{DriverName}}%20in%20a%20 {{VehicleMakeModel}}

I opened a port on my router to forward 3480 to my Vera’s IP address. So I probably need to find a way to limit this to IFTTT servers or some other way to secure it.

opening a port to your Vera is a TERRIBLE idea… Its not secure and you are just asking for somebody to mess with your system and in some cases cause physical damage to connected devices in your house. At least put an authenticated secured proxy in front of it.

1 Like

[quote=“dmckenna, post:1, topic:198860”]It’s a bit clunky but by using a combination of PLEG, LUA and Webhooks you can use a Vera device today as a trigger for an IFTTT device. If you’re a member of the Vera IFTTT beta program then you can also use IFTTT triggers for a Vera device. Here’s the basic process:

  1. Choose which Vera device you want to use as a trigger, I’m using a Virtual Switch but it could be a temperature device, or an energy meter it really doesn’t matter
  2. Configure a PLEG routine to detect/trigger that device’s state that you’re interested in and set up a PLEG condition for that detection - it could be On or Off, or temperature > 20c - you’ll need a condition for each state you want a trigger for
  3. Don’t setup an action yet, we’ll come back to that
  4. Go to IFTTT and configure your device if you’ve not already done so that you want to trigger - this could be a non-vera Device, or even Twitter or Facebook (I’m using a SONOFF basic light switch on the eWeLink Applet which doesn’t integrate into Vera)
  5. Whilst in IFTTT configure a new Webhooks Applet (you’ll find this on the search) for each state you want an action on e.g. One for ON and one for OFF - name them appropriately and note down these names. Link the ‘THAT’ part of this applet to the state of your device in 4) so for example if you’ve called your new Webhooks applet Light_On then link that to the on action on the IFTTT device in 4)
  6. Whilst in IFTTT go Home, then search and type in Webhooks again…don’t create any new one, but click on the Documentation part at the top right…you’ll get a new window pop up with some code on it.
  7. Copy the top bit…it will look something like this https://maker.ifttt.com/trigger/{event}/with/key/123456someuniquecode789
  8. Change the part {event} to be the name you called the new Applet in 5) and copy to your clipboard e.g. https://maker.ifttt.com/trigger/wifi_switch_on/with/key/123456someuniquecode789
  9. Flip back to Vera, you should still be in the same PLEG routine you created in 2) - create an action for the Condition you set up.
  10. Choose LUA and paste the URL from 8) so it looks like this local status, result = luup.inet.wget(“https://maker.ifttt.com/trigger/wifi_switch_on/with/key/123456someuniquecode789”, 5)
  11. Save it and restart LUUP (you’ll also need to redo the last few steps for any other repeat actions/conditions/triggers you’ve got)

You’re done !!

Now when your local Vera condition/trigger happens the device action on IFTTT will also work.

If you’re part of the Vera IFTTT beta program you can also use the IFTTT device in 4) to trigger an action/device back in your Vera system. For those of you that aren’t on the Beta you’re not missing out on much other than the ability to turn a device on/off and fire a Scene, plus of course the integrated authentication between IFTTT and Vera security relays.

Yes it’s clunky but yes it does work whilst we wait further news (q1 2018 I heard) on Native Vera IFTTT integration.

With IFTTT the world of home integration has just got much bigger !!

Cheers

David[/quote]

Yes that is also how altui does its built in outgoing integration with ifttt, simply built in as a simple data push ( altui concept) on a device variable change event.

[quote=“johnnboy, post:3, topic:198860”][quote=“kwieto, post:2, topic:198860”]What about the other way around?
I want external device to trigger action on Vera.[/quote]

You can do this with Webhooks, use the action ‘Make a web request’ to your Vera’s address. I created a test applet to announce an arriving Uber over Sonos. But you should be able to do any Vera action with a url similar to this:

http://<external_ip>:3480/data_request?id=action&DeviceNum=57&serviceId=urn:micasaverde-com:serviceId:Sonos1&action=Say&Volume=60&Text=Your%20 {{RideType}}%20is%20arriving%20in%20 {{PickupEta}}.%20Look%20for%20 {{DriverName}}%20in%20a%20 {{VehicleMakeModel}}

I opened a port on my router to forward 3480 to my Vera’s IP address. So I probably need to find a way to limit this to IFTTT servers or some other way to secure it.[/quote]

Gosh , opening the port to vera s 3480 is like giving the keys to your house… this port is used for all , all apps handler, all important luup apis, etc… i would not do this

The problem (except security) is that I want to use it for device which by itself doesn’t have any ability to be programmed.
It is integrated with IFTTT, so it passes some information there, but what next?
Another topic is non-static IP of my router (LTE one).

I think the other direction is what IFTTT Beta is about so you ask to join that perhaps?

The problem (except security) is that I want to use it for device which by itself doesn’t have any ability to be programmed.
It is integrated with IFTTT, so it passes some information there, but what next?
Another topic is non-static IP of my router (LTE one).[/quote]

Using Vera’s URL you can turn on/off any device, run scenes, etc. See [url=http://wiki.micasaverde.com/index.php/Luup_Requests]http://wiki.micasaverde.com/index.php/Luup_Requests[/url].

But, as others have mentioned, this method completely opens Vera to anyone who has the url. I did it just to see if it worked and don’t plan on leaving it open. I thought about limiting the port access to Webhooks ip address but it’s hosted on Amazon Web Services and likely uses a large range of addresses.

I am using openhab2 for my Vera & IFTTT integration.

Just tried this as a test, I setup a Webhook event to blink my Hue lights in the lounge. Linked this in to my doorbell scene in Vera and it does work.

I haven’t really got any devices that use IFTTT at the moment, as mine are all Z-Wave, but you could use this method with the Sonoff relays as the OP suggested and a virtual switch or device in Vera and then PLEG to fire the webhook http command when it detects the virtual device in Vera has been turned on / off etc.

I do have one device that uses the eWeLink app, a WIFI essential oils diffuser. But it seems the eWeLink applets on IFTTT cannot detect or control this diffuser device which is a shame. As I could have then setup a virtual device in Vera to turn the diffuser on / off.

I believe we can add this LUA code “local status, result = luup.inet.wget(“https://maker.ifttt.com/trigger/wifi_switch_on/with/key/123456someuniquecode789”, 5)” to run as part of a scene, without the need for PLEG. Is that correct? I’ve tried it in the Apps - Develop Apps - Test LUA code and it works…

Am i on the right track here?

Can anyone give me a steer on the LUA code and syntax for multiple requests in the same code, ie. if i wanted to switch on 3 wifi switches at the same time?

Yes, in a Vera scene in the “Also, execute the following Luup code” section, you can add in your code for the scene.

If you want to send more than one wget command to IFTTT just list them one after the other on new lines.

Thank you

Out of curiosity, what does the 5 @ the end of the string mean?

The problem (except security) is that I want to use it for device which by itself doesn’t have any ability to be programmed.
It is integrated with IFTTT, so it passes some information there, but what next?
Another topic is non-static IP of my router (LTE one).[/quote]

Using Vera’s URL you can turn on/off any device, run scenes, etc. See [url=http://wiki.micasaverde.com/index.php/Luup_Requests]http://wiki.micasaverde.com/index.php/Luup_Requests[/url].

But, as others have mentioned, this method completely opens Vera to anyone who has the url. I did it just to see if it worked and don’t plan on leaving it open. I thought about limiting the port access to Webhooks ip address but it’s hosted on Amazon Web Services and likely uses a large range of addresses.[/quote]

Merlin firmware for Asus routers allows you to enter the complete range of ip’s for a domain. The following site will give you the ip range for any domain.

https://www.ultratools.com

I am using Google home with IFTTT to control scenes on my Vera but I am not using op’s solution. I have set the allowable incoming ip range to ifttt’s servers. It seems to work blocking ip’s outside of ifttt. I am not using this for anything security related, locks etc.

In Asus Merlin the range is separated by a colon e.g.000.000.000.000:000.000.000.000

I am pretty sure DD-WRT and tomato firmware support this as well without any special scripting.

Its my understanding that you can also call IFTTT webhooks in normal Vera scenes (without PLEG) using os.execute and curl. Someone mentioned this as a response to a post I made on reddit a few weeks ago.

to recieve webhooks from ifttt i use automate android app on a android box. automate then passes the request on locally to vera. It does this with cloud messaging to recieve and http request locally, so no need to open any ports. It has been very reliable and quick.

Hi, would you be able to give more detail how you set this up?

Thanks

yes just ask for specifics. you need to install automate and ifttt. i have a flow that will recieve webhooks from ifttt and one that will send webhooks. so my flow receives a webhook from ifttt and then passes the webhook on locally with a http request to my vera

https://llamalab.com/automate/doc/block/http_request.html
https://llamalab.com/automate/doc/block/cloud_message_receive.html
https://llamalab.com/automate/cloud/

log in to ifttt website and go to
https://ifttt.com/maker_webhooks
and follow link to documentation, there you will get your secret key.

then you will need to make flows for automate or download from the community and edit for your needs.

you only need to purchase automate if you use more than 30 blocks. i would purchase it any way as it is a excellent app and has many other uses. to make a flow to recieve webhooks and pass it on in http request would only need about 20 blocks.

i can let you have my flows if required

Ok, I’m a little late to the party, but this saved my bacon. Just one thing - is it possible to send parameters this way? Say I have a dimmer triggering the IFTTT webhook, the dimmer stops at 66% and I want to send the 0.66 along with the request.