MiOS Scenes and OH

Howdy,

I’m reading over the section in the MiOS/OH wiki about scenes. Chalk this up to my relatively recent entrance to the OH world, but two items:

  1. Could someone show an example of activating a MiOS scene from an OH rule? I think I get the syntax, but not 100%

  2. Is there a way to “catch” when a MiOS scene is activated on the vera? I saw the state stuff, but I read it as active meaning that all the devices match the scene (an ability in the Vera I’ve never used – almost none of my vera scenes have any devices attached to them).

I know scenes don’t have state per-se (short of that ‘all devices match the scene’), but I would love to be able to write rules that were triggered anytime something ‘activated’/triggered a scene on the vera.

Thanks!

Gerry

In my Items file, I have an entry like:

/* Scene AV Off */ String SceneAVOff "AV Off" <sofa> (GScene) {mios="unit:house,scene:120/status", autoupdate="false"} Contact SceneAVOffActive "Active [%s]" <sofa> {mios="unit:house,scene:120/active"}

and the Generator generates something similar for each Scene that you have.

When you activate this scene in Vera (via a Remote Control, for example) these Items will make certain State transitions.

Roughly, for a successful Scene execution, SceneAVOff will make the transition: NONE, PENDING, SUCCESS, NONE.
Of course, if the scene execution fails, then the path will be different.

Similarly, if the Vera Scene has been setup to “be Active” (Scene Advanced Tab, Scene is ‘active’ option) then the state of SceneAVOffActive will follow that (going from OPEN to CLOSED, for example)

Using this, you can write Rules in openHAB that fire “[tt]when[/tt]” an "[tt]Item "[/tt] “[tt]changed from [/tt]” “[tt] to [/tt]” .

The rest should be able to follow the rest of the openHAB Rules examples, depending upon what you want to do.

To run a Scene in Vera, via an openHAB Rule, you can simply send any command to the Scene.

eg. sendCommand(SceneAVOff, ON)

The ON (no quotes) is a built-in command constant, so you can equally send it OFF and it will fire also since the MiOS Binding runs the Scene, for a given Scene Item, when a Command it sent to it.

That said, Vera is buggy. During these transitions you’ll find that Vera’s “Scene” attribute will repeat some of these changes, and the transition looks more like: NONE, PENDING, PENDING, PENDING, PENDING, PENDING, SUCCESS, SUCCESS, SUCCESS, SUCCESS, SUCCESS, NONE, NONE, NONE, NONE, NONE, NONE, NONE

Something similar occurs for the “Active” attribute.

Perfect!! Thanks so much!

I’m guessing, based on your comments, my most reliable “when” rule will be transition from SUCCESS to NONE. That way I don’t trigger until complete and if there are multiple SUCCESS statuses for any reason that involves some actual work on the VERA, this won’t trigger until the all that processing is complete.

Gerry

[quote=“gduprey, post:3, topic:185645”]Perfect!! Thanks so much!

I’m guessing, based on your comments, my most reliable “when” rule will be transition from SUCCESS to NONE. That way I don’t trigger until complete and if there are multiple SUCCESS statuses for any reason that involves some actual work on the VERA, this won’t trigger until the all that processing is complete.

Gerry[/quote]

Yup… 8)