OH3: Windows State String Correct?

I have a number of rooms where there is only one thermostat to control and one or more window/door contacts. These set up fine in OH3. When a window is open the state is “open”. All is good.

In another room I have two thermostats and three window contacts. I have set them up as a group in Homematic IP (CCU). I have added the group to OH3 via the semantic model. When I open one of the windows, the state string shows as “window status: open” and not “open” as expected. If the window is closed, it shows “window status: locked” and not “closed”.

If I add a state description metadata and enter anything in the Options field, the state displays “CLOSED” or resp. “OPEN”. But I want to be the same as the other window contact states so that when a window is open the badges show on the associated page.

Has anyone got any ideas what I’m doing wrong. I looked into the map files and adding key values, but that doesn’t seem to help. Or do I need to set this up differently in Homematic?

Thanks for any help.

BTW: Great work to all who worked so hard on OH3.

Have a look at your Item using API Explorer. Look for options that the binding sets for you.

Thanks for your help rossko.

I’m not that fit with all this. But this is what I’m getting from the Rest API if I GET my item:

{
  "link": "http://openhab:xxxx/rest/items/EsszimmerThermostate_3_STATE",
  "state": "CLOSED",
  "stateDescription": {
    "pattern": "%s",
    "readOnly": true,
    "options": [
      {
        "value": "CLOSED",
        "label": "Window status: locked"
      },
      {
        "value": "TILTED",
        "label": "Window status: tilted"
      },
      {
        "value": "OPEN",
        "label": "Window status: open"
      }
    ]
  },
  "commandDescription": {
    "commandOptions": [
      {
        "command": "CLOSED",
        "label": "Window status: locked"
      },
      {
        "command": "TILTED",
        "label": "Window status: tilted"
      },
      {
        "command": "OPEN",
        "label": "Window status: open"
      }
    ]
  },

But I’m not too sure what I can now do. It confirms what I am seeing, but how can I change “CLOSED” to “closed” so the badge shows correctly.

Thanks,

Rob

Have you searched the documentation? This forum is not a substitute for that. I can think of a couple of possibilities but if it is important to you, please show some effort.

How to ask a good question / Help Us Help You - Tutorials & Examples - openHAB Community

Hi Bruce_Osborne,

I wrote that I had tried using a map file to transform the state string, but the explanations in the documentation are sometimes not that helpful or bewildering for a hobby programmer. I always use the documentation and only resort to asking the community when I have I spent considerable effort trying to resolve my problem. I have come quite a far way on my own so far.

What’s the point of a community if I can’t ask a question. I often only need a pointer in the right direction.

Thanks

Rob

1 Like

If you had provided an example of what you tried & how it failed we could help troubleshoot it.

That is mentioned as #13 in the link I posted.

I eventually found somewhere where I can now link my map file to the channel link. I found this solution by reading various threads in the openhab community: Help MAP transformation with HTTP Binding OH3 - Add-ons / Bindings - openHAB Community. This shows a screenshot which showed me how to refer to a map file. I then added the state.map file to the item as shown below:

My state.map file contains the following key pairs:

CLOSED=closed
OPEN=open

The state string now displays correctly. But the badge still does not show up when the displayed string changes to “open”.

I could not find this in the openhab documentation. Well at least not in a form that I understood.

Thanks

Rob

1 Like

You have the wrong item defined, it needs to be a contact item to show the badge.

1 Like

I don’t know that the three-state channel provided by Homematic is going to fit into a two-state Contact type Item though.

What you’d like is way of assigning whatever badge it is you want to look at, like you can with icons.

1 Like

Hi everyone, I tried a lot of different things, but they didn’t work. I then removed the State channel from the thermostat and added the window contact as a separate item to the room. And hey it works. Sometimes the solution is a lot easier than one thinks. And went down the wrong track because I though i had to keep everything together as it was a group in Homematic.

image

Thanks for your help guys. It’s much appreciated.

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.