Dear comunity,
the mcp23017-binding is driving me crazy. I use the current openhabian 2.5.2 stable and installed - after the current binding which can be installed via Paper UI does not work - the binding 2.4.0-SNAPSHOT. So far so good.
Now I configured the following thing (I conected a hardsware switch to B0):
Thing mcp23017:mcp23017:chipA "MCP23017 chip A" [address=20,bus=1] {
Type output_pin : output#A0
Type input_pin : input#B0
}
No Error-log after doing this. Then I added the following item:
Switch
living_room_led_switch
"Living room LED switch"
{channel="mcp23017:mcp23017:chipA:output#A0"}
Contact
living_room_led_contact
"Living room LED contact"
{channel="mcp23017:mcp23017:chipA:input#B0"}
After this an endless loop starts which change the status of the contact from OPEN to CLOSED and the other way around all the time. Now I started to add the rule, which is discribed on the official page but this rule just leads to syntax errors and I wrote the follwing rule:
rule "living_room_led contact"
when
Item living_room_led_contact changed to OPEN
then
if (living_room_led_switch.state == OFF) {
living_room_led_switch.sendCommand(ON)
}
else {
living_room_led_switch.sendCommand(OFF)
}
end
This rule does not lead to an error, but does not stop the endless loop described above. Just the text changes a little bit due to the rule:
2020-03-12 19:41:31.445 [vent.ItemStateChangedEvent] - living_room_led_contact changed from CLOSED to OPEN
2020-03-12 19:41:31.448 [ome.event.ItemCommandEvent] - Item 'living_room_led_switch' received command OFF
2020-03-12 19:41:31.463 [nt.ItemStatePredictedEvent] - living_room_led_switch predicted to become OFF
2020-03-12 19:41:31.472 [vent.ItemStateChangedEvent] - living_room_led_switch changed from ON to OFF
2020-03-12 19:41:31.496 [vent.ItemStateChangedEvent] - living_room_led_contact changed from OPEN to CLOSED
I also implemented the follwoing sitemap:
sitemap Test label="Test" {
Frame label="Test" {
// Overrides only the text, but will keep the state format from the Item definition
Switch item=living_room_led_switch label="Licht" icon="light"
}
}
The switch shown on the sitemap daces like no one is watching it The funny thing is, if I press the hardware button the loop stops as long as the button is pressed.
My questions are:
- How can I stop the endless loop? (At the End I just want, that a short press on the hardware button (which switch a relay) is shown on a sitemap (as a switch))
- How can I use the output via sitemap to trigger the relay? (I was able to do it in a simple testsetup via python => just to check if the hardware works)
Thank you so much for your help! I promise, after eveything is solved I will write a tutorial with everything in one place.
Best regards
BrainPain