Problem with Switch/Contact in sitemap

In Item file I have two items:

Contact  WtrRainSensor "Czujnik deszczu "   (RainSensor)    { mcp23017="{ address:21, pin:'B7', mode:'DIGITAL_INPUT'}" }

Contact  WtrStartBtn   "Manual start"   <water>   (WtrStartBtn)   { mcp23017="{ address:21, pin:'B5', mode:'DIGITAL_INPUT'}" } 

In the first item is a status of my rain sensor, the second item is a button that starts this watering.
Now I would like to show and control these two items from sitemap and there are few problems:

  • WtrStartBtn is a monostable button but I do not see such button in sitemap elements, definition of
    Switch item=WtrStartBtn show bistable switch and additionaly I’ve got such error in log:

2017-10-07 10:46:01.236 [WARN ] [thome.io.rest.core.item.ItemResource] - Received HTTP POST request at 'items/WtrStartBtn' with an invalid status value 'ON'.

  • I cannot show a value of WtrRainSensor. It should have OPEN/CLOSE values. To show these values I use:
    Text item=WtrRainSensor
    Item appears on screen but the value is empty.

Any suggestion what is wrong?

Michal Szymanski

You cannot send a command to a contact type, use switch instead.

Try "Czujnik deszczu [%s]"

You cannot send a command to a contact type, use switch instead.

Dou you mean changing this

Contact WtrStartBtn "Manual start"....

to

Switch WtrStartBtn....?

But I could not do this because I have real button = it is Contact, or maybe you suggest making extra ‘artificial’ switch to do that?

Michal

A real button is a switch, not a contact.
It may have some mechanical contacts inside to perform its task, but from logical side it needs to be a switch …

To be more precise I’m using MCP23017 binding and for input I should use Contact and for relay Switch:

At the end of page there is example :

but the same situation is for GPIO
"Type Contact is used for input pins, Switch - for output pins." http://docs.openhab.org/addons/bindings/gpio1/readme.html

or maybe I do not uderstand how it works in OpenHab.

Michal

I guess it is just a misinterpretation because our both native language is not English :grinning:

I don’t use that binding, so am not much of a help here, but:

is correct, so I still don’t understand why because of

you don’t use a switch type item.