Basic UI and item not updating switch state

Hi,

I have configured openhab3 using paperUI a switch that runs on tasmota. I have mosquitto running as mqtt server and have bindings, channels, and item configured
in channe following is the setting

MQTT state topic
stat/bd_sw/POWER2

MQTT command topic
cmnd/bd_sw/POWER2

I have configured a site map too. The switch works for on and off through basicUI but if I turn off/ the switch by Alexa the basic UI does not update the state. I checked my mosquito server by subscribing to the topic. Mosquitto receives the status whenever the switch is toggled either by tasmota console or Alexa. But OpenHab3 seems not to update the switch status.

Can someone help me with what is going wrong?

Did you refresh your browser? Some times it doesn’t refresh

Yes I have refreshed. open new window in incognito. also restarted openhab3. nothing worked as if openhab3 is not listening to the subscribed event. as mentioned earlier mosquito is capturing the details.

Just to confirm: openHAB never updates the state of your Switch Item if you change the state of the switch from either Alexa or Tasmota itself?

What state is shown in the new Pages of the MainUI?

It never updates the state of the switch. it remains in the state where it was left. even in items page it remains the same screen shot below. I am not sure what is main page. I check in basicUi and item details

MainUI is the new user interface for openHAB 3.

BasicUI is still supported in openHAB 3, but you would have to deliberately select it for view.

Do your event and openhab logs give any clue as to what’s going on?

How to see the event and log file. I am new to openhap3. How to see main UI. I downloaded IOS app it also shows that switch is not updated. Please pardon me for too many question

No problem - there’s a lot to learn. For logs:

Hi,
I could not find the log file as mentioned in documentation. But I did log in to console and checked realtime logging. if I toggle switch in basicUI I get the realtime log of the event. But no log if I toggle through alexa or tasmota console. Any idea why this behaviour or where are my log files

very strange the logfiles were not created but after I created the folder openhab in var/log/ the logfiles got created but only event.log has data other files are empty.

I am still struggling to get openhab3 listen to state topic. I created another color picker again same problem. the control works if I change color but the control do not get updated when I change color via alexa or tasmota console. I am using mosquitto broker. Please help

Can you show us the configuration of your Thing? Please share the YAML in between code-fences, sandwiched between 3 backticks ```

```

like this

```

Hi,
from where shall I get the configuration file. I have created the entire setup using paperUI not by file editing

I think at this stage it is worth taking your time to read through the getting started tutorial.

The Advanced topic takes you through how to setup an MQTT device.

In MainUI you should have an option to show you the configuration of your Thing.

You are using openHAB3 right? And you have configured everything with the MainUI so far?

Thanks for the pointer to read the documentation. I have read them many times will keep on reading till I get hold of open hab.

Yes I am using openhab3 and I am using UI that comes when I login to the openhab3 port 8080 I am logged in as administrator not sure if that is called main UI.

Now that log files are created I got something interesting see below

Blockquote
2020-12-24 03:40:36.871 [WARN ] [ab.binding.mqtt.generic.ChannelState] - Command ‘{“POWER2”:“ON”,“Dimmer”:99,“Color”:“83B8FC”,“HSBColor”:“214,48,99”,“Channel”:[51,72,99]}’ not supported by$
2020-12-24 03:40:37.164 [WARN ] [t.generic.ChannelStateTransformation] - Transformation service JSONPATH for pattern $.HSBColor not found!

That’s one issue - good find!

You need to add the JSONPATH Transformation Service. Go to Settings -> Transformations, then click the blue + circle on the bottom right. Then install the JSONPATH Transformation Service.

The other thing is: what is the full message that gets sent to stat/bd_sw/POWER2?

Hey I solved the color picker problem its working fine now I mean it changes the color status evenif done from alexa or tasmota console the problem was the Jsonpath service. But still I am facing issue with the switch. The switch sends this message on turning on. I think I need to transform ON to 0 and off to 1 something like that can you help

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

Try this in your Switch Channel configuration:

Or at least delete the 1 and 0 which seem to appear there by default.

Actually, I tried with your suggested way but no sucess. And I cant delete 1 and 0 if I focus out the value returns. Strange now color picker is working which is more complex but switch which is simple is stillnot updating th state if done from different app like alexa. Any thought

Yes - can we see the YAML from the Code tab for your Switch Thing?

Sorry I could not post yesterday as being new user i got limits of daily post
For more info see the below code. Note colourpicker works for state update switch state update does not work

Blockquote
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