Basic UI and item not updating switch state

Please could you edit your post as below?

Otherwise it becomes quite difficult to read, especially on mobile!

Hope this time it goes correct

UID: mqtt:topic:1bb30530f7
label: Generic MQTT Thing
thingTypeUID: mqtt:topic
configuration: {}
bridgeUID: mqtt:broker:415051801e
channels:
  - id: ABC
    channelTypeUID: mqtt:switch
    label: ABC
    description: ""
    configuration:
      retained: true
      postCommand: false
      qos: 0
      commandTopic: cmnd/bd_sw/POWER2
      stateTopic: stat/bd_sw/RESULT
      transformationPattern: JSONPATH:$.POWER2
      off: OFF
      on: ON
  - id: ColorDimmer
    channelTypeUID: mqtt:colorHSB
    label: ColorDimmer
    description: ""
    configuration:
      commandTopic: cmnd/bd_sw/HSBColor
      stateTopic: stat/bd_sw/RESULT
      transformationPattern: JSONPATH:$.HSBColor

And what’s your actual device that this configuration is for? Can you provide a link to the device?

For the switch

should in theory be

stateTopic: stat/bd_sw/POWER2

and then delete the

transformationPattern: JSONPATH:$.POWER2

line

because according to this

00:39:17 MQT: stat/bd_sw/POWER2 = ON

it doesn’t send JSON, only ON or OFF

Sure please find the product link below. Please not its tuya but I installed tasmotta on it

and tasmotta template which I created after understanding how to create the template. I am beginer in home automation

{"NAME":"MyRoom","GPIO":[39,255,157,255,38,37,0,0,10,17,0,21,255],"FLAG":0,"BASE":18}

Actually yesterday i tried this didnt work so started listening to result anyway I changed again today. But no sucess. Please note colorpicker works. Update code is

UID: mqtt:topic:1bb30530f7
label: Generic MQTT Thing
thingTypeUID: mqtt:topic
configuration: {}
bridgeUID: mqtt:broker:415051801e
channels:
  - id: ABC
    channelTypeUID: mqtt:switch
    label: ABC
    description: ""
    configuration:
      retained: true
      postCommand: false
      qos: 0
      commandTopic: cmnd/bd_sw/POWER2
      stateTopic: stat/bd_sw/POWER2
      off: OFF
      on: ON
  - id: ColorDimmer
    channelTypeUID: mqtt:colorHSB
    label: ColorDimmer
    description: ""
    configuration:
      commandTopic: cmnd/bd_sw/HSBColor
      stateTopic: stat/bd_sw/RESULT
      transformationPattern: JSONPATH:$.HSBColor

Please advise

Just guessing now: maybe delete the above? Remember to click save!

Just to confirm: in the Tasmota console, if you type

POWER2 ON

and hit Enter, or

POWER2 OFF

and hit Enter, your switch turns on and off?

Did what you said but no sucess below is updated code. I have saved it too

UID: mqtt:topic:1bb30530f7
label: Generic MQTT Thing
thingTypeUID: mqtt:topic
configuration: {}
bridgeUID: mqtt:broker:415051801e
channels:
  - id: ABC
    channelTypeUID: mqtt:switch
    label: ABC
    description: ""
    configuration:
      commandTopic: cmnd/bd_sw/POWER2
      stateTopic: stat/bd_sw/POWER2
      off: OFF
      on: ON
  - id: ColorDimmer
    channelTypeUID: mqtt:colorHSB
    label: ColorDimmer
    description: ""
    configuration:
      commandTopic: cmnd/bd_sw/HSBColor
      stateTopic: stat/bd_sw/RESULT
      transformationPattern: JSONPATH:$.HSBColor

Yes console works when i do

POWER2 ON

also in case off
Please note from OH3 also on off works issue is when I trun on or off from alexa or console the state of switch in OH3 is not updated.

Please advise

Can you copy/paste from the Tasmota console to show us this? This will also confirm what Tasmota responds with.

The other thing that you could try is forget the separate Switch Channel, and just connect your ColorHSB Channel separately directly to a Switch Item. Note that ColorHSB is a deprecated Channel type: you may want to use Color for future proofing: MQTT Things and Channels - Bindings | openHAB

You can connect this channel to a Color, Dimmer and Switch item.

Please find console details

21:59:05 CMD: POWER2 ON
21:59:05 MQT: stat/bd_sw/RESULT = {"POWER2":"ON"}
21:59:05 MQT: stat/bd_sw/POWER2 = ON

will try the other options too and let you know but what will be MQTT Command Topic since one channel many functionality?

I’m not 100 certain but I think if you connect a Switch Item to a Color Channel, openHAB internally converts the Switch ON/OFF to the Color brightness setting, so you shouldn’t need to change anything in your Thing. But I’ve never tried it!

EDIT: @Rajiv_Dey actually, forget all that: I totally lost sight of the fact that your switch is totally separate to the LEDs - what I suggested is nonsense, and won’t switch your external device on and off. Apologies!

Hopefully someone else has a better idea: I’m a bit stuck as to why it’s not working for you.

Ok No problem I will wait for others to come to this thread if you make time any time please do suggest.

I tried the color thing but it screwed my settings I am reverting back to original hsb color

1 Like

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.