Hi, I have been working on some configuration involveing KNX.
I have an entity on the bus, that can be disabled, by a switch:
it is on, when the “switch” is off,
it is off, when the “switch” if on.
I tried to pass that to an item in OpenHAB such that switch is on, the device is off.
I have either a rule-base route, which would involve having two items in OpenHAB, one for the internal switch, and one for the inverted item on the bus.
Alternatively, I tried to use a MAP (and TRANSFORM:js) to invert the state of the item.
Here I noticed, that this is not bi-directional.
The state coming from the device is properly inverted, but any state coming from the item is not.
Is this the desired behavior, or is there something wrong with my config, or with OpenHAB?
I would apprechate any insights from the community.
For the time being, I can work arond with having multiple items, but that seems rather clumsy.
If that’s the simplest way to preserve sanity, go for it. Items do not cost anything.
State coming from where, to where?
Are you meaning commands to the Item, that get passed by the binding to the mystery device? Some bindings allow you to manipulate these in your config.
Yes, the command to the Item is passed as-is to the binding, for forwarding the device.
And that’s what you want, isn’t it - to set your device ‘inactive’ you have to send a command ON via KNX?
Some bindings provide a means to massage commands before processing - KNX does not.
It’s going to be easiest to have an Item representing the real KNX state, and a ‘virtual’ Item representing your logic condition (perhaps with autoupdate disabled)
A rule can listen for commands to your logical Item, and re-issue the inverted version to the KNX Item (with any conditions, if you wish).
You could update your logical Item state from a rule too (if you linked it to the KNX channel with the inverting map for updates, you’d get the unwanted side effect of passing ‘wrong’ commands as well)…
The standard transformation profile is, as you observe, one-way only affecting state updates. I thought someone had made an add-on switch invert profile that worked on commands too, but cannot find it now.