Hi
Sorry been away, and not sure that teaching python via PM/forum ideal.
But can probably do most of what you what with the device or variable substitution power of Indigo.
Pretty sure the Messages Plugin Supports - if not I'll add. (sorry will look at code to confirm support, most of my plugins support it)
But basically if you send a message like
As you can see - supports Device and Variable Substitution
%%d:241092027:temperature%%
This means Device ID 241092027 and field - Temperature.
Before being sent will change to the actual Device field eg. 24.3 degrees.
Likewise can do the same for variables.
See Here:
https://wiki.indigodomo.com/doku.php?id ... bstitutionSo could have standard message:
Using variable for time
OR - to use Python
It is documented on the bottom of readme
https://github.com/Ghawken/iMessagePlugin- Code: Select all
imessageID = 'com.GlennNZ.indigoplugin.iMessage'
imsgPlugin = indigo.server.getPlugin(imessageID)
imsgPlugin.executeAction('sendQuestion', props={'message':'The question you wish to ask', 'buddyId':'example@email.com', 'lastBuddy':False, 'timeout':600,'confirmedimsg':'All done.','actiongroup':ActionGroupIDtoRunwhenConfirmed})
return;
This bit will call the plugins executeAction question code.
Alternatively to use send a message using python
- Code: Select all
imessageID = 'com.GlennNZ.indigoplugin.iMessage'
imsgPlugin = indigo.server.getPlugin(imessageID)
imsgPlugin.executeAction('as_sendmessage', props={'message':'The message you want to send ', 'buddyId':'example@email.com'})
Obviously above would remove 'The message you want to send' with a string variable and change to whatever.
To get current datetime, use a python datetime function like time - which would need to be imported
- Code: Select all
import datetime
now = datetime.now()
# dd/mm/YY H:M:S
dt_string = now.strftime("%d/%m/%Y %H:%M:%S")
# and add togther the message you want to send
messagevariable = dt_string + " was the time this was sent"
imessageID = 'com.GlennNZ.indigoplugin.iMessage'
imsgPlugin = indigo.server.getPlugin(imessageID)
imsgPlugin.executeAction('as_sendmessage', props={'message':messagevariable, 'buddyId':'example@email.com'})
Like above - sorry can't test this currently, so maybe some formatting errors (I do a lot of C# stuff, so sometimes my brain/syntax is in the wrong language!) But think this will be okay.
Glenn