Openhab 3 MQTT Sonoff Basic with Tasmota issue (On working, Off not working)

  • Platform information:
    • Hardware: Laptop MemTotal: 16270336 kB
    • OS: Ubuntu 20.04
    • Java Runtime Environment:
      openjdk version “11.0.9.1” 2020-11-04 LTS
      OpenJDK Runtime Environment Zulu11.43+55-CA (build 11.0.9.1+1-LTS)
      OpenJDK 64-Bit Server VM Zulu11.43+55-CA (build 11.0.9.1+1-LTS, mixed mode)
    • openHAB version: openHAB 3.0.0
  • Issue of the topic:
    I’m able to turn on the sonoff-tasmota from OH3, but not able to turn it off.
    The state on the channel also does not reflect the actual sonoff state (when refresh the page, it defaults to off always.
    Toggling it manually from the tasmota page successfully triggers an event in OH3 event log:
    ==> events.log <==
    2021-01-17 23:03:20.705 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item ‘SonoffBasic01_ChSonoffBasic01’ changed from NULL to ON
    2021-01-17 23:03:22.522 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item ‘SonoffBasic01_ChSonoffBasic01’ changed from ON to OFF
    2021-01-17 23:03:24.509 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item ‘SonoffBasic01_ChSonoffBasic01’ changed from OFF to ON
    2021-01-17 23:03:26.209 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item ‘SonoffBasic01_ChSonoffBasic01’ changed from ON to OFF

When turning it on from OH3, the event log shows:
==> events.log <==
2021-01-17 23:04:09.166 [INFO ] [openhab.event.ItemCommandEvent ] - Item ‘SonoffBasic01_ChSonoffBasic01’ received command ON
2021-01-17 23:04:09.167 [INFO ] [penhab.event.ItemStatePredictedEvent] - Item ‘SonoffBasic01_ChSonoffBasic01’ predicted to become ON
2021-01-17 23:04:09.170 [INFO ] [openhab.event.ItemStateChangedEvent ] - Item ‘SonoffBasic01_ChSonoffBasic01’ changed from OFF to ON

But when turning it off from OH3, nothing is displayed in the event log.

  • Please post configurations (if applicable):
    UID: mqtt:topic:398e2a4556:efbbed260e
    label: Sonoff Basic 01
    thingTypeUID: mqtt:topic
    configuration:
    payloadNotAvailable: Offline
    availabilityTopic: tele/tasmota-15845D/LWT
    payloadAvailable: Online
    bridgeUID: mqtt:broker:398e2a4556
    channels:
    • id: ChSonoffBasic01
      channelTypeUID: mqtt:switch
      label: ChSonoffBasic01
      description: “”
      configuration:
      commandTopic: cmnd/tasmota-15845D/POWER
      stateTopic: stat/tasmota-15845D/POWER
      off: OFF
      on: ON

MQTT Explorer screenshot of stat:

I am also experiencing this exact same issue… will turn on, the item text represents the correct status:

The item switch defaults to off:

image

Sending the on command works:

image

but the off produces nothing, not in logs on openhab or in console on switch.

YAML:

UID: mqtt:topic:homeserver_mqtt:sonoffb_pigcage
label: Lola Heater
thingTypeUID: mqtt:topic
configuration:
  payloadNotAvailable: offline
  availabilityTopic: tele/sonoffb_pigcage/LWT
  payloadAvailable: Online
bridgeUID: mqtt:broker:homeserver_mqtt
location: Outside
channels:
  - id: Switch
    channelTypeUID: mqtt:switch
    label: Power Switch
    description: ""
    configuration:
      commandTopic: cmnd/sonoffb_pigcage/POWER
      stateTopic: stat/sonoffb_pigcage/POWER

Any help understanding this would be greatly appreciated. I am moving from OpenHab 2.x but starting with a clean build on 3.x looking to use the interface for the build if it i can get it to work.

It’s probably a UI issue. See this:

Try with a different browser and/or on a different device…

1 Like

Indeed. When looking deeper, found out that the option “Implicit user role for unauthenticated requests” must be checked for this to work properly on the UI.