MQTT2 Switch Item not working

mqtt-binding
Tags: #<Tag:0x00007fe053273298>

(Garbisa) #1

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.


(Elias H.) #2

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.


(Garbisa) #3

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


(Elias H.) #4

Oof

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


(Jürgen Baginski) #5

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?


(Vincent Regaud) #6

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


(Garbisa) #7

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.


(Vincent Regaud) #8

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


(Garbisa) #9

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.


(Garbisa) #10

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.


(Garbisa) #11

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


(David Graeff) #12

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


(Garbisa) #13

Yes, but I didn’t.