# \[SOLVED\] Homematic: HM-MOD-EM-8 state "open" "closed" is reversed

**URL:** <https://community.openhab.org/t/solved-homematic-hm-mod-em-8-state-open-closed-is-reversed/49543>\
**Category:** Bindings\
**Created:** [August 17, 2018, 9:40am UTC](https://community.openhab.org/t/solved-homematic-hm-mod-em-8-state-open-closed-is-reversed/49543 "2018-08-17T09:40:01Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![hobbes76](https://community.openhab.org/letter_avatar_proxy/v4/letter/h/96bed5/32.png) [@hobbes76](https://community.openhab.org/u/hobbes76)\
**Post date:** [August 17, 2018, 9:40am UTC](https://community.openhab.org/t/solved-homematic-hm-mod-em-8-state-open-closed-is-reversed/49543/1 "2018-08-17T09:40:01Z")

</div>

Good morning everyone,

i have an issue with my HM-MOD-EM-8 - 8 - channel sender.  
It is configured in “window contacts” mode and is working well - except that the status values are reversed. When i look at the values in Homematic they are correct - but in openhab classic UI (and in the logfiles as well) they are reversed.

Any clue how to solve this problem?

PS: I know that i can configure the values for open and close in Homemmatic device config. But as said the device is working well in homematic and other apps that are using the homematic RPC - like tinymatic.

thanks  
Ralf

---

<div class="post-metadata">

**Author:** ![rossko57](https://community.openhab.org/user_avatar/community.openhab.org/rossko57/32/70263_2.png) [@rossko57](https://community.openhab.org/u/rossko57)\
**Post date:** [August 17, 2018, 11:25am UTC](https://community.openhab.org/t/solved-homematic-hm-mod-em-8-state-open-closed-is-reversed/49543/2 "2018-08-17T11:25:58Z")

</div>

This (inverting Contact status) can be done with a Transformation on each Item - IF your binding supports transforms.

> [@Transformation MODBUS binding](https://community.openhab.org/t/transformation-modbus-binding/34058/5):
>
> Javascript based transform for exactly this purpose described here, just a different means to same end.

---

<div class="post-metadata">

**Author:** ![hobbes76](https://community.openhab.org/letter_avatar_proxy/v4/letter/h/96bed5/32.png) [@hobbes76](https://community.openhab.org/u/hobbes76)\
**Post date:** [August 17, 2018, 1:26pm UTC](https://community.openhab.org/t/solved-homematic-hm-mod-em-8-state-open-closed-is-reversed/49543/3 "2018-08-17T13:26:52Z")

</div>

Many thanks for your swift reply.

it seems that homematic binding only supports the following transformaton syntax

```auto
Contact KontaktFensterKuechesuedenLinks "Fenster Küche Süden Links [MAP(swap.map):%s]" (gFensterkontakte) {channel="homematic:HM-MOD-EM-8:NEQ1XXXXX:OEQXXXXXXX:1#STATE"}

```

![HM-ReverseStatus](https://community-openhab-org.s3.dualstack.eu-central-1.amazonaws.com/optimized/3X/d/6/d61178e2415ec69e1a066b4e72f20ab48a510b13_2_690x63.jpeg)

the transformation unfortunately only changes the display value ☹ Any idea how i can change / map the value permanently?

best  
Ralf

---

<div class="post-metadata">

**Author:** ![vzorglub](https://community.openhab.org/user_avatar/community.openhab.org/vzorglub/32/17166_2.png) [@vzorglub](https://community.openhab.org/u/vzorglub)\
**Post date:** [August 17, 2018, 2:46pm UTC](https://community.openhab.org/t/solved-homematic-hm-mod-em-8-state-open-closed-is-reversed/49543/4 "2018-08-17T14:46:59Z")

</div>

> [@hobbes76](#):
>
> Any idea how i can change / map the value permanently?

You need a proxy item and change the state accordigly:

```csv
Contact KontaktFensterKuechesuedenLinks_proxy

```

```php
rule "Invert contact"
when
    Item KontaktFensterKuechesuedenLinks changed
then
    if (triggeringItem.state == OPEN) KontaktFensterKuechesuedenLinks_Proxy.postUpdate(CLOSED)
    if (triggeringItem.state == CLOSED) KontaktFensterKuechesuedenLinks_Proxy.postUpdate(OPEN)
end

```

---

<div class="post-metadata">

**Author:** ![rossko57](https://community.openhab.org/user_avatar/community.openhab.org/rossko57/32/70263_2.png) [@rossko57](https://community.openhab.org/u/rossko57)\
**Post date:** [August 18, 2018, 12:42am UTC](https://community.openhab.org/t/solved-homematic-hm-mod-em-8-state-open-closed-is-reversed/49543/6 "2018-08-18T00:42:12Z")

</div>

Perhaps worth logging an enhancement request against Homematic binding for transformation support. It is a useful feature to match external exceptions to OpenHABs idealized workings.

> **[GitHub - openhab/openhab2-addons: This is an archive of the full history of the...](https://github.com/openhab/openhab2-addons)**
>
> This is an archive of the full history of the openhab2-addons repo.

---

<div class="post-metadata">

**Author:** ![hobbes76](https://community.openhab.org/letter_avatar_proxy/v4/letter/h/96bed5/32.png) [@hobbes76](https://community.openhab.org/u/hobbes76)\
**Post date:** [August 19, 2018, 8:28am UTC](https://community.openhab.org/t/solved-homematic-hm-mod-em-8-state-open-closed-is-reversed/49543/7 "2018-08-19T08:28:50Z")

</div>

Sounds good - thanks.

---

<div class="post-metadata">

**Author:** ![hobbes76](https://community.openhab.org/letter_avatar_proxy/v4/letter/h/96bed5/32.png) [@hobbes76](https://community.openhab.org/u/hobbes76)\
**Post date:** [August 19, 2018, 8:30am UTC](https://community.openhab.org/t/solved-homematic-hm-mod-em-8-state-open-closed-is-reversed/49543/8 "2018-08-19T08:30:44Z")

</div>

Hey Vincent,

thanks a lot for the workaround. works great and helps me also to solve another issue with homematic thing that sends the wrong status. (String instead of OPEN CLOSE)

best  
Ralf

---

<div class="post-metadata">

**Author:** ![vzorglub](https://community.openhab.org/user_avatar/community.openhab.org/vzorglub/32/17166_2.png) [@vzorglub](https://community.openhab.org/u/vzorglub)\
**Post date:** [August 19, 2018, 12:08pm UTC](https://community.openhab.org/t/solved-homematic-hm-mod-em-8-state-open-closed-is-reversed/49543/9 "2018-08-19T12:08:10Z")

</div>

Thanks, please tick the solution.
