Test item with Switch item


Is it possible to combine a switch with another text item.

I have a zwave aeon smart energy switch. I want to display the Watts next to the switch icon.

I tried two zwave = and also combined them with additional parameter, nothing works. Can you have multiple bindings in an item or multiple values returned to display?

Ideally. I want 0.0W 0.0kwh (switch)

All on one line

My current items are

Switch switch_living "Switch" <light> {zwave="2:1:command=SWITCH_BINARY"}
Number  energy_living        "Living Lights [%.2f W]"   <energy>       {zwave="2:1:command=METER,meter_scale=E_W,refresh_interval=60" }
Number  kwh_living      "Switch [%.2f KWh]"     <energy>        {zwave="2:1:command=meter,meter_scale=E_KWh,refresh_interval=60"}

Sadly the answer is no. You can combine Text items using a rule but you can’t combine Text item and a Switch. You will have to put the Text item on a separate line.

You can have multiple bindings defined for a single Item, but they all have to work for the same type. For example, you can have two bindings configured for a Switch, but both configurations have to provide an ON or OFF as their values. You cannot have one that works like a Switch and another that works like a Text.

Thanks, so I can at least combine the two text items as one item?

How would I have both scales included?

You will need to create a rule and update the value of one of the Items (or a third item) with the new merged text. For example:


String Item1
String Item2
String ItemMerged


rule "Merge items"
    Item Item1 updated or
    Item Item2 updated
    ItemMerged.postUpdate(Item1.state.toString + " " + Item2.state.toString)


Text item=ItemMerged

Almost got it, but I get a - Here is what I have

rule "Merge items"
    Item watt_living updated or
    Item kwh_living  updated
    energy_switch.postUpdate(watt_living.state.toString + "W " + kwh_living.state.toString + " kWh")


Number  watt_living        "Living Lights [%.2f W]"   <energy>       {zwave="2:command=METER,meter_scale=E_W,refresh_interval=60"}
Number  kwh_living      "Switch [%.2f KWh]"     <energy>        {zwave="2:command=meter,meter_scale=E_KWh,refresh_interval=60"}
String  energy_switch   "Energy [%s]"   <energy>


Text item=energy_switch

The rule looks right. “-” means the item is uninitialized. The energy_switch will not be populated until either watt_living or kwh_living are updated. Did you wait long enough for one of those Items to be updated?

That is what I thought. But there has been plenty of updates. Hmm…

Also how to do you combine switches? Two switches one line? Would that be in site maps or the item itself?

Put a log statement in the rule and see if it is triggering or not. If not you know the problem is with the Trigger. If it rule triggers but the item doesn’t update you know it is with the body of the rule.

Combining Switches may be a little bit of a misnomer. What you are really doing is binding one switch to two different bindings. Not all bindings support this and the behavior is not always as expected. To do it you just list both bindings inside the “{ }”. For example:

Switch MySwitch { mqtt="blah blah bla", zwave="blah blah" }

Theoretically when one of the bindings is updated it causes a command to be sent to the other items to keep them in sync. In practice I’ve only ever seen people have trouble with them. I recommend using a Proxy switch that gets updated by a similar rule to above.

What if I want both switches to be independent? What I have is a lamp with two bulbs, upper and lower. Sometimes you want both but others not. Its via a Hue bridge to Cree bulbs.

I will try the logging.

Add them to a Group. When you want to switch both use the Group. When you want to switch on and not the other use the individual Switch.


Group:Switch:OR(ON, OFF) Lamp "label" <icon> (otherGroups)
Switch UpperLight "label" <icon> (Lamp) { binding stuff }
Switch LowerLight "label" <icon> (Lamp) { binding stuff }


Group item="Lamp"

When you click on the switch for Lamp both bulbs will turn on or off. If you click on the label for Lamp it will open a new frame listing both bulbs which you can control individually. The status of the Group will be ON is one or more of the Switches in the group are ON.

1 Like


So just as I thought, the rule never gets run.

Got it!

Should be received update instead of updated… oops.

Thanks for all the help!

I’m a strong advocate for using Designer as it catches this sort of error before you ever run.

Glad it works now.

Can I run designer on Windows and will it publish to another box?

Also I was using Habmin but there is a bug in editing sitemaps with charts and it leaves out a space. I need to report that.

You can copy the configs to the other box or share the config folder on your openHAB server on the network so your Windows machine can see it. A very common approach is to run openHAB on a Raspberry Pi, share the configurations folder using Samba, and and edit the files on Windows.

1 Like

Thanks I will do that or use WinSCP to just copy over.

The file shows inherit permissions right? Does the openhab account have a password? I know I can switch to that account with sudo after you login.

I don’t think the openhab user can log in. I think winscp will use the
default file mask of what ever use you do log in as, but you might be able
to change the permissions through winscp.