This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Would IFTTT be possible to integrate?
#1
Lightbulb 
As the title says. 

Would it be possible either for the developers to create an API for IFTTT or in some other way make
it possible to integrate LM logic with IFTTT in any way.

If anyone is wondering, here is the IFTTT website : https://ifttt.com/
Reply
#2
Hello Sandstrand,
if you have android try Tasker app, I believe it is already possible to use it with LM. Plus it has much more possibilities than IFTTT.
Reply
#3
Didn't think too far this time. Tasker will do the trick and I also have Automagic Premium installed on the phone already.

Any quick and easy ways to have a script monitor for a HTML GET/POST (JSON)request? First thing that came to mind was creating my own API
on the secondary http server and then do something, but hoping it will be easier to just use LUA scripts on the main LM Smile
Reply
#4
Hi,

You can use IFTTT in combination with the Maker Channel (bi-directional)

You have to enable the remote services in the controller (see controller manual) to receive commands and we need a script to send commands to IFTTT.

1) Create a Maker recipe with a unique trigger (for this example) "this_is_my_trigger_unique_event"
2) Create inside your recipe a action like: "http://remote:remote@ipadress/cgi-bin/scada-remote/request.cgi?m=json&r=grp&fn=write&alias=0/0/1&value=true" and
select method "get" and select content type "text / plain" body can be left empty. (change remote:remote to your credentials and change ipaddress to your ip address and add a port if needed)
3) Create a event based script to trigger the IFTTT Maker recipe like this:

-- *************************************** START OF SCRIPT ************************************* --
-- *********** If This Then That Maker Channel Trigger Event Version 1.0 Created by Erwin van der Zwart ********* --

-- *************************************** SET PARAMETERS ************************************* --

-- Set your personal secret key from received https://maker.ifttt.com
Maker_Secret_Key = 'PUTHEREYOURPERSONALMAKERKEY'

-- Unique trigger event name you have set in the 'Maker' recipe 'This' event
Maker_Event_Name = 'this_is_my_trigger_unique_event'  -- Have to match your trigger description you have set in the recipe

-- *************************************** END PARAMETERS ************************************* --

local https = require 'ssl.https'

function iftttmaker(Maker_Secret_Key, Maker_Event_Name)
local r, c, h, s = https.request{
  url = 'https://maker.ifttt.com/trigger/' .. Maker_Event_Name .. '/with/key/' .. Maker_Secret_Key,
    sink = ltn12.sink.table(resp),
    protocol = "tlsv1"
}
  return r, c, h, s
end

r, c, h, s = iftttmaker(Maker_Secret_Key, Maker_Event_Name)

-- ****************************************** END SCRIPT **************************************** --

Good luck!

Best Regards,

Erwin van der Zwart
Reply
#5
   
Hi Erwin,

I have tried integrating IFTTT with LM using Maker Webhooks and followed your script mentioned above but have not been able to trigger  desired action from IFTTT. My applet is getting skipped for some reason. Kindly help.
Reply
#6
Hi! Please try using new type of URL for remote services (without /cgi-bin/).
This example was done more than 1 year ago when we use another format for remote services. Here is more info on new type Remote services: http://openrb.com/docs/remote-new.htm
Reply
#7
Hi Erwin,

At the step 2)  when you say: "(change remote:remote to your credentials and change ipaddress to your ip address and add a port if needed)" is the "Remote:remote" the user:password of logic machine? and another question: is the ipadress the local one (i.e. 192.168...) of the logic Machine or the DNS server?


At the 3) step, when you say: "Create a event based script to trigger the IFTTT Maker recipe like this:....", I guess we have to do it on the LM configuration at scripting thumbnail , right?. 

In that case how can we know that the url: url = \https://maker.ifttt.com/trigger/' .. is the correct one? I do not know what the trigger  is on the IFTTT applet in order to write it correctly on the event based script on LM scripting thumbnail.

Could you give some further/detailed information at how to make the 3) step correctly? Additionally, I would like to know where to find the  Maker_Secret_Key on the created IFTTT applet at 1) and 2) stepMany thanks in advaced and thank you for your kind support.Best regards. 


I send you my best regards and many thanks in advanced.

***********************************************************************************************

Erwin van der Zwart Wrote: 

Hi,

You can use IFTTT in combination with the Maker Channel (bi-directional)

You have to enable the remote services in the controller (see controller manual) to receive commands and we need a script to send commands to IFTTT.

1) Create a Maker recipe with a unique trigger (for this example) "this_is_my_trigger_unique_event"
2) Create inside your recipe a action like: "http://remote:remote@ipadress/cgi-bin/scada-remote/request.cgi?m=json&r=grp&fn=write&alias=0/0/1&value=true" and
select method "get" and select content type "text / plain" body can be left empty. (change remote:remote to your credentials and change ipaddress to your ip address and add a port if needed)
3) Create a event based script to trigger the IFTTT Maker recipe like this:

-- *************************************** START OF SCRIPT ************************************* --
-- *********** If This Then That Maker Channel Trigger Event Version 1.0 Created by Erwin van der Zwart ********* --

-- *************************************** SET PARAMETERS ************************************* --

-- Set your personal secret key from received https://maker.ifttt.com
Maker_Secret_Key = 'PUTHEREYOURPERSONALMAKERKEY'

-- Unique trigger event name you have set in the 'Maker' recipe 'This' event
Maker_Event_Name = 'this_is_my_trigger_unique_event'  -- Have to match your trigger description you have set in the recipe

-- *************************************** END PARAMETERS ************************************* --

local https = require 'ssl.https'

function iftttmaker(Maker_Secret_Key, Maker_Event_Name)
local r, c, h, s = https.request{
  url = 'https://maker.ifttt.com/trigger/' .. Maker_Event_Name .. '/with/key/' .. Maker_Secret_Key,
    sink = ltn12.sink.table(resp),
    protocol = "tlsv1"
}
  return r, c, h, s
end

r, c, h, s = iftttmaker(Maker_Secret_Key, Maker_Event_Name)

-- ****************************************** END SCRIPT **************************************** --

Good luck!

Best Regards,

Erwin van der Zwart
Reply
#8
(11.08.2018, 18:50)SERGIO Wrote: Hi Erwin,

At the step 2)  when you say: "(change remote:remote to your credentials and change ipaddress to your ip address and add a port if needed)" is the "Remote:remote" the user:password of logic machine? and another question: is the ipadress the local one (i.e. 192.168...) of the logic Machine or the DNS server?


At the 3) step, when you say: "Create a event based script to trigger the IFTTT Maker recipe like this:....", I guess we have to do it on the LM configuration at scripting thumbnail , right?. 

In that case how can we know that the url: url = \https://maker.ifttt.com/trigger/' .. is the correct one? I do not know what the trigger  is on the IFTTT applet in order to write it correctly on the event based script on LM scripting thumbnail.

Could you give some further/detailed information at how to make the 3) step correctly? Additionally, I would like to know where to find the  Maker_Secret_Key on the created IFTTT applet at 1) and 2) stepMany thanks in advaced and thank you for your kind support.Best regards. 


I send you my best regards and many thanks in advanced.

***********************************************************************************************

Erwin van der Zwart Wrote: 

Hi,

You can use IFTTT in combination with the Maker Channel (bi-directional)

You have to enable the remote services in the controller (see controller manual) to receive commands and we need a script to send commands to IFTTT.

1) Create a Maker recipe with a unique trigger (for this example) "this_is_my_trigger_unique_event"
2) Create inside your recipe a action like: "http://remote:remote@ipadress/cgi-bin/scada-remote/request.cgi?m=json&r=grp&fn=write&alias=0/0/1&value=true" and
select method "get" and select content type "text / plain" body can be left empty. (change remote:remote to your credentials and change ipaddress to your ip address and add a port if needed)
3) Create a event based script to trigger the IFTTT Maker recipe like this:

-- *************************************** START OF SCRIPT ************************************* --
-- *********** If This Then That Maker Channel Trigger Event Version 1.0 Created by Erwin van der Zwart ********* --

-- *************************************** SET PARAMETERS ************************************* --

-- Set your personal secret key from received https://maker.ifttt.com
Maker_Secret_Key = 'PUTHEREYOURPERSONALMAKERKEY'

-- Unique trigger event name you have set in the 'Maker' recipe 'This' event
Maker_Event_Name = 'this_is_my_trigger_unique_event'  -- Have to match your trigger description you have set in the recipe

-- *************************************** END PARAMETERS ************************************* --

local https = require 'ssl.https'

function iftttmaker(Maker_Secret_Key, Maker_Event_Name)
local r, c, h, s = https.request{
  url = 'https://maker.ifttt.com/trigger/' .. Maker_Event_Name .. '/with/key/' .. Maker_Secret_Key,
    sink = ltn12.sink.table(resp),
    protocol = "tlsv1"
}
  return r, c, h, s
end

r, c, h, s = iftttmaker(Maker_Secret_Key, Maker_Event_Name)

-- ****************************************** END SCRIPT **************************************** --

Good luck!

Best Regards,

Erwin van der Zwart

Hi Erwin/Sergio.

I am also trying to get IFTTT implemented in LM.
I assume it is public ip address I have to insert and port-forward to LM. And not the IP address of LM on my local network.
I'm not so happy to port-forwarde to LM, but wondered if it was a safe port only for "remote service"
Reply
#9
Yes external IP and external port. Use HTTPS and port 443 so at last it will be encrypted.
------------------------------
Ctrl+F5
Reply
#10
(14.08.2018, 11:12)Daniel. Wrote: Yes external IP and external port. Use HTTPS and port 443 so at last it will be encrypted.

Thank you Daniel,

so the url would be i.e.: https://remote:remote@public_ip:port/scada-remote?m=json&r=grp&fn=write&alias=1/1/1&value=50

Is that correct? I intorduce my external IP and It does not work.

Besides, the problem is that the  external IP change every day...so I would like to avoid pay for a such service.

Best regards.
Reply
#11
Yes, use ddns service, there are plenty of free ones. I use no-ip.com
------------------------------
Ctrl+F5
Reply
#12
(14.08.2018, 18:49)Daniel. Wrote: Yes, use ddns service, there are plenty of free ones.  I use no-ip.com

So, It would remain as: http://username:password@public_hostname:port/scada-remote?m=json&r=grp&fn=write&alias=1/1/1&value=50 , right?

Note: Username and password of your router credentials?

Best regards
Reply
#13
Hi,

Nope, the credentials in the URL are the ones you have set in the remote services of the controller.

Username is always ‘remote’ and default password is also ‘remote’, make sure the remote service is enabled.

BR,

Erwin
Reply
#14
(19.08.2018, 22:19)Erwin van der Zwart Wrote: Hi,

Nope, the credentials in the URL are the ones you have set in the remote services of the controller.

Username is always ‘remote’ and default password is also ‘remote’, make sure the remote service is enabled.

BR,

Erwin

ok, remote service is enable and user name is remote and password is also remote, but this is still not working.....I do not what is happening.

note: I already have a hostname which is perfectly working as external IP

Best regards.
Reply
#15
Paste your URL in to any browser and press enter, let us know what you get as result.
------------------------------
Ctrl+F5
Reply
#16
(20.08.2018, 19:30)Daniel. Wrote: Paste your URL in to any browser and press enter, let us know what you get as result.

See attached. I do not what is going on.

Thank you in advanced for your kind help.

Attached Files Thumbnail(s)
   
Reply
#17
No access to the device means port not opened.
------------------------------
Ctrl+F5
Reply
#18
Hi!
Please tell me how to add a variable to the above script.
In this format

Content-Type: application / json

{"value1": "123"}
Reply
#19
JSON post example:
Code:
function post(url, body)
  local ltn12 = require('ltn12')
  local https = require('ssl.https')
  local sink = {}

  local res, err = https.request({
    url = url,
    method = 'POST',
    headers = {
      ['Content-Length'] = #body,
      ['Content-Type'] = 'application/json',
    },
    sink = ltn12.sink.table(sink),
    source = ltn12.source.string(body),
  })

  if res then
    return table.concat(sink)
  else
    return nil, err
  end
end

require('json')

url = 'https://postman-echo.com/post'
body = json.encode({ value1 = '123' })
res, err = post(url, body)
Reply
#20
Hello, i tried to send a voice command to logic machine by IFTTT. As trigger i used google assistant and for sending command, i used webhooks. I follow the steps above but for me not working. My address is with http not https, so what should i do different in script?

http://user:password@xx.xx.xx.xxx:80/sca...alue=false

If i try from browser it works but from webhooks not working.

Google assistent was working. I think the webhooks working too but the response is "Timed out waiting for response from http://remote....".

Can you help me please?
Best regards,
Alexandru.
Reply


Forum Jump: