Missing physical mqtt switch action from SONOFF ZBMINIR2

  • Platform information:

    • Hardware: Linux/4.4.302+ (amd64)
    • OS: Docker openhab/openhab:latest
    • Java Runtime Environment: 17.0.13 (undefined)
    • openHAB version: 4.2.3
    • zigbee2mqtt: Docker koenkk/zigbee2mqtt:latest
    • mosquitto: Docker eclipse-mosquitto:latest
    • mqtt-explorer: mqtt-explorer-beta (0.4.0-beta.6)
    • zigbee-hardware: SONOFF ZBMINIR2
  • Items configuration related to the issue

Switch switch_sonoff_01_switch "ON/OFF" { channel="mqtt:topic:switch_sonoff_01:switch" }
  • Rules code related to the issue
rule "Kitchenlights"
when
   Item switch_sonoff_01_switch changed
then
   logInfo("Kitchenlights", "Switch: " + switch_sonoff_01_switch.state.toString)
   breaker_nous_01_switch.sendCommand( switch_sonoff_01_switch.state.toString )
   breaker_nous_02_switch.sendCommand( switch_sonoff_01_switch.state.toString )
end
  • Services configuration related to the issue
Thing mqtt:topic:switch_sonoff_01 "Switch SONOFF 01" (mqtt:broker:jupitermosquitto)
{
   Channels:
      Type switch : switch "ON/OFF" [ 
         stateTopic = "zigbee2mqtt/Switch_SONOFF_01/state", 
         commandTopic = "zigbee2mqtt/Switch_SONOFF_01/set"
      ]
}
  • If logs where generated please post these here using code fences:
#> tail -f /jupiter/docker/openhab/userdata/logs/openhab.log
2024-11-27 20:02:46.115 [INFO ] [core.model.script.Kitchenlights] - Switch: ON
2024-11-27 20:02:50.575 [INFO ] [core.model.script.Kitchenlights] - Switch: OFF
2024-11-27 20:02:53.907 [INFO ] [core.model.script.Kitchenlights] - Switch: ON
2024-11-27 20:03:02.634 [INFO ] [core.model.script.Kitchenlights] - Switch: OFF

Issue

With a physical switch connected to the sonoff I can toggle the corresponding mqtt status value. I have verified this using mqtt-explorer: The entry state is switched to ON/OFF accordingly. I also have this correct behavior when I switch the status value via the web interface of zigbee2mqtt.

I can change the status value of the corresponding item in the web interface of obenhab, which also works correctly, whereby the log output appears (see openhab.log) and the two switches are also switched correctly accordingly. The status values verified with mqtt-explorer also all match in this case.

But unfortunately the zigbee2mqtt event (switched externally) does not arrive in openhab, what is going wrong?

Find the issues:

  1. Install transformation addon json path
  2. Adapt channel
 Channels:
      Type switch : switch "ON/OFF" [ 
         stateTopic = "zigbee2mqtt/Switch_SONOFF_01",
         transformationPattern = "JSONPATH:$.state",
         commandTopic = "zigbee2mqtt/Switch_SONOFF_01/set"
      ]