I use a openhab2 on a Raspberry PI3, runs great.
I opened a Amazon Dash Button and soldered a reed contact over the switch of the dash button.
When a magnet pass the reed contact the dash button gets triggered and can work as “switch”
That works already, but i like to use it as a Window contact ( OPEN / CLOSE ) every time the magnet pass the reed contact the status toggles.
My question is: How can i translate a switch to a (open / close) contact?
Anybody have an example.
rule "Switch to Contact"
when
Dash_Switch changed
then
if (Dash_Switch.state == ON) {
Dash_Contact.postUpdate(OPEN)
} else {
Dash_Contact.postUpdate(CLOSED)
}
end