[SOLVED] Things discovered, *.items & Rules


I am trying to setup Openhab2 for my home-automation use-cases ( I understand that it’s work in progress, but I don’t mind tinkering)
The desired use-case: When I come home, I would like to start the playback of a certain URI on a Sonos Speaker (or other Speaker)

I started off from demo.items & rules and for now I have:

  • a “When I come home” switch defined *.items file.
  • A rule based on that switch that:
    ---- Modifies a couple of lights defined in *.items files - > that works !
    ---- Should send a command to the Sonos speaker

That should be the theory but the confusing part is

  • The switch is defined in *.items ( the more static part )
  • Whereas the Sonos is Dynamically added ( with specific name, …)

So how to send a command from a rule to a dynamically added thing ?
Do I need to define something in *.items before being able to access it via the rules ?

Any links or help helping me forward would be helpful
Any questions, just let me know.


OK, I managed to find what i needed.

  • Basically without doing any additions in *.things or *.items.

  • The dynamically discovered things/channels can be controlled from the *.rules file directly.

  • Here below is an “then”-code example for a Sonos.

    sendCommand(sonos_zoneplayer_RINCON_xxx_volume, 12);
    sendCommand(sonos_zoneplayer_RINCON_xxx_control, PLAY)

(replace xxx with correct uid )