Guys,
I need configuration help before my head explodes.
I would like to display status of windows and doors in the OH2 system - open/closed plus an icon for totally 8 of windows - nothing more.
For this purpose, at the flat construction stage installed each window/door reed contacts and their wires led to one place from which I would like to read and forward state of them to OH2.
From what I see (at least searching tool said that), none of you have played on reed contacts that way and only use wireless sensors.
Digging in the subject found that âD1 miniâ has 11GPIO`s so even more than needed.
Bought one, flashed with Tasmota and setup for 8 switches like below:
D3 GPIO0 Switch3 (11)
TX GPIO1 SI7021(3)
D4 GPIO2 Switch4 (12)
D2 GPIO4 Switch2 (10)
D1 GPIO5 Switch1 (9)
D6 GPIO12 Switch6 (14)
D7 GPIO13 Switch7 (15)
D5 GPIO14 Switch5 (13)
D8 GPIO15 Switch8 (16)
which after sending by MQTT gives me the expected result:
{âTimeâ:â2019-06-02T10:11:09â,âSwitch1â:âONâ,âSwitch2â:âONâ,âSwitch3â:âONâ,âSwitch4â:âONâ,âSwitch5â:âONâ,âSwitch6â:âONâ,âSwitch7â:âONâ,âSwitch8â:âOFFâ,âSI7021â:{âTemperatureâ:null,âHumidityâ:null},âTempUnitâ:âCâ}
After using transformation JSONPATH:$.Switch1 have theoretically read of ON/OFF Switch1 value but can not translate this result into the correct display in BASIC UI.
items code:
Contact Status_Door5 âStatus Door 5â {channel=âmqtt:topic:5d6b44af:d1_ok5â}
sitemap code:
Text item=Status_Door5 label="[MAP(en.map):%s]" icon=âdoorâ
Hi guys,
Little update after while. Battle almost finished so please support if possible:
Json transformation not changed since last post.
within Paper UI > things > Generic MQTT thing > changed Channel type from âOpen/Close contactâ to âText Valueâ
items now:
String Status_Door1 âStatus Door 1â {channel=âmqtt:topic:6ee09f16:d1_d11â}
So at the moment, I do have doors status (text âONâ or âOFFâ) visible on Basic UI
BUT
1)once D1mini transmission stopped status still shows last position of reed contacts. How to refresh that?
2)icon - isit possible to display different icon for open and closed ?
3)might be something wrong with settings as it shows in log below, not sure what
==> /var/log/openhab2/openhab.log <==
2019-06-11 16:37:58.891 [WARN ] [eneric.internal.generic.ChannelState] - Command âOFFâ not supported by type âOpenCloseValueâ: No enum constant org.eclipse.smarthome.core.library.types.OpenClosedType.OFF
Iâm interpreting that as meaning âI want a dead box to send me a message that it is deadâ
Obviously that canât happen, but if you expect regular updates from a device you can detect when they stop. Look into expire binding, written for the purpose.
openHAB allows an Item state of UNDEF which is ideal to indicate âdonât know state because communication was lostâ.
Yes, dynamic icons itâs called in the docs.
Somewhere, you have a rule or UI click or binding channel that is sending command OFF to a Contact type Item, which isnât allowed.
A Contact type Item will only accept updates to OPEN CLOSED or UNDEF. It will not accept any commands.
You seem to have incoming data from GPIO in the form ON or OFF, so that wonât fit.
Putting a MAP in the label of an Item only transforms between the Item state and your display UI. It doesnât change the Item state.
A more useful place to do the transform in this case is in the channel, so that incoming OFF gets pushed to the Item as CLOSED for example. Thatâd be transformationPattern in your Thing ⊠but youâre already using that for JSONPATH so you are goosed I think.
You could change your channel types in the generic mqtt thing to contact channels which have the option for custom on/open off/closed values which can be used together with the jsonpath transformation. Than you could link them to items of type contact. If you use those with text items it will show the right state as the item.
Johannes
Hi Stonke,
any updates with this issue please⊠ran into same trouble, sonoff flashed with tasmota and gpio14 set for reed switch door sensor, change switchtopic2 to frontdoor⊠and item in openhab is Contact type, but MQTT payload for door is ON and OFF⊠how to change to OPEN and CLOSE
many thanks