[ANSWERED]: Setting up a script for timing actions

Posted on
Thu Dec 11, 2014 3:56 am
haavarda offline
User avatar
Posts: 702
Joined: Aug 18, 2012
Location: Norway

[ANSWERED]: Setting up a script for timing actions

I am trying to set up a script that performs some actions. The clue to this is to get the timing right.
I want to try to control the angle of my vertical blinds, that are controlled by the rfx plugin. I think I have most of the information. But I am failing to put the pieces together. Hope someone can help me a bit with that.

What I want to do is the following:
1: Run action "Angle-"
2: After 3 seconds run action "STOP"

I have found the following information about this topic:
executeAction(actionId, deviceId, props.

I have found some information in the plugin. And I think action Id can be seen from this:
Action deviceFilter="nl.rjdekok.indigoplugin.RFXCOM.Somfy" id="AngleMinSomfyRelay"> <Name>Angle- Somfy</Name> <CallbackMethod>AngleMinRelay</CallbackMethod>
Action deviceFilter="nl.rjdekok.indigoplugin.RFXCOM.Somfy" id="stopSomfyRelay"> <Name>Stop Somfy</Name> <CallbackMethod>stopRelay</CallbackMethod>

Is this enough info to setup a script that calls these 2 actions?

regards

Håvard

Posted on
Thu Dec 11, 2014 9:28 pm
matt (support) offline
Site Admin
User avatar
Posts: 21417
Joined: Jan 27, 2003
Location: Texas

Re: Setting up a script for timing actions

In the Action's XML for those 2 actions are there other fields (for example for the angle?)? Those will get translated into the properties used when you call the API.

Your python will look something like this (assuming the angle field id attribute is "angle"):
Code: Select all
rfxPluginID = "nl.rjdekok.indigoplugin.RFXCOM"
rfxPlugin = indigo.server.getPlugin(rfxPluginID)
rfxPlugin.executeAction("AngleMinSomfyRelay", deviceId=someSomfyDevIdHere, props={'angle':50})

Image

Posted on
Sun Dec 14, 2014 1:47 am
haavarda offline
User avatar
Posts: 702
Joined: Aug 18, 2012
Location: Norway

Re: [ANSWERED]: Setting up a script for timing actions

Hi Matt,
Thanks for your reply.
The angle adjustment is an on/off function. So what I want to do is to send an angle - command and a stop command as precise as possible 3 seconds later. As I have understood, doing this in a script is the way to go...?
I am not sure where I can find the props information. Is this in the plugin file?

There is not any more information about angle in the actions xml file than I have already posted:

<Action id="AnglePlusSomfyRelay" deviceFilter="nl.rjdekok.indigoplugin.RFXCOM.Somfy">
<Name>Angle+ Somfy</Name>
<CallbackMethod>AnglePlusRelay</CallbackMethod>
</Action>
<Action id="AngleMinSomfyRelay" deviceFilter="nl.rjdekok.indigoplugin.RFXCOM.Somfy">
<Name>Angle- Somfy</Name>
<CallbackMethod>AngleMinRelay</CallbackMethod>


regards

Håvard

Posted on
Sun Dec 14, 2014 2:12 pm
matt (support) offline
Site Admin
User avatar
Posts: 21417
Joined: Jan 27, 2003
Location: Texas

Re: [ANSWERED]: Setting up a script for timing actions

Okay, neither of those actions have properties so you can just leave the props argument off totally.

For the sleep between the 2 commands try:

indigo.activePlugin.sleep(3)

Note, however, that because of the way the actions and outgoing interface (Z-Stick) commands are queued the 3 second delay may not be precise enough. For example, if there is a lot of Z-Wave traffic or queued up outgoing Z-Wave commands then it is possible the delay between the 2 actions will be much less than 3 seconds.

Image

Posted on
Sun Dec 14, 2014 3:44 pm
haavarda offline
User avatar
Posts: 702
Joined: Aug 18, 2012
Location: Norway

Re: [ANSWERED]: Setting up a script for timing actions

This commands are sent with the rfx plugin, so this is not z-wave. But I guess the principal is the same?

Håvard

Posted on
Mon Dec 15, 2014 6:25 am
haavarda offline
User avatar
Posts: 702
Joined: Aug 18, 2012
Location: Norway

Re: [ANSWERED]: Setting up a script for timing actions

I have managed to get it to work. It is sending the signals. I will do some more testing to determine if the timing is sufficient.
Hovever it works with this line:

Code: Select all
rfxPlugin = indigo.server.getPlugin(rfxPluginID)


Should I put something in for PluginID? Is it strange that the script works without this value specified?
And do you know where I can find PluginID?

My script now looks like this:
Code: Select all
rfxPluginID = "nl.rjdekok.indigoplugin.RFXCOM"
rfxPlugin = indigo.server.getPlugin(rfxPluginID)
rfxPlugin.executeAction("AngleMinSomfyRelay", deviceId=1039539032,)

indigo.activePlugin.sleep(2.5)

rfxPlugin.executeAction("stopSomfyRelay", deviceId=1039539032,)


thanks for your support.

Regards.

Håvard

Posted on
Mon Dec 15, 2014 3:15 pm
haavarda offline
User avatar
Posts: 702
Joined: Aug 18, 2012
Location: Norway

Re: [ANSWERED]: Setting up a script for timing actions

Aha, I found the pluginID. I missed that this was just a reference. I thought it was something I had to fill out my self...
I will just have to tune a bit on the delay now.

Would the timing precision be better if this is run as a shell script?

Håvard

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 3 guests