MQTT2 Switch Item not working

Hi, I want use an Switch Type Item (ON/OFF). The item is never updated. Should this work?
others e.g Text/Numbers are working.

First of all, please read this…

Second,

Yes
“Why does it not work?”
I would assume wrong config. But you did not post your mqtt config for the switch item, so I can only assume.

1 Like

thank for quick reaction. I already had other errors with new mqtt2 which were finally solved with newsest snapshot - and the tipp came from the community.

thing.json:
{
“acceptedItemType”: “Switch”,
“kind”: “STATE”,
“uid”: {
“segments”: [
“mqtt”,
“topic”,
“32d1e183”,
“hswp_enabled”
]
},
“channelTypeUID”: {
“segments”: [
“mqtt”,
“switch”
]
},
“label”: “heating\status\wp\enabled”,
“configuration”: {
“properties”: {
“stateTopic”: “heating\status\wp\enabled”
}
},
“properties”: {},
“defaultTags”: []
}

Have others (Text/number) which are working.
No error messages in Log

Oof

I did not use the 2.X MQTT Binding yet… sorry cant help here much

What isn’t “working”?
The switch doesn’t switch and/or doesn’t show the actual state.
I’m not used to the PaperUI configuration,k but in the posted json I see only a “stateTopic”, which is respinsible to show the actual state, don’t you have set a “commandTopic”, which should send the actusl command?

What exact payload do you receive?
Can you show the logs of when you action that switch, please?

The switch is handled by a first OH2 installation and I try to copy the current state to my second OH2.
I use “MQTT Spy” and see “ON” and "OFF"s when manuipulating it with the first OH2.
Nothing happens, no log entries for this.
But other mqtt items (Number) work.

Is the thing online in the paperUI
Can you post a screen shot of the thing config, please?
I get the json above but I am not used to it

I just added more Switch items - and two of them are working. Something is wrong with my configuration for the nonworking items. I’ve to check it.
I saw also, they are displayed as “disabled” in PaperUI.

Here the thing.json with two items. First one works, second one doen’t and is shown disabeld in PaperUI:

   {
      "acceptedItemType": "Switch",
      "kind": "STATE",
      "uid": {
        "segments": [
          "mqtt",
          "topic",
          "32d1e183",
          "hc_mode"
        ]
      },
      "channelTypeUID": {
        "segments": [
          "mqtt",
          "switch"
        ]
      },
      "label": "heating/command/mode",
      "configuration": {
        "properties": {
          "stateTopic": "heating/command/mode"
        }
      },
      "properties": {},
      "defaultTags": []
    },
    {
      "acceptedItemType": "Switch",
      "kind": "STATE",
      "uid": {
        "segments": [
          "mqtt",
          "topic",
          "32d1e183",
          "hswp_enabled"
        ]
      },
      "channelTypeUID": {
        "segments": [
          "mqtt",
          "switch"
        ]
      },
      "label": "heating/status/wp/enabled",
      "configuration": {
        "properties": {
          "stateTopic": "heating/status/wp/enabled"
        }
      },
      "properties": {},
      "defaultTags": []
    }

Must be something silly.

Finally it was time to reset the system. After a reboot all items are working as expected.
Thanks for all help.

If you edit the JSON db, you need to restart openHAB anyway after a change. But you know that already, I guess.

Yes, but I didn’t.