MiOS Binding - House Mode

Is it possible to be able to control the house mode of Vera or by Vera House mode plugin via Openhab? I’ve tried but not had it work so far… Any tip?

@sebastian_strindlund,
I don’t have UI7, but a recent manual conversion of a UI7 user_data.xml let me see the data that Vera is using.

The serviceId appears to be:

urn:micasaverde-com:serviceId:HouseModes1

and the method is something like:

SetHMode(HMode=1)

no idea what “1” is, as compared to the other values it can take.

Anyhow, these are mapped by default, so you’d have to use the full syntax from:

or just use the MiOS Action Binding:

eg. sendMiosAction(MyHouseModeId, "urn:micasaverde-com:serviceId:HouseModes1/SetHMode", newArrayList('HMode' -> '1')

… I just can’t test it, since I’m on MiOS/Vera UI5 :wink:

If you confirm it’s working, I’ll add some more defaults into the MiOS Binding for 1.8.x.

I’ve already checked in the HouseModes1 serviceId alias, but it requires r1.8 to work, hence the example above uses the full UPnP serviceId (which works in all versions of the MiOS Binding)

PS: If you tag a post mios, or tag me directly, it’ll help me find these MiOS-specific posts faster as I nearly missed this one. Great to see the volume of traffic this new forum is now getting daily!)

@guessed HMode 1 means Mode is set to Home. “2” for away, “3” for night and “4” for away.

How will I present this in openhab though, as a switch?

Thanks

It’ll be String in the Items file, but I the Sitemap file it’ll be something like:

Switch  item=MyHouseMode mappings=["1"="Home", "2"="Away", "3"="Night", "4"="Vacation"]

If you want those buttons to be live, then you’ll need to specify the command: option/MAP in the Item’s MiOS Binding declaration (and build the corresponding MAP file, of course)

ref: https://github.com/openhab/openhab/wiki/Explanation-of-Sitemaps#mappings

Assuming my findings above are correct, the configurations/transform/miosHouseMode.map file would need to look like:

_defaultCommand=urn:micasaverde-com:serviceId:HouseModes1/SetHMode(HMode=??)

Then the command: option on the Item binding declaration would look like:

{mios="unit:house,device:189/service/urn:micasaverde-com:serviceId:HouseModes1/HMode,command:MAP(miosHouseMode.map)"}

under openHAB 1.8, there’s an alias for urn:micasaverde-com:serviceId:HouseModes1, so that part just becomes HouseModes1

Let me know it it works. If it does, then it’s likely I’ll make better in: and out: maps as well, something that maps the MiOS Values (like 1) into more meaningful string state like HOME, as that’s easier to read when used in Rules etc.

Okey, Im not very good at this but I’ll try. Chances are that you are right but I dont do it right…

edit: Are you talking about the housemodeplugin or Veras internal Housemode (wich the plugin also uses)…I dont know for sure how to do this… So what I did so far:

*created a new file since miosHouseMode.map did not excist and pasted in: _defaultCommand=urn:micasaverde-com:serviceId:HouseModes1/SetHMode(HMode=??)

*Item file:? Made this up:HouseModesPluginHMode "String HouseModesPluginHMode "House Modes Plugin FIXME HMode [%s]" (gDashboard) {mios="unit:house,device:125/service/urn:micasaverde-com:serviceId:HouseModes1/HMode,command:MAP(miosHouseMode.map)"}
*sitemap: I dont know :s Kinda lost.

For you, assuming you’ve already built a working SiteMap file (eg. configurations/sitemaps/house.sitemap or whatever you’ve named it) then you’d add an entry like:

Switch  item=HouseModesPluginHMode mappings=["1"="Home", "2"="Away", "3"="Night", "4"="Vacation"]

The forum formatting on your Item looks a little off, it should be:

String HouseModesPluginHMode "House Modes Plugin FIXME HMode [%s]" (gDashboard) {mios="unit:house,device:125/service/urn:micasaverde-com:serviceId:HouseModes1/HMode,command:MAP(miosHouseMode.map)"}

… and that’s assuming that the Vera HouseModes Plugin is running as MiOS/Vera Device 125

If you have those in place, and it’s still not working, then enable https://github.com/openhab/openhab/wiki/MiOS-Binding#simple-trace-configuration and send me a PM with a copy of your logs/openhab.log file covering a startup sequence of openHAB.

1 Like

Hello guessed!

I had to take a longer break then I wished from this… I am back now! I tested what you said in the last post. It is very close to working. Openhab reads the house mode correctly when I switch mode from within Vera UI, But switching House mode from within Openhab does not register at the Vera.

If you set the TRACE loging (link above), and activate the control from the openHAB UI, then your openhab.log file will have a bunch of hints as to the issue.

Hey Sebastian,

If you’re still playing with this, or for anyone else looking as I was, try this small tweak to the map file you created.

Assuming the plugin hasn’t changed too much, the variable HMode should be newHModeValue. You can verify this in the file S_HouseModes.xml, or use the user_data request (or guessed’s script that generated items from Vera, if you still have it), and search for SetHMode.

For example, within the output of my user_data request, you can see the argument name:

<action device="46" service="urn:micasaverde-com:serviceId:HouseModes1" action="SetHMode">
  <arguments>
    <argument name="newHModeValue" value="3"/>
  </arguments>
</action>

Making my map look like this:

_defaultCommand=urn:micasaverde-com:serviceId:HouseModes1/SetHMode(newHModeValue=??)

I’m assuming yours will be the same, but at least you can find the name if it’s not.

Thanks for all the legwork though (both yourself and guessed and others)! I’m just starting with openHAB myself and this definitely helps.

I am a bit busy again for the moment to play with it D: But good work finding it!

I dont understand how your mapfile look though… is it just the line you typed?

Exactly, just the single line, or at least for now it is. I even ‘borrowed’ your naming and called it miosHouseMode.map.

So, just putting everything together for future users (heavily borrowed from above), here’s what I have and seems to be working well. Replace dev ids, groups, icons, labels as needed. FYI, I’m also using 1.8 with the alias (see guessed’s post above), so if on 1.7, you’ll need the full syntax.

Map (miosHouseMode.map):

_defaultCommand=urn:micasaverde-com:serviceId:HouseModes1/SetHMode(newHModeValue=??)

Item:

String HouseModesPluginHMode “House Modes Plugin House Mode [%s]” (GHome) {mios=“unit:house,device:46/service/HouseModes1/HMode,command:MAP(miosHouseMode.map)”}

Sitemap entry:

  Switch icon="firstfloor" label="House Mode" item=HouseModesPluginHMode mappings=["1"="Home", "2"="Away", "3"="Night", "4"="Vac"]
1 Like