I incorporated some EnOcean window handles via Homegear/HomeMatic binding into openHAB 2. Up to a certain point, this worked flawlessly, as you can read here. However, I am struggling a bit with the items definition. The issue is that the raw states for the window handles, which are coming from Homegear, are a bit confusing. A window handle can have three different states:
- closed
- open
- ajar (tilted)
The raw states that I see in my OH2 log file are the following ones:
- Undefined (which equals âclosedâ in reality)
- Closed (which equals âopenâ in reality)
- Open (which equals âajarâ in reality)
If I turn my window handle all the way from closed to open to ajar (tilted) and back, my log file produces the following lines:
2017-09-21 22:54:37.269 [ItemStateChangedEvent ] - ug_buero_sFenster changed from Undefined to Closed
2017-09-21 22:54:39.519 [ItemStateChangedEvent ] - ug_buero_sFenster changed from Closed to Open
2017-09-21 22:54:41.603 [ItemStateChangedEvent ] - ug_buero_sFenster changed from Open to Closed
2017-09-21 22:54:43.021 [ItemStateChangedEvent ] - ug_buero_sFenster changed from Closed to Undefined
Now, I am wondering if it is possible to transform these incorrect raw states into the correct ones? And I am not talking about a simple label transformation as described in the docs.
Itâs simply a bit weird and annoying when you have to work with incorrect raw states and your rules look like this:
rule "Test"
when
Item ug_buero_sFenster changed from Undefined to Closed
then
...
end
Which in reality means:
rule "Test"
when
Item ug_buero_sFenster changed from Closed to Open
then
...
end
Whatâs more? The incorrect raw states are causing problems with dynamic icons on my sitemap. I already performed a label state transformation. However, in my case that didnât help to solve the icon issue. Also, as can be read in the docs, a dynamic icon depends on an itemâs state rather on an itemâs label. At least thatâs my take, even though it seems as if opinions are split on that issue as you can read in many posts regarding the âdynamic icon issuesâ in this forum.
My current item definition:
Item file
String ug_buero_sFenster âBĂŒro [MAP(EnOceanWindowHandle_label.map):%s]â (gUG_fenster) {channel=âhomematic:HG-F6-10-00:6e230a45:EOD01A93E7E:1#STATEâ}
I am looking for a syntax (if possible at all) to change the raw state within the item definition. When using MQTT, this is possible. You can even use a transformation file. A comparable item definition might look as follows:
Item file
String ug_buero_sFenster âBĂŒro [MAP(EnOceanWindowHandle_label.map):%s]â (gUG_fenster) {mqtt=â<[mosquitto:ug/buero/sensor/fenster:state:MAP(EnOceanWindowHandle_configBinding.map)]â}EnOceanWindowHandle_configBinding.map
Undefined=closed
Closed=open
Open=ajar
Does anybody has an idea to solve that issue?