Page 1 of 1

Syntax for python script

PostPosted: Mon Jun 19, 2017 3:51 pm
by qcvictor
Hi Guys
I'm looking for get good syntax for use in python script, I want replace the send mail by prowl like in this example
Code: Select all
dev = indigo.devices[IOLINCID] # "IO Linc"
if not dev.states["binaryInput1"]:
    indigo.server.sendEmailTo("ADDRESSHERE", subject="The garage door is OPEN!!")
from the wiki!

Re: Syntax for python script

PostPosted: Tue Jun 20, 2017 10:03 am
by jay (support)
I'd recommend just creating an Action Group that does the notification, then calling the action group from your script:

Code: Select all
dev = indigo.devices[IOLINCID] # "IO Linc"
if not dev.states["binaryInput1"]:
    indigo.actionGroup.execute(12345) # ID of action group that sends notification


That way you can change it, add more notifications, etc. in the UI rather than editing the script.