Switch or Button for Light and get the status from an other item

Tags: #<Tag:0x00007faf94663988>

Hi!

I am working on my HabPanel for a Touchscreen (old Tablet).

I can turn on my Lights with a Button. One Push and it is turns on and when i push again it will turn off. But Openhab gets the status of the light via an other item.

Ist there a widget available which can send a command for one item and switch its color or status with the status of an other item?

Thank you in advance and greetings!
Alex

Doesn’t anyone have an idea on the subject?

Can you post your configurations? Especially your Items and Things (if any). It’s a little difficult to try and guess what’s going on!

Of course… i am steering the lights via modbus binding on my Wago SPS.

There i have one item for turning on and off, and one which is indicating the status of the lamp.

Switch VZ_Licht     "Vorzimmer Licht"   [ "Lightning" ] { channel="modbus:data:Wago:coils:Bit37:switch", autoupdate="false" }
Switch VorzimmerLicht_Status_modb   { channel="modbus:data:Wago:coilsread:VorzimmerLicht_Status_modb_read:switch" }

A Rule for the Switch VZ_Licht is resetting the Switch to “off” after i pressed it.

rule "Licht reset commando"
when
    Item VZ_Licht received command ON or
    Item Ess_licht received command ON or
    Item Kueche_Licht received command ON or
    Item Treppe_Licht received command ON or
    Item Gang_Licht received command ON or
    Item Garage received command ON or
    Item Einfahrt received command ON
then
logInfo("STARTING TIMER :", triggeringItem.name.toString)
    createTimer(now.plusMillis(250), [ |
        logInfo("TIMER EXECUTE", triggeringItem.name.toString)
        triggeringItem.sendCommand(OFF)
    ])
end

in sitemaps i have this:

Switch item=VZ_Licht          label="Vorzimmer" icon="sunrise"    mappings=[ON="Aus"] visibility=[VorzimmerLicht_Status_modb=="ON"]
Switch item=VZ_Licht          label="Vorzimmer" icon="light-off"  mappings=[ON="Ein"] visibility=[VorzimmerLicht_Status_modb=="OFF"]

is there really no one whith a setup like me and have a solution for habpanel?

I have to ask one more time… does nobody have the same challenge like me? or someone an idea how to solve this?

You can simply make a rule that is reacting to the status-item and update your switch-item.

rule "update status"
when
    Item VorzimmerLicht_Status_modb changed
then
    VZ_Licht.postUpdate(VorzimmerLicht_Status_modb.state)
end
1 Like