dzvents and ifttt  [Solved]

Easy to use, 100% Lua-based event scripting framework.

Moderator: leecollings

Post Reply
bdormael
Posts: 82
Joined: Saturday 13 December 2014 21:20
Target OS: Linux
Domoticz version:
Contact:

dzvents and ifttt

Post by bdormael »

couldnt find it back in the docs:
via LUA you can do a command array which executes a webhook in ifttt via "triggerifttt"

Does something similar exists fir dvents?
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: dzvents and ifttt

Post by waaren »

(as adviced by Danny) IFTTT not implemented yet in native dzVents domoticz.notify but can be triggered using domoticz.sendCommand if you defined and activated IFTTT in settings -> notifications

Code: Select all

return {
   on = { devices = { "domoticz Triggerdevice"  } },
   
    execute = function(domoticz, device)
	  eventName = "IFTTT triggername"
	  
	  value1 = "test1"
	  value2 = "test2"
	  value3 = "test3"
	  
	  domoticz.sendCommand("TriggerIFTTT", eventName .. "#" .. value1 .. "#" .. value2 .. "#" .. value3 )  

     end
}
Last edited by waaren on Tuesday 27 February 2018 21:17, edited 1 time in total.
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
bdormael
Posts: 82
Joined: Saturday 13 December 2014 21:20
Target OS: Linux
Domoticz version:
Contact:

Re: dzvents and ifttt

Post by bdormael »

waaren wrote:IFTTT not implemented yet in native dzVents domoticz.notify but can be triggered using domoticz.sendCommand if you defined and activated IFTTT in settings -> notifications

Code: Select all

return {
   on = { devices = { "domoticz Triggerdevice"  } },
   
    execute = function(domoticz, device)
	  eventName = "IFTTT triggername"
	  
	  value1 = "test1"
	  value2 = "test2"
	  value3 = "test3"
	  
	  domoticz.sendCommand("TriggerIFTTT", eventName .. "#" .. value1 .. "#" .. value2 .. "#" .. value3 )  

     end
}
Cool, thx


Verzonden vanaf mijn iPad met Tapatalk
User avatar
DewGew
Posts: 581
Joined: Thursday 21 April 2016 12:01
Target OS: Raspberry Pi / ODroid
Domoticz version: V4.10618
Location: Sweden
Contact:

Re: dzvents and ifttt

Post by DewGew »

I do like this:

I added this code to my 'global_data.lua'

Code: Select all

return {
	helpers = {
			-- Send IFTTT Notification
			iftttNotify = function(domoticz, subject, body)
				eventName = 'Domoticz'
				prefix = 'Domoticz:'
				domoticz.sendCommand("TriggerIFTTT", eventName .. "#" .. prefix .. "#" .. subject .. "#" .. body )
			end
	}
}
Now I can call send ifttt notification from all my dzVents script with:

Code: Select all

domoticz.helpers.iftttNotify(domoticz, 'subject text here', 'body text here')
Raspberry Pi 3 | domoticz | Aeon Labs Z-Stick GEN5 | RFlink gateway
NanoPi NEO-air | REGO6XX interface | Machinon theme | Homebridge | Domoticz Google Assistant | ideAlarm
pvklink
Posts: 822
Joined: Wednesday 12 November 2014 15:01
Target OS: Raspberry Pi / ODroid
Domoticz version: latest b
Contact:

Re: dzvents and ifttt

Post by pvklink »

To use the notification in IFTTT, what service / applet do i have to install in IFTTT.
Is it possible to let my google home speak with this for example?
Raspberry (raspbian on rpi 3) , Domoticz Beta, dzVents , RFXtrx433e, P1, Hue, Yeelight, Zwave+, X10, ESP(easy), MQTT,Weather Underground, System Alive Checker, Domoticz Remote Server to RPI with Google Assistant,
Jablotron connection, Ikea
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: dzvents and ifttt

Post by waaren »

pvklink wrote: Tuesday 04 June 2019 15:14 To use the notification in IFTTT, what service / applet do i have to install in IFTTT.
Is it possible to let my google home speak with this for example?
triggerIFTTT is a native dzVents command in dzVents >= 2.4.18
It will call an IFTTT maker event (webhook)
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
pvklink
Posts: 822
Joined: Wednesday 12 November 2014 15:01
Target OS: Raspberry Pi / ODroid
Domoticz version: latest b
Contact:

Re: dzvents and ifttt

Post by pvklink »

ok, thats great!
And the other script, what is the purpose of sending a notification to ifttt, which service/applet is reacting on this notification?
Raspberry (raspbian on rpi 3) , Domoticz Beta, dzVents , RFXtrx433e, P1, Hue, Yeelight, Zwave+, X10, ESP(easy), MQTT,Weather Underground, System Alive Checker, Domoticz Remote Server to RPI with Google Assistant,
Jablotron connection, Ikea
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: dzvents and ifttt

Post by waaren »

pvklink wrote: Tuesday 04 June 2019 20:44 ok, thats great!
And the other script, what is the purpose of sending a notification to ifttt, which service/applet is reacting on this notification?
the triggerIFTTT takes care of the If This part
the Then That part can be any IFTTT action service (there are thousands). I use mail, pushover, Hue, SmartLife to name a few.
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
pvklink
Posts: 822
Joined: Wednesday 12 November 2014 15:01
Target OS: Raspberry Pi / ODroid
Domoticz version: latest b
Contact:

Re: dzvents and ifttt

Post by pvklink »

Clear, i also use IFTTT to manage my domoticz devices via my rpi google home...

But to make things work you have to make an applet with a If (service) and a then (service).
In my case i use google home for the IF and often WEBHOOKS for the THEN.

How do i call the THEN service (with the IFTTT domoticz routine, i dont see a ID, the applets have an Applet version ID 100306821. i dont see such an ID for the for THEN services....

I tried..
do you have a working example ?

Code: Select all

return {
	on = {
		devices = {
			'testifttt'
		}
	},
	execute = function(domoticz, device)
		domoticz.log('Device ' .. device.name .. ' was changed', domoticz.LOG_INFO)

	  eventName = "Play a Sonos favorite with Google Assistant"
	  
	  value1 = "Natural"
	  value2 = "Studeerkamer"
	  value3 = "this room only"
	  
	  domoticz.sendCommand("TriggerIFTTT", eventName .. "#" .. value1 .. "#" .. value2 .. "#" .. value3 )  

  end
}
can i call for example the webhook service with the domoticz call?
url https://x:[email protected]:1880/t
method post
content/type application/json
body {"command": "switchlight", "idx": 1002, "switchcmd": "On"}
Raspberry (raspbian on rpi 3) , Domoticz Beta, dzVents , RFXtrx433e, P1, Hue, Yeelight, Zwave+, X10, ESP(easy), MQTT,Weather Underground, System Alive Checker, Domoticz Remote Server to RPI with Google Assistant,
Jablotron connection, Ikea
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: dzvents and ifttt

Post by waaren »

pvklink wrote: Wednesday 05 June 2019 14:59 How do i call the THEN service (with the IFTTT domoticz routine, i dont see a ID, the applets have an Applet version ID 100306821. i dont see such an ID for the for THEN services....
The domoticz IFTTT (dzVents triggerIFTTT) does the IF part. The THAT part is on the 'other' site. The name of the maker event is the trigger for IFTTT

from the wiki:
triggerIFTTT(makerName [,sValue1, sValue2, sValue3]): Function. 2.4.18 Have Domoticz 'call' an IFTTT maker event. makerName is required, 0-3 sValue's are optional. Supports command options.
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
pvklink
Posts: 822
Joined: Wednesday 12 November 2014 15:01
Target OS: Raspberry Pi / ODroid
Domoticz version: latest b
Contact:

Re: dzvents and ifttt  [Solved]

Post by pvklink »

finally got it working....
made a test_event with webhooks as IF and webhooks as THEN.
called the name of the applet and my light goes on....

Would be great if you can have more IF's and then response and then ACTION. In this way i can trigger my device from google home and by IFTTT domoticz with the same reaction via google home... and do the same action

but for now ok! thanks waaren!
Raspberry (raspbian on rpi 3) , Domoticz Beta, dzVents , RFXtrx433e, P1, Hue, Yeelight, Zwave+, X10, ESP(easy), MQTT,Weather Underground, System Alive Checker, Domoticz Remote Server to RPI with Google Assistant,
Jablotron connection, Ikea
User avatar
waaren
Posts: 6028
Joined: Tuesday 03 January 2017 14:18
Target OS: Linux
Domoticz version: Beta
Location: Netherlands
Contact:

Re: dzvents and ifttt

Post by waaren »

pvklink wrote: Wednesday 05 June 2019 16:10 finally got it working....
Great !
Would be great if you can have more IF's and then response and then ACTION. In this way i can trigger my device from google home and by IFTTT domoticz with the same reaction via google home... and do the same action
You might want to have a look at this

Adding multiple devices to IFTTT
A PHP script is available that makes it easier to have all of your devices on IFTTT while only requiring you to create two IFTTT applets.
You can read more about it and download here: https://github.com/dswinton/domo-ifttt
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
pvklink
Posts: 822
Joined: Wednesday 12 November 2014 15:01
Target OS: Raspberry Pi / ODroid
Domoticz version: latest b
Contact:

Re: dzvents and ifttt

Post by pvklink »

true!
I had that installed in previous/older installations!
i switched from http get commands to post with json bodies, and node-red and mqtt
Dont think i can combine it... domo-ifttt uses devices-names and select id's with it...
I think that is hard to do with node-red and mqtt
Raspberry (raspbian on rpi 3) , Domoticz Beta, dzVents , RFXtrx433e, P1, Hue, Yeelight, Zwave+, X10, ESP(easy), MQTT,Weather Underground, System Alive Checker, Domoticz Remote Server to RPI with Google Assistant,
Jablotron connection, Ikea
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest