Author Topic: Vera & IFTTT integration - it can be done today !  (Read 1591 times)

Offline dmckenna

  • Full Member
  • ***
  • Posts: 196
  • Karma: +8/-2
Vera & IFTTT integration - it can be done today !
« on: March 22, 2018, 06:29:04 am »
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
« Last Edit: March 29, 2018, 08:41:06 am by Sorin »

Offline kwieto

  • Hero Member
  • *****
  • Posts: 539
  • Karma: +20/-11
Re: Vera & IFTTT integration - it can be done today !
« Reply #1 on: March 25, 2018, 02:09:38 pm »
What about the other way around?
I want external device to trigger action on Vera.

Offline johnnboy

  • Newbie
  • *
  • Posts: 17
  • Karma: +1/-0
Re: Vera & IFTTT integration - it can be done today !
« Reply #2 on: March 28, 2018, 04:57:33 pm »
What about the other way around?
I want external device to trigger action on Vera.

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:
Code: [Select]
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.
« Last Edit: March 28, 2018, 05:04:58 pm by johnnboy »

Offline niharmehta

  • Sr. Member
  • ****
  • Posts: 348
  • Karma: +15/-0
Re: Vera & IFTTT integration - it can be done today !
« Reply #3 on: March 28, 2018, 05:48:21 pm »
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.
2x VeraLite; 2xTrane Tstats; 45 x Switches/Dimmers/Appliance Modules; 4x Everspring Water Sensors; DSC Integration; 2 x Zwave Door Locks; 1x Ted5K; 1x Rainforest Eagle; Onkyo AVR; 6x Squeezebox;

Offline amg0

  • Sr. Hero Member
  • ******
  • Posts: 2929
  • Karma: +190/-8
Re: Vera & IFTTT integration - it can be done today !
« Reply #4 on: March 29, 2018, 01:17:19 am »
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

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.

Offline amg0

  • Sr. Hero Member
  • ******
  • Posts: 2929
  • Karma: +190/-8
Re: Vera & IFTTT integration - it can be done today !
« Reply #5 on: March 29, 2018, 01:18:49 am »
What about the other way around?
I want external device to trigger action on Vera.

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:
Code: [Select]
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.

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

Offline kwieto

  • Hero Member
  • *****
  • Posts: 539
  • Karma: +20/-11
Re: Vera & IFTTT integration - it can be done today !
« Reply #6 on: March 29, 2018, 07:21:32 am »
this with Webhooks, use the action 'Make a web request' to your Vera's address.

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).

Offline shallowearth

  • Hero Member
  • *****
  • Posts: 963
  • Karma: +45/-9
Re: Vera & IFTTT integration - it can be done today !
« Reply #7 on: March 29, 2018, 10:32:55 am »
I think the other direction is what IFTTT Beta is about so you ask to join that perhaps?

Offline johnnboy

  • Newbie
  • *
  • Posts: 17
  • Karma: +1/-0
Re: Vera & IFTTT integration - it can be done today !
« Reply #8 on: March 29, 2018, 02:36:22 pm »
this with Webhooks, use the action 'Make a web request' to your Vera's address.

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).

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

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.

Offline hellovn

  • Full Member
  • ***
  • Posts: 249
  • Karma: +19/-46
Re: Vera & IFTTT integration - it can be done today !
« Reply #9 on: March 29, 2018, 05:24:11 pm »
I am using openhab2 for my Vera & IFTTT integration.

Online cw-kid

  • Hero Member
  • *****
  • Posts: 1443
  • Karma: +11/-2
Re: Vera & IFTTT integration - it can be done today !
« Reply #10 on: June 13, 2018, 10:31:51 am »
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.