Replacing HouseModes Plug-In with Reactor

For Reactor™ users who want to downsize their Vera setup by eliminating unnecessary plug-ins whenever possible, here are some pointers for a smooth transition away from the HouseModes™ app.

BASIC: THE EASY PART — GET & SET

You can accomplish the basic reading and setting of Vera’s house mode – that is, the assignment of a ‘Home’, ‘Away’, ‘Night’ or ‘Vacation’ value – using Conditions in much the same way as you’ve always done.

For example, if you previously used this trigger in Scenes before:

["Whenever House Mode has changed to:"]  [Home / Away / Night / Vacation]

…or had this Condition as a trigger in Reactor:

[Device State]  [House Modes (#107)]  [Changes]  [(any)]  [(any)]

…then you can leverage Reactor’s built-in “House Mode” feature instead:

[House Mode]  [Changes from]  [(any)]  [(any)]

To watch the current House Mode with an Expression variable, define:

hMode := getstate( NN , "urn:toggledbits-com:serviceId:Reactor" , "HouseMode" )

replacing NN with the actual device ID number of your master Reactor device.

Setting the House Mode with Reactor in an Activity is just as straightforward:

[Change House Mode] = [Home / Away / Night / Vacation]

ADVANCED: SETTING HOUSE MODE USING LUA OR WITH VARIABLES

Setting the House Mode using Lua requires the following action step:

luup.call_action( "urn:micasaverde-com:serviceId:HomeAutomationGateway1", "SetHouseMode", { Mode = N }, 0 )

where the ‘Mode’ value N represents an integer from 1 to 4, corresponding to Home / Away / Night / Vacation.

WARNING: DO NOT ATTEMPT TO SET THE ‘HouseMode’ VARIABLE DIRECTLY ON THE MASTER REACTOR DEVICE! As with many such variables, it is meant for ‘Read’ not ‘Write’ access.

If your setup is a bit more complex – for instance, deriving the intended target ‘Mode’ value from another Expression variable, such as ‘ModeNum’ – then it is possible to assign that value in Lua with:

luup.call_action( "urn:micasaverde-com:serviceId:HomeAutomationGateway1", "SetHouseMode", { Mode = Reactor.variables.ModeNum }, 0 )

which in turn will instruct Vera to switch to the House Mode (1-4) specified by ‘ModeNum’.

Hope this helps! Once you have fully tested the new Reactor setup, and are satisfied that House Mode changes are happening as desired, go ahead and ‘Remove’ the old HouseModes™ app.

  • LibraSun

ADDITIONAL READING for AltUI users at Access House modes without the House Modes Plugin? - Alternate UI - Ezlo Community

2 Likes

This is a general Vera tru-ism. Rarely is setting a state variable the way to cause an action. You invoke an action to cause an action (and it will typically modify state variables).

Simple example: luup.variable_set("urn:upnp-org:serviceId:SwitchPower1","Target",1,nnn) will not turn on a light. Using call_action( "urn:upnp-org:serviceId:SwitchPower1", "SetTarget", { newTargetValue="1" }, nnn) will, and will also change the Target variable. When the light device enters the correct state, the Status variable will follow.

2 Likes

ADDITIONAL BONUS

The old House Modes plugin has to poll the Vera user data/root attribute to detect house mode changes. That means, to get quick response to a house mode change when using the House Modes plugin, you have to either set a short poll interval in the plugin (wastes CPU), or your detection may be delayed up to the poll time (e.g. if you poll every 60 seconds, it may take 59 seconds before the House Modes plugin detects the change).

Reactor detects house mode changes instantly.

And that also makes it fast then, ahem, other similar plugins.

2 Likes

Arguably the only functionality one might be giving up is the

[HOME][AWAY][NIGHT][VACATION]

button interface, a fair trade-off considering the speed increase.

There are already buttons on the Vera UI, though…

2 Likes