First off, my recommendation for this particular case is
not to do explicit updates. The default behavior of a
Cynical Weather device is to auto-update every 5 minutes. The weather doesn't change
that fast. Also, the plugin has a hard limiter that ignores update requests less than 5 minutes after the last update. So unless you're intentionally slowing down or turning off automatic updates, this isn't going to help. (There's also a limit to how many requests Dark Sky honors each day.)
Having said all that, let me walk you through the process. First off, you need to know what action you want to call. Look it up in the plugin's documentation (click on one of those question-mark buttons in the plugin's UI). That'll tell you that there is, indeed, an action called
Update Data that does what you want. Now you have the option to do this the Indigo way: create an action group that first invokes the
Update Data action and then calls a Python script action containing your code. That requires no fancy Python tap-dancing, and I generally recommend that.
If you
really want to call the action from Python code, here's the rough outline of how to go about it. You need to open up the plugin's bundle and rummage through its xml files. You need the internal name of the plugin (found in its Info.plist, in this case
org.cynic.indigo.weather), and the internal name of the action (found in the Actions.xml file, in this case
poll). Here you will also find a description of the action's arguments, but this one has none.
Now you can put it all together:
- Code: Select all
plugin = indigo.server.getPlugin("org.cynic.indigo.weather")
deviceid = (the id for the weather device, from Indigo's device list)
arguments = {} # arguments to the action -- this one has none
plugin.executeAction("poll", deviceid, arguments)
And there you are.
Cheers
-- perry