I’m just getting my feet wet in the world of using the MiOS actions and not 100% sure yet the best way to use them or how to map things to a action call.
I have the ISY994i plugin running on my Vera and it works great. One of the abilities the plugin provides to vera/lua code is the ability to directly execute a ISY program on the ISY unit from the Vera.
As I move logic off the vera, I’d really like to be able to do this from an OH rule. The ISY plugin has a ‘runProgram’ action that takes a program number (4 digit hex) and a program path (a string, usually ‘run’, but can be other things).
Any recommendations on best way to approach this (or at least start investigating this) as an action from a OH rule?
Doing this my first time – hope this doesn’t sound too stupid:
The mios action I want to call is ‘runProgram’ and the UPnP section is “urn:garrettwp-com:serviceId:ISYController1”. With that, I’d call it like callMiosAction([theIDItem], ‘ISYController1/runProgram’, newArrayList(…)), correct? Or do I need to put the entire “urn:garrettwp-com…/runProgram”?
The “item ID” 1st parameter – is that a number or an Item. I have an item called ISYControllerId which is the ID item for that Vera device. Do I pass it, it.state (i.e. ISYControllerId.state) or the actual vera device # in the 1st parameter?
Do I just use the call ‘sendMiosAction(…)’ in the rule? Do I need to import anything and/or qualify anything? I added that latest mios binding/action jars to the designers addons/ directory but it’s flagging my call as having errors saying it can’t resolve sendMiosAction. My exact code is:
sendMiosAction(ISYControllerId, "ISYController1/runProgram", newArrayList('program' -> '006A', 'path' -> 'run'))
- The docs/README.md examples show both a sendMiosAction() call and a sendMios() call (no “Action” in it). Are both allowed? (I tried both forms and the designer complained for both of them).
That’s probably best handled by the MiOS Action Binding, within a openHAB Rule, which you can get from the 1.7 Cloudbees path. The README for that Binding is here:
Assuming you’ve already Bound an Item to the correct DeviceId in Vera, then it would be something like:
sendMiosAction(IsyId, "urn:garrettwp-com:serviceId:ISYController1/runProgram", newArrayList('program' -> 'DEAD', 'path' -> 'run'))
The quickest way to find out what a MiOS Device exposes in UPnP is:
and then surf the tree until you come across the relevant part.
I merged your topic posts, since they’re related.
Thanks for the answer! I was editing my post just as you merged it, so there may be stuff in there you didn’t see before. I think it was only 3) OH Designer complains about the call and 4) the small difference in the README.md for the actions.
Thanks again – I’m really appreciating everything I can do with the Vera/OH combo!!
1) The mios action I want to call is 'runProgram' and the UPnP section is "urn:garrettwp-com:serviceId:ISYController1". With that, I'd call it like callMiosAction([theIDItem], 'ISYController1/runProgram', newArrayList(.....)), correct? Or do I need to put the entire "urn:garrettwp-com......./runProgram"?
See above. There's no UPnP alias defined for a number of the Custom Plugins and, for these cases, the fully spelled out UPnP ServiceId is needed.
2) The "item ID" 1st parameter -- is that a number or an Item. I have an item called ISYControllerId which is the ID item for that Vera device. Do I pass it, it.state (i.e. ISYControllerId.state) or the actual vera device # in the 1st parameter?
The “[tt]*Id[/tt]” Item is a Number type. You pass an Item as the first parameter, and not the Item’s State.
Technically, you can use any Items bound to that Device in Vera, since I’m only using them to get the [MiOS] device-id handle required by the MiOS Communications layer. In openHAB 2.x, these calls would likely be made against the “Thing”, not the “Channel”, since that’s a closer match to a Vera Device.
I did it this way to avoid polluting the openHAB Rule file with [Non-Item] references to where Vera is (eg. URL’s, etc)
4) The docs/README.md examples show both a sendMiosAction() call and a sendMios() call (no "Action" in it). Are both allowed? (I tried both forms and the designer complained for both of them).
That’s a Doc throwback. It was originally sendMios(), and then I made it sendMiosAction() so I could add others as needed. The Doc section on “Extensions” has them listed correctly.
3) Do I just use the call 'sendMiosAction(.....)' in the rule? Do I need to import anything and/or qualify anything? I added that latest mios binding/action jars to the designers addons/ directory but it's flagging my call as having errors saying it can't resolve sendMiosAction. My exact code is:
I’ve never used the Designer, so no idea why it wouldn’t pick it up there. All my work is done with the CLI
Thanks again – I’ll just test it.
I generally avoid the designer too, but I haven’t found a good way to ‘test’ rule logic quickly. The designer, hobbled though it may be, will at least bitch about obvious things (unknown items, typos, missing imports, etc) giving me a shot at a rule that likely works first time around. I code mostly in emacs, but open things in the designer as a ‘sanity’ check before uploading the rules to my OH server.
MiOS Action(s) are only implemented in the 1.7 line. If you’re using them, you’d need to be using a Designer from that line also.
For testing Rules, I use [tt]vi[/tt] on a [new] Rule file with a Time/cron driving it every few seconds. You can edit it, and see if it’s correct or not using another window that’s tailing [tt]logs/openhab.log[/tt] (or another shell-pane if you’re using emacs).
It’s quick, simple and fast (my favorite friends)