Scenes not working

Hi, i am new to openhab.
i connect some dimmers via mqtt to openhab, it works fine.
now i want to make some scenes with rules, but the didnt response.

my item file:

Dimmer woonkamer_hanglamp "Hanglamp woonkamer" {mqtt=">[localbroker:home/0/woonkamer/lamp/hanglamp:command:*:default],<[localbroker:home/0/woonkamer/lamp/hanglamp/state:state:default"}
Dimmer woonkamer_spots "Spots woonkamer" {mqtt=">[localbroker:home/0/woonkamer/lamp/spots:command:*:default],<[localbroker:home/0/woonkamer/lamp/spots/state:state:default"}
Dimmer woonkamer_lamp_voor "Staande lamp woonkamer voor" {mqtt=">[localbroker:home/0/woonkamer/lamp/lampvoor:command:*:default],<[localbroker:home/0/woonkamer/lamp/lampvoor/state:state:default"}
Dimmer woonkamer_lamp_bank "Lamp bank woonkamer" {mqtt=">[localbroker:home/0/woonkamer/lamp/lampbank:command:*:default],<[localbroker:home/0/woonkamer/lamp/lampbank/state:state:default"}
Dimmer woonkamer_hanglamp_bureau "Hanglamp bureau woonkamer" {mqtt=">[localbroker:home/0/woonkamer/lamp/hanglampbureau:command:*:default],<[localbroker:home/0/woonkamer/lamp/hanglampbureau/state:state:default"}
Dimmer woonkamer_bureaulamp "Bureaulamp woonkamer" {mqtt=">[localbroker:home/0/woonkamer/lamp/bureaulamp:command:*:default],<[localbroker:home/0/woonkamer/lamp/bureaulamp/state:state:default"}
Dimmer keuken_tafel "keukenlamp" {mqtt=">[localbroker:home/0/keuken/lamp/keukenlamp:command:*:default],<[localbroker:home/0/keuken/lamp/keukenlamp/state:state:default"}
Dimmer keuken_aanrecht "lamp aanrecht" {mqtt=">[localbroker:home/0/keuken/lamp/aanrecht:command:*:default],<[localbroker:home/0/keuken/lamp/aanrecht/state:state:default"}
Number myScenes "Scene Number is [%s]"

my sitemap

sitemap default label="Begane grond"
    Switch item=myScenes mappings=[0="0",1="1",2="2",3="3"]
    Slider item=woonkamer_hanglamp label="Woonkamer hanglamp"
    Slider item=woonkamer_spots label="Spots woonkamer"
    Slider item=woonkamer_lamp_voor label="Staande lamp woonkamer voor"
    Slider item=woonkamer_lamp_bank label="Lamp bank woonkamer"
    Slider item=woonkamer_hanglamp_bureau label="Hanglamp bureau woonkamer"
    Slider item=woonkamer_bureaulamp label="Bureaulamp woonkamer"
    Slider item=keuken_tafel label="keukenlamp"
    Slider item=keuken_aanrecht label="lamp aanrecht"

my rules:

rule "my scenes switch"
    Item myScenes changed
    switch (myScenes) {
        case 0: {
        case 1: {
        case 2: {
        case 3: {
        default: {
            logInfo("myScenes","incorrect state: {}",myScenes.state)

i dont now why it didnt work.
I hope someone can help me!


  1. you need the state of the item.
  2. you can remove the brackets if you only execute one command xtend switch expressions.
 rule "my scenes switch"
    Item myScenes changed
    switch (myScenes.state) {
        case 0: logInfo("myScenes", "0")
        case 1: logInfo("myScenes", "1")
        default: logInfo("myScenes","incorrect state: {}",myScenes.state)

You can, if you only want 1 instruction to be executed. His code was more elegant and more expandable.

When using MQTT it is always helpful to have a stand-alone client to check if messages are actually being received at the broker, and updated at the client.

It was also be helpful to know what the logs say when you change the sliders.

ow, so simple!!
it works now!
my example came from this forum:
I have a mqtt client to check the mqtt messages from the broker. i use mqttbox.

Jep, if you wan’t to execute more then 1 thing then you need the brackets. Thats right. Somehow i thoughts this is working but when testing it it does not.