(resolved) Sonoff (tasmota v11) does not update the state of the switches

hi, i just got in touch with this platform, i was amazed by its granular and complete organization. it remains a bit difficult for me to configure things.
as a first test I know trying to configure a sonoff 4ch I managed to create the switches, and they work … but the status of the same does not update automatically. I tried a few adjustments found around the forum, but with negative effect.
I will certainly make a mistake in doing something, but I have run out of attempts and I can no longer go on.
i am operating on OH3 with local operhabian server and cloud.
Thanks for your help

Please show your full openHAB and Tasmota configuration for this setup.

UID: mqtt:topic:d2cfc207ce:6506d74b4d
label: Sonoff4chGar
thingTypeUID: mqtt:topic
configuration: {}
bridgeUID: mqtt:broker:d2cfc207ce
location: Garage
channels:

  • id: Sonoff4chGar
    channelTypeUID: mqtt:switch
    label: Basculante
    description: β€œβ€
    configuration:
    commandTopic: cmnd/Sonoff4chGar/power1
    postCommand: false
    stateTopic: stat/Sonoff4chGar/power1
    off: β€œ0”
    on: β€œ1”
  • id: Luce_Scala
    channelTypeUID: mqtt:switch
    label: Luce Scala
    description: β€œβ€
    configuration:
    commandTopic: cmnd/Sonoff4chGar/power2
    stateTopic: stat/Sonoff4chGar/power2
    off: β€œ0”
    on: β€œ1”
  • id: Luce_Garage
    channelTypeUID: mqtt:switch
    label: Luce Garage
    description: β€œβ€
    configuration:
    commandTopic: cmnd/Sonoff4chGar/power3
    stateTopic: stat/Sonoff4chGar/power3
    off: β€œ0”
    on: β€œ1”
  • id: luce_esterna
    channelTypeUID: mqtt:switch
    label: Luce Esterna
    description: β€œβ€
    configuration:
    commandTopic: cmnd/Sonoff4chGar/power4
    stateTopic: stat/Sonoff4chGar/power4
    off: β€œ0”
    on: β€œ1”

hope it can help

You might try using values β€œON” and β€œOFF” instead of β€œ1” and β€œ0”. Those are the values used by my Sonoff-SV with Tasmota.

I have already tried but nothing changes

I’m using OH 2.5 with text configs and some Tasmota 11.x.x devices, but I think you have the wrong stateTopic, which should be:

stateTopic: stat/Sonoff4chGar/RESULT

You then need a JSON transformation to get the value of RESULT. I’m not yet familiar with OH 3.X, but the JSON transformation from my text configs is:

transformationPattern="JSONPATH:$.POWER#"

In your case, replace the # above with the channel number (1 through 4) as appropriate.

I also think you need on and off defined as follows:

off="OFF"
on="ON"

Hope this helps!

When I have MQTT issues, I find MQTT Explorer very useful.

1 Like

In commandTopic and stateTopic POWER should be uppercase, see my config.

UID: mqtt:topic:d0a861377f:Tasmota_Garage
label: Tasmota Garage
thingTypeUID: mqtt:topic
configuration:
  payloadNotAvailable: Offline
  availabilityTopic: tele/garage/LWT
  payloadAvailable: Online
bridgeUID: mqtt:broker:d0a861377f
channels:
  - id: Garage_1
    channelTypeUID: mqtt:switch
    label: Garage 1
    description: ""
    configuration:
      commandTopic: cmnd/garage/POWER1
      stateTopic: stat/garage/POWER1
  - id: Garage_2
    channelTypeUID: mqtt:switch
    label: Garage 2
    description: ""
    configuration:
      commandTopic: cmnd/garage/POWER2
      stateTopic: stat/garage/POWER2
  - id: Garage_3
    channelTypeUID: mqtt:switch
    label: Garage 3
    description: ""
    configuration:
      commandTopic: cmnd/garage/POWER3
      stateTopic: stat/garage/POWER3
  - id: Garage_4
    channelTypeUID: mqtt:switch
    label: Garage 4
    description: ""
    configuration:
      commandTopic: cmnd/garage/POWER4
      stateTopic: stat/garage/POWER4
  - id: IP_Address
    channelTypeUID: mqtt:string
    label: IP Address
    description: ""
    configuration:
      stateTopic: stat/garage/STATUS5
      transformationPattern: JSONPATH:$.StatusNET.IPAddress

:cold_face:

uppercase… :roll_eyes:

everything ok thanks 1000