HTTP Binding Frontdoor with icon="frontdoor"

Hi! I want to get a switch with an icon frontdoor which shows open or closed door and raises the switch in the correct position.

all works, but the frontdoor icon does not switch.
I use icon=“frontdoor” at my sitemap.
and a switch next to the icon. With getting an http “on” or “off” the switch shows correct state.

i already have to use the following binding because of getting an “on” for closed door and an “off” for opened door from the binding:

items:

String FrontDoorOutValue { http="<[beckhoff:2000:JSONPATH($.FrontDoor)]" }
Switch FrontDoorOut { http=">[ON:POST:https://raspberrypi/postdata.php?frontdoor=true] >[OFF:POST:https://raspberrypi/postdata.php?frontdoor=false]" }

sitemap:

   Switch item=FrontDoorOut label="FrontDoor: " icon="frontdoor"

rules:

rule "frontdoor1"
when
        Item FrontDoorOutValue received update
then
        FrontDoorOut.postUpdate(if(FrontDoorOutValue.state == "on") ON else OFF)
end

it would be nice to use OPEN LOCK Switches instead of my normal Switches.

frontdoor is designed to work with Contact, not Switch. To use the frontdoor icons, you will need to create a copy of them and rename them to:

frontdoorsw.png
frontdoorsw-on.png
frontdoorsw-off.png

Where the one without the - is the default icon that gets shown when the Switch is not ON or OFF (i.e. NULL). You must have all three.

To not have the toggle icon, use Text to put it on your sitemap instead of Switch.

Text item=FrontDoorOut label="FrontDoor: " icon="frontdoor"

But since you already have to populate the door using a Rule, why not create a Proxy Item to represent the door and a slightly more complicated rule to populate the Item.

Contact FrontDoorOutProxy
rule "frontdoor 1"
when
    Item FrontDoorOutValue received update or
    Item FrontDoorOut received update
then

    var newState = CLOSED

    if(FrontDoorOutValue.state == "on") newState = OPEN
    if(FrontDoorOut.state == ON) newState = OPEN

    if(newState != FrontDoorOutProxy.state) FrontDoorOutProxy.postUpdate(newState)
end

It must not be a switch. How can I use a contact?

Lock or unlock next to the door would be nice too. Or open close. Are these all contact items?
I can get an open or lock status too if it would prevent a rule…

You might benefit from a review (or reread) of the Beginner’s Tutorial and the Items pages of the User’s Guide.

A Contact is another type of Item, like Switch and Dimmer and such.

There is no LOCK/UNLOCK state but you can use a map and custom icons to change ON to UNLOCK and OFF to UNLOCKED. Again, see the Item’s documentation.

None of these are contact Items. A Contact is a type of Item like a State. Unlike a State, a Contact has OPEN/CLOSED as its states instead of ON/OFF.

As long as you have two sources that are providing the state of your one Door Item and they are doing so in two different ways you will have to have a Rule.

what is the easiest solution for an frontdoor open symbol and frontdoor close symbol ? I just added a toggle for changing status…

Is the proxy only for the icon the best?
If i understand you correct, I do need all three pictures for door state?

If you are not using a Contact then make a copy of the icons you want and set the part after the - to match the state of what ever Item you chose.

See http://docs.openhab.org/configuration/items.html#icons-dynamic

It isn’t only for the Icon. The proxy is to be able to combine the state from two separate Items that are incompatible with each other into a single Item. That is what you original code was doing.

Yes.