[SOLVED] openHAB UI(switches) is not getting updated from tasmota

I setup everything including OpenHAB installation, google assistant, Amazon Alexa integration and everything id working fine. I’m using ESP8266 based Wemos Mini D1 for controlling my relays using tasmota firmware. I can control my relays using, OpenHAB UIs, Tasmota Web based UI, Google assistant, Amzon alexa and Mechanical switces.

While using OpenHAB, Google assistant and Amazon Alexa my Openhab UI is updating instantly(like the UI switches left and right/ ON and OFF), but when I control the relays using Tasmota interface or machanical switches its not getting updated on my OpenHAB UI. I tried using autoupdate=“false” but the switch stoped working.
My items file is as below

//This is the items file

Switch LEDTB "LED Tube"<Light> [ "Switchable" ]{mqtt="<[broker:cmnd/Jacksroom/Sonoff/POWER1:command:*:default],>[broker:cmnd/Jacksroom/Sonoff/POWER1:command:*:default]"}
Switch FAN "Fan"<Fan> [ "Switchable" ]{mqtt=">[broker:cmnd/Jacksroom/Sonoff1/POWER2:command:*:default],>[broker:cmnd/Jacksroom/Sonoff1/POWER2:command:*:default]"}
Switch BDLT "Bed Light"<Light> [ "Switchable" ]{mqtt=">[broker:/Jacksroom/BDLT/gpio/16:command:ON:0],>[broker:/Jacksroom/BDLT/gpio/16:command:OFF:1]"}
Switch PSRBSTR "Pressure Booster"<water> [ "Switchable" ]{mqtt=">[broker:/Jacksroom/PSRBSTR/gpio/4:command:ON:0],>[broker:/Jacksroom/PSRBSTR/gpio/4:command:OFF:1]"}
DateTime Today
//Temperature and Humidity
Number Temperature "Temperature [%.2f °C]" <temperature>{mqtt="<[broker:/Jacksroom/jacks/Temperature:state:default]"}
Number Humidity "My Room[%.2f %%]"<humidity>{mqtt="<[broker:/Jacksroom/jacks/Humidity:state:default]"}

My Sitemapfile

sitemap jackshome label="Jacks-Smarthome"
{

  Frame label="Today"
 {
    Text item=Today label="Today [%1$tA]"
    Text item=Today label="The Date is [%1$td/%1$tm/%1$tY]"
    Text item=Today label="The time is [%1$tH:%1$tM]"
  }

  Frame label="My South West Room"
  {
   Switch item=LEDTB
   Switch item=PSRBSTR
   Switch item=BDLT
   Switch item=FAN
  }
Frame label="Climate@Home"
{
Text item=yahooweather_weather_3c28492b_temperature
Text item=yahooweather_weather_3c28492b_humidity
Text item=yahooweather_weather_3c28492b_pressure
}
Frame label="My Room"
{
     Text item=Temperature
     Text item=Humidity
}
}

I’m a beginner too with very low limited knowledge in coding. But I’m learning. :smiley:
Could someone please help me to resolve this issue…?

Your switch definition in items is wrong. cmnd command for switching and stat for state
Switch LEDTB “LED Tube” [ “Switchable” ]{mqtt="<[broker:cmnd/Jacksroom/Sonoff/POWER1:command::default],>[broker:cmnd/Jacksroom/Sonoff/POWER1:command::default]"}

See here:

sonoff.items:
Sonoff Basic / Sonoff S20 Smart Socket (Read and switch on-state)
Switch LivingRoom_Light “Living Room Light” (LR,gLight)
{ mqtt=">[broker:cmnd/sonoff-A00EEA/POWER:command:*:default],
<[broker:stat/sonoff-A00EEA/POWER:state:default]" }

1 Like

The Temperature and Humidity items depends on which sensor you have.
Here is my example for a Bosch BME280 sensor
`Number Keller_Temperature “Keller Temp. [%.1f °C]” (Keller_Temp, Keller_Temp_Chart, Temperature, Temperature_Chart)
{ mqtt="<[broker:tele/sonoff-1C1289/SENSOR:state:JSONPATH($.BME280.Temperature)]" }

Number Keller_Humidity “Keller Luftfeuchte [%.1f %%]” (Keller_Humi, Keller_Humi_Chart, Humidity, Humidity_Chart)
{ mqtt="<[broker:tele/sonoff-1C1289/SENSOR:state:JSONPATH($.BME280.Humidity)]" }

Number Keller_Pressure “Keller Luftdruck [%.1f hPa]” (Keller_Press, Keller_Press_Chart, Pressure, Pressure_Chart)
{ mqtt="<[broker:tele/sonoff-1C1289/SENSOR:state:JSONPATH($.BME280.Pressure)]" }
`

Just to complete this, here are the openHAB Docs and the Sonoff Tasmota openHAB Wiki

I have changed it but still not working

Switch LEDTB "LED Tube"<Light> [ "Switchable" ]{mqtt=">[broker:cmnd/Jacksroom/Sonoff/POWER1:command:*:default],<[broker:cmnd/Jacksroom/Sonoff/POWER1:state:default]"}

The sensor is working fine with espeasy… I havn’t tried with Tasmota yet. Your reply may be helpful for me for the next wemos module. Thank you :smiley:

You have 3 relays connected?
Could you post the screenshot from “Configure Module”
And a copy of the webconsole output if you switch the 3 buttons on/off

yes three relays please give importance to LETB and FAN section you can ignore the rest.

Can you post your actual items file for this?

this is the itmes file

//This is the items file
Switch LEDTB "LED Tube"<Light> [ "Switchable" ]{mqtt=">[broker:cmnd/Jacksroom/Sonoff/POWER1:command:*:default],<[broker:cmnd/Jacksroom/Sonoff/POWER1:state:default]"}
Switch FAN "Fan"<Fan> [ "Switchable" ]{mqtt=">[broker:cmnd/Jacksroom/Sonoff1/POWER2:command:*:default],>[broker:cmnd/Jacksroom/Sonoff1/POWER2:command:*:default]"}
Switch BDLT "Bed Light"<Light> [ "Switchable" ]{mqtt=">[broker:/Jacksroom/BDLT/gpio/16:command:ON:0],>[broker:/Jacksroom/BDLT/gpio/16:command:OFF:1]"}
Switch PSRBSTR "Pressure Booster"<water> [ "Switchable" ]{mqtt=">[broker:/Jacksroom/PSRBSTR/gpio/4:command:ON:0],>[broker:/Jacksroom/PSRBSTR/gpio/4:command:OFF:1]"}
DateTime Today
//Temperature and Humidity
Number Temperature "Temperature [%.2f °C]" <temperature>{mqtt="<[broker:/Jacksroom/jacks/Temperature:state:default]"}
Number Humidity "My Room[%.2f %%]"<humidity>{mqtt="<[broker:/Jacksroom/jacks/Humidity:state:default]"}


{mqtt=">[broker:cmnd/Jacksroom/Sonoff/POWER1:command:*:default],<[broker:cmnd/Jacksroom/Sonoff/POWER1:state:default]"}

mqtt topic isnt correct

{mqtt=">[broker:cmnd/Jacksroom/POWER1:command:*:default],<[broker:stat/Jacksroom/POWER1:state:default]"}

{mqtt=">[broker:cmnd/Jacksroom/POWER2:command:*:default],<[broker:stat/Jacksroom/POWER2:state:default]"}

{mqtt=">[broker:cmnd/Jacksroom/POWER3:command:*:default],<[broker:stat/Jacksroom/POWER3:state:default]"}

1 Like

i changed the itmes files as follows but still no diffrence

Switch LEDTB "LED Tube"<Light> [ "Switchable" ]{mqtt=">[broker:cmnd/Jacksroom/POWER1:command:*:default],<[broker:cmnd/Jacksroom/POWER1:state:default]"}

AHHHH i am id**. As i wrote in my first post for state is NOT CMND -> stat!!!

So.

Switch LEDTB "LED Tube"<Light> [ "Switchable" ]{mqtt=">[broker:cmnd/Jacksroom/POWER1:command:*:default],<[broker:stat/Jacksroom/POWER1:state:default]"}

I corrected my post earlier.

1 Like

No it not working, and now I can’t control the relay via OpenHAB :frowning:

Switch LEDTB “LED Tube”<Light> [ “Switchable” ]{mqtt=">[broker:cmnd/Jacksroom/POWER1:command:*:default],<[broker:stat/Jacksroom/POWER1:state:default]"}

Maybe a copy paste error. The logic for switching didnt change.
It looks strange to me “LED Tube” isnt in red anymore. and the hypens " are different
Do you have a error in OpenHab log file viewer?

It worked :smiley: Thank you so much for your time and effort for the solution.
And yes it was a copy paste error. Once thank you so much. :blush:

Your welcome, happy it works too.

1 Like