Combine sensor and actor to switch items without rules

Hey friendos!

I have a rather big setup but will keep it to the important things for now. Let’s say I have:

  • 1 Wireless switch
  • 1 Wireless power outlet with a lamp

What I did in openhab2 was to create a rule to switch the outlet to the state of the switch, as soon as a command was received. Easy.

But let’s take a second to think about this: Why not simply link together those 2 things into a single item? So I removed the Item for my wireless switch and added the channel config to my wireless outlet item:

Switch work_lights  "Rusty o'lamp"  { channel="rfxcom:lighting4:rfxtrx433e:00000_A:command, rfxcom:lighting2:rfxtrx433e:work:command" }


  • rfxcom:lighting4:rfxtrx433e:00000_A:command is my power outlet and
  • rfxcom:lighting2:rfxtrx433e:work:command is my homeeasy switch

Unfortunately it did not work, though. Now my question for you guys is:

  • Is this possible?
  • Is this following the “everything should be a seperate thing” guidelines
  • Or is this even discouraged, as it might get unclear in bigger setups, because there won’t be any rule for these?

Thanks for your thoughts!

I hope I did understand correctly!
You have a wireless switch and a wireless power outlet. In other words you have a transmitter (switch) and reciever (outlet) which you would like to work directly with each other. If both would be belonging to each other ( are a bundle) that would be the normal and only way of operation.
Using a home automation system you WANT TO be able to share the functionalities of both equipments with other equipments. Your transmitter might be used to send commands to other plugs, the plug might get commands from somewhere else. That gets possible by the home automation . To have that both equipments need to be separated by the system.

I also use multiple rules to control that outlet. This would just take the clutter of an absolute-basic rule away. But yes, I am mostly here for opinions, thank you for yours :slight_smile:

1 Like

Why don’t you use a group instead?

Switch WirelessSwitch "WirelessSwitch" (group1) { channel="abc" }
Switch WirelessOutlet "WirelessOutlet" (group1) { channel="def" }
Group group1

and use it in your sitemap

sitemap sitemap1 label="Sitempap"
    Switch    item=group1 label="Wireless"

Another great idea. Thanks! Will try that and compare the readability with
the rule approach.

Christian Hailer schrieb am Mo., 9. Jan. 2017,

openHAB 1.x bindings have access to a very nice feature where one binding can listen for state updates to one of its bound items (using internalReceiveUpdate) and pass the update down to the integrated system. The same item would be bound to another binding as well as a source of these state updates. So, for example, creating an MQTT gateway for the ambient temperature reported by an Ecobee thermostat is as simple as:

Number Temp "Temp [%.1f °F]" { ecobee="<[1234#runtime.actualTemperature]", mqtt=">[broker:/home/temp:state:default]" }

Is there an equivalent capability for openHAB 2 bindings?

1 Like