New MQTT Binding - Cannot Update the Switch to the actual power state automatically

Dear Community,

i do have a text configuration mqtt2-Binding installation. As far as i can see everything works fine except the automatic update for my power swtiches according to the power states of my tasmota devices.

That means if i force an update on my devices every value/item (e.g.: Uptime, Voltage, and much more) gets updated accordingly

CONFIGURATION:

openhab 2.5 stable on raspberry py 3b
it runs very stable without any other known issues.

tasmota.rules
//used through ForceUpdate Switch and triggered on timed event
//NEEDS sonoff_device_ids defined
rule “update MQTT Info”
when
//“At second :00, at minutes :02 and :32, of every hour”
Time cron “0 2,32 * ? * * *”
then
logInfo(“tasmota.rules”, "update MQTT Info for all devices: " )
val actionsBroker = getActions(“mqtt”,“mqtt:broker:5cef27a7”) // change to your broker name!

    for (String device_id : sonoff_device_ids) {  
        actionsBroker.publishMQTT( device_id + "/cmnd/status", "0")
    }
end

tasmota.things:

Thing mqtt:topic:sonoff0001_thing "Sonoff POW Switch 0001" (mqtt:broker:5cef27a7) @ "HOME"  {

  Channels:

    Type switch : PowerSwitch             "Power Switch"          [ stateTopic="sonoff-0001/stat/POWER", stateTopic="sonoff-0001/tele/LWT", stateTopic="sonoff-0001/stat/STATUS", transformationPattern="JSONPATH:$.Status.Power", commandTopic="sonoff-0001/cmnd/POWER", ON="1", OFF="0" ]

    Type number : POW_Current             "POW Current"           [ stateTopic="sonoff-0001/tele/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Current",    stateTopic="sonoff-0001/stat/STATUS8", transformationPattern="JSONPATH:$.StatusSNS.ENERGY.Current", stateTopic="sonoff-0001/stat/STATUS10", transformationPattern="JSONPATH:$.StatusSNS.ENERGY.Current"]

    Type number : POW_Voltage             "POW Voltage"           [ stateTopic="sonoff-0001/tele/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Voltage",    stateTopic="sonoff-0001/stat/STATUS8", transformationPattern="JSONPATH:$.StatusSNS.ENERGY.Voltage", stateTopic="sonoff-0001/stat/STATUS10", transformationPattern="JSONPATH:$.StatusSNS.ENERGY.Voltage"]

    Type number : POW_Watts               "POW Watts"             [ stateTopic="sonoff-0001/tele/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Power",      stateTopic="sonoff-0001/stat/STATUS8", transformationPattern="JSONPATH:$.StatusSNS.ENERGY.Power", stateTopic="sonoff-0001/stat/STATUS10", transformationPattern="JSONPATH:$.StatusSNS.ENERGY.Power"]    

    Type number : POW_Energy_today        "Energy Today"          [ stateTopic="sonoff-0001/tele/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Today",      stateTopic="sonoff-0001/stat/STATUS8", transformationPattern="JSONPATH:$.StatusSNS.ENERGY.Today", stateTopic="sonoff-0001/stat/STATUS10", transformationPattern="JSONPATH:$.StatusSNS.ENERGY.Today"]

    Type number : POW_Energy_totalyest    "Energy Yesterday"      [ stateTopic="sonoff-0001/tele/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Yesterday",  stateTopic="sonoff-0001/stat/STATUS8", transformationPattern="JSONPATH:$.StatusSNS.ENERGY.Yesterday", stateTopic="sonoff-0001/stat/STATUS10", transformationPattern="JSONPATH:$.StatusSNS.ENERGY.Yesterday"]

    Type number : POW_Energy_total        "Energy Total"          [ stateTopic="sonoff-0001/tele/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Total",      stateTopic="sonoff-0001/stat/STATUS8", transformationPattern="JSONPATH:$.StatusSNS.ENERGY.Total", stateTopic="sonoff-0001/stat/STATUS10", transformationPattern="JSONPATH:$.StatusSNS.ENERGY.Total"]

    Type string : hostname                "Hostname"              [ stateTopic="sonoff-0001/tele/INFO2", transformationPattern="JSONPATH:$.Hostname",           stateTopic="sonoff-0001/stat/STATUS5", transformationPattern="JSONPATH:$.StatusNET.Hostname"]

    Type string : IP                      "IP"                    [ stateTopic="sonoff-0001/tele/INFO2", transformationPattern="JSONPATH:$.IPAddress",          stateTopic="sonoff-0001/stat/STATUS5", transformationPattern="JSONPATH:$.StatusNET.IPAddress"]

    Type string : version                 "Version"               [ stateTopic="sonoff-0001/tele/INFO1", transformationPattern="JSONPATH:$.Version",            stateTopic="sonoff-0001/stat/STATUS2", transformationPattern="JSONPATH:$.StatusFWR.Version"]

    Type string : uptime                  "Uptime"                [ stateTopic="sonoff-0001/tele/STATE", transformationPattern="JSONPATH:$.Uptime",             stateTopic="sonoff-0001/stat/STATUS11", transformationPattern="JSONPATH:$.StatusSTS.Uptime"]

    Type number : wifi-rssi               "Wifi Signal"           [ stateTopic="sonoff-0001/tele/STATE", transformationPattern="JSONPATH:$.Wifi.RSSI", transformationPattern="JSONPATH:$.Wifi.RSSI", stateTopic="sonoff-0001/stat/STATUS11", transformationPattern="JSONPATH:$.StatusSTS.Wifi.RSSI"]

    Type switch : ForceUpdate             "Force Update on Stats" [ stateTopic="sonoff-0001/stat/STATUS", commandTopic="sonoff-0001/cmnd/status", on="0", off="0"]

    

  } // end of thing

tasmota.items

Switch Sonoff0001_PowerSwitch       "Power Switch"                    <switch>    (gSonoffSw0001, gTasmotaSwitchesAll)       { channel="mqtt:topic:sonoff0001_thing:PowerSwitch" }

Number Sonoff0001_POW_Current       "POW Current [%.1f A]"            <line>      (gSonoffSw0001, gTasmotaSwitchesAll)       { channel="mqtt:topic:sonoff0001_thing:POW_Current" }

Number Sonoff0001_POW_Voltage       "POW Voltage [%.1f V]"            <line>      (gSonoffSw0001, gTasmotaSwitchesAll)       { channel="mqtt:topic:sonoff0001_thing:POW_Voltage" }

Number Sonoff0001_POW_Watts         "POW Watts [%.1f W]"              <line>      (gSonoffSw0001, gTasmotaSwitchesAll)       { channel="mqtt:topic:sonoff0001_thing:POW_Watts" }

Number Sonoff0001_POW_Today         "POW Today [%.3f kWh]"            <line>      (gSonoffSw0001, gTasmotaSwitchesAll)       { channel="mqtt:topic:sonoff0001_thing:POW_Energy_today" }

Number Sonoff0001_POW_totalyest     "Energy Yesterday [%.3f kWh]"     <line>      (gSonoffSw0001, gTasmotaSwitchesAll,gVorg_Energy)       { channel="mqtt:topic:sonoff0001_thing:POW_Energy_totalyest" }

Number Sonoff0001_POW_total         "Energy Total [%.3f kWh]"         <line>      (gSonoffSw0001, gTasmotaSwitchesAll)       { channel="mqtt:topic:sonoff0001_thing:POW_Energy_total" }

String Sonoff0001_Hostname          "Hostname  [%s]"                  <network>   (gSonoffSw0001, gTasmotaSwitchesAll)       { channel="mqtt:topic:sonoff0001_thing:hostname" }

String Sonoff0001_IP                "IP  [%s]"                        <network>   (gSonoffSw0001, gTasmotaSwitchesAll)       { channel="mqtt:topic:sonoff0001_thing:IP" }

String Sonoff0001_Version           "Version [%s]"                    <network>   (gSonoffSw0001, gTasmotaSwitchesAll)       { channel="mqtt:topic:sonoff0001_thing:version" }

String Sonoff0001_Uptime            "Uptime"                          <network>   (gSonoffSw0001, gTasmotaSwitchesAll)       { channel="mqtt:topic:sonoff0001_thing:uptime" }

Switch Sonoff0001_ForceUpdate       "Force Update on Stats"           <settings>  (gSonoffSw0001, gTasmotaSwitchesAll)       { channel="mqtt:topic:sonoff0001_thing:ForceUpdate" }

Number Sonoff0001_WifiRssi          "Wifi Signal  [%s]"               <network>   (gSonoffSw0001, gTasmotaSwitchesAll)       { channel="mqtt:topic:sonoff0001_thing:wifi-rssi" }

I tried several variants as PowerSwitch:

Variant 1:
Type switch : PowerSwitch "Power Switch" [ stateTopic="sonoff-0001/stat/POWER", stateTopic="sonoff-0001/tele/LWT", stateTopic="sonoff-0001/stat/STATUS", transformationPattern="JSONPATH:$.Status.Power", commandTopic="sonoff-0001/cmnd/POWER", ON="1", OFF="0" ]

Variant 2:
Type switch : PowerSwitch "Power Switch" [ stateTopic="sonoff-0001/stat/POWER", stateTopic="sonoff-0001/tele/LWT", stateTopic="sonoff-0001/stat/STATUS11", transformationPattern="JSONPATH:$.StatusSTS.Power", commandTopic="sonoff-0001/cmnd/POWER", ON="1", OFF="0" ]

Variant 3:
Type switch : PowerSwitch "Power Switch" [ stateTopic="sonoff-0001/stat/POWER", stateTopic="sonoff-0001/tele/LWT", stateTopic="sonoff-0001/stat/STATUS11", transformationPattern="JSONPATH:$.StatusSTS.Power", transformationPattern="MAP:onoff.map", commandTopic="sonoff-0001/cmnd/POWER"]
onoff.map:
0=OFF
1=ON

Variant 4:
Type switch : PowerSwitch "Power Switch" [ stateTopic="sonoff-0001/stat/POWER", stateTopic="sonoff-0001/tele/LWT", stateTopic="sonoff-0001/stat/STATUS", transformationPattern="JSONPATH:$.Status.Power", commandTopic="sonoff-0001/cmnd/POWER", on="1", off="0" ]

With none of those i achieve any hug difference. But most of the time i do get the following warning:

2020-01-18 22:13:39.967 [WARN ] [ab.binding.mqtt.generic.ChannelState] - Command ‘{“Status”:{“Module”:6,“FriendlyName”:[“Sonoff0001”],“Topic”:“sonoff-0001”,“ButtonTopic”:“0”,“Power”:1,“PowerOnState”:3,“LedState”:0,“LedMask”:“FFFF”,“SaveData”:1,“SaveState”:1,“SwitchTopic”:“0”,“SwitchMode”:[0,0,0,0,0,0,0,0],“ButtonRetain”:0,“SwitchRetain”:0,“SensorRetain”:0,“PowerRetain”:0}}’ not supported by type ‘OnOffValue’: No enum constant org.eclipse.smarthome.core.library.types.OnOffType.{“Status”:{“Module”:6,“FriendlyName”:[“Sonoff0001”],“Topic”:“sonoff-0001”,“ButtonTopic”:“0”,“Power”:1,“PowerOnState”:3,“LedState”:0,“LedMask”:“FFFF”,“SaveData”:1,“SaveState”:1,“SwitchTopic”:“0”,“SwitchMode”:[0,0,0,0,0,0,0,0],“ButtonRetain”:0,“SwitchRetain”:0,“SensorRetain”:0,“PowerRetain”:0}}
==> /var/log/openhab2/events.log <==

2020-01-18 22:13:40.379 [vent.ItemStateChangedEvent] - Sonoff0001_POW_Voltage changed from 230 to 229

2020-01-18 22:13:40.429 [vent.ItemStateChangedEvent] - Sonoff0001_POW_total changed from 254.14 to 254.143

2020-01-18 22:13:40.457 [vent.ItemStateChangedEvent] - Sonoff0001_WifiRssi changed from 42 to 40

2020-01-18 22:13:40.464 [vent.ItemStateChangedEvent] - Sonoff0001_POW_Today changed from 0.299 to 0.302

2020-01-18 22:13:40.469 [vent.ItemStateChangedEvent] - Sonoff0001_Uptime changed from 4T23:15:51 to 4T23:27:31

2020-01-18 22:13:40.474 [vent.ItemStateChangedEvent] - Sonoff0001_POW_Current changed from 0.121 to 0.118

2020-01-18 22:13:40.586 [ome.event.ItemCommandEvent] - Item 'Sonoff0001_ForceUpdate' received command ON

2020-01-18 22:13:40.632 [nt.ItemStatePredictedEvent] - Sonoff0001_ForceUpdate predicted to become ON

2020-01-18 22:13:40.667 [vent.ItemStateChangedEvent] - Sonoff0001_ForceUpdate changed from OFF to ON

I can confirm that this warning is related to the PowerSwitch. Cause if i remove the switch as item i do not receive this error.

Thats a screenshot from the PaperUI:


The PowerSwitch is always like this - it never gets updated. As a matter of fact the actual state is “Power”:“1”.

i can confirm this because my powered device gets power and additionally i can check this on the console of the tasmota device:

22:22:16 MQT: sonoff-0001/stat/STATUS = {"Status":{"Module":6,"FriendlyName":["Sonoff0001"],"Topic":"sonoff-0001","ButtonTopic":"0","Power":1,"PowerOnState":3,"LedState":0,"LedMask":"FFFF","SaveData":1,"SaveState":1,"SwitchTopic":"0","SwitchMode":[0,0,0,0,0,0,0,0],"ButtonRetain":0,"SwitchRetain":0,"SensorRetain":0,"PowerRetain":0}}
22:22:16 MQT: sonoff-0001/stat/STATUS1 = {"StatusPRM":{"Baudrate":115200,"GroupTopic":"sonoffs","OtaUrl":"http://domus1:80/api/arduino/sonoff.ino.bin","RestartReason":"Software/System restart","Uptime":"4T23:36:08","StartupUTC":"2020-01-13T21:46:08","Sleep":50,"CfgHolder":4617,"BootCount":1615,"SaveCount":6584,"SaveAddress":"F8000"}}
22:22:16 MQT: sonoff-0001/stat/STATUS2 = {"StatusFWR":{"Version":"6.6.0(release-sonoff)","BuildDateTime":"2019-07-06T13:10:20","Boot":31,"Core":"2_3_0","SDK":"1.5.3(aec24ac9)"}}
22:22:16 MQT: sonoff-0001/stat/STATUS3 = {"StatusLOG":{"SerialLog":2,"WebLog":2,"SysLog":0,"LogHost":"domus1","LogPort":514,"SSId":["home-wlan","home-wlan2"],"TelePeriod":120,"Resolution":"558180C0","SetOption":["00000009","280500000100060000000000000000000000","00000001"]}}
22:22:16 MQT: sonoff-0001/stat/STATUS4 = {"StatusMEM":{"ProgramSize":503,"Free":500,"Heap":14,"ProgramFlashSize":1024,"FlashSize":4096,"FlashChipId":"1640E0","FlashMode":3,"Features":["00000809","0FDAE396","001783A0","22B617CD","01003BC0"]}}
22:22:16 MQT: sonoff-0001/stat/STATUS5 = {"StatusNET":{"Hostname":"sonoff-0001-1116","IPAddress":"192.168.1.81","Gateway":"192.168.1.1","Subnetmask":"255.255.255.0","DNSServer":"192.168.1.1","Mac":"5C:CF:7F:B4:A4:5C","Webserver":2,"WifiConfig":3}}
22:22:16 MQT: sonoff-0001/stat/STATUS6 = {"StatusMQT":{"MqttHost":"openhabianpi.lan2","MqttPort":1883,"MqttClientMask":"SO0001_%06X","MqttClient":"SO0001_B4A45C","MqttUser":"xxxx","MqttCount":15,"MAX_PACKET_SIZE":1000,"KEEPALIVE":30}}
22:22:16 MQT: sonoff-0001/stat/STATUS7 = {"StatusTIM":{"UTC":"Sat Jan 18 21:22:16 2020","Local":"Sat Jan 18 22:22:16 2020","StartDST":"Sun Mar 29 02:00:00 2020","EndDST":"Sun Oct 25 03:00:00 2020","Timezone":"+01:00","Sunrise":"08:36","Sunset":"17:24"}}
22:22:16 MQT: sonoff-0001/stat/STATUS9 = {"StatusPTH":{"PowerDelta":80,"PowerLow":0,"PowerHigh":0,"VoltageLow":0,"VoltageHigh":0,"CurrentLow":0,"CurrentHigh":0}}
22:22:16 MQT: sonoff-0001/stat/STATUS10 = {"StatusSNS":{"Time":"2020-01-18T22:22:16","ENERGY":{"TotalStartTime":"2019-01-25T18:16:46","Total":254.146,"Yesterday":0.315,"Today":0.305,"Power":26,"ApparentPower":40,"ReactivePower":31,"Factor":0.65,"Voltage":228,"Current":0.176}}}
22:22:16 MQT: sonoff-0001/stat/STATUS11 = {"StatusSTS":{"Time":"2020-01-18T22:22:16","Uptime":"4T23:36:08","Heap":14,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":19,"POWER":"ON","Wifi":{"AP":1,"SSId":"home-wlan","BSSId":"84:16:F9:6C:64:04","Channel":13,"RSSI":42,"LinkCount":1,"Downtime":"0T00:00:06"}}}

TLDR: all items get updated but my PowerSwitch won´t. I believe that i covered all mqtt topics. But i cannot find the reason.

I searched the forums but i could not find the solution. I am literally on the end of my knowledge here. my logfile is pretty clean except for the mentioned warning.

Hopefully you can help me here out.

best regards and thanks in advance
habpower

That one’s rubbish, there are no such parameters in the MQTT channel binding config docs.

Same/.

That one is rubbish because you canno specify the same parameter twice. I don’t know which one ends up active, but only one.
If you want to use multiple transformations this way, the MQTT binding is one of few that will allow it. See chaining in the docs.

This one is rubbish because you can’t just throw multiple stateTopic parameters in. Again, only one will stick.

Where you might have the “same” data arriving in multiple topics, you can create a channel for each topic and link multiple channels to one Item.

Go slow, pick one topic you know gets sent, get the whole payload into a String, looks good? Then develop your JSONPATH to select the bit you want, look good? Now develop the on/off mapping for a Switch Item.
You can run all those channels in parallel to test Items, and clean up afterwards.

thank you! i was not aware about the fact that multiple stateTopics are not allowed. I guess that i just migrated that from my old mqttv1 configuration. Hopefully all of the other items worked even after the migration. But i could not get it done

With your tips in mind i tryed the simplest configuration:

item:
Switch Sonoff0001_PowerSwitch "Power Switch" <switch> (gSonoffSw0001, gTasmotaSwitchesAll) { channel="mqtt:topic:sonoff0001_thing:PowerSwitch" }

thing:
Type switch : PowerSwitch "Power Switch" [ stateTopic="sonoff-0001/stat/STATUS", transformationPattern="JSONPATH:$.Status.Power", commandTopic="sonoff-0001/cmnd/POWER"]

log openhab (same warning):
2020-01-19 13:32:46.698 [WARN ] [ab.binding.mqtt.generic.ChannelState] - Command ‘{“Status”:{“Module”:6,“FriendlyName”:[“Sonoff0001”],“Topic”:“sonoff-0001”,“ButtonTopic”:“0”,“Power”:1,“PowerOnState”:3,“LedState”:0,“LedMask”:“FFFF”,“SaveData”:1,“SaveState”:1,“SwitchTopic”:“0”,“SwitchMode”:[0,0,0,0,0,0,0,0],“ButtonRetain”:0,“SwitchRetain”:0,“SensorRetain”:0,“PowerRetain”:0}}’ not supported by type ‘OnOffValue’: No enum constant org.eclipse.smarthome.core.library.types.OnOffType.{“Status”:{“Module”:6,“FriendlyName”:[“Sonoff0001”],“Topic”:“sonoff-0001”,“ButtonTopic”:“0”,“Power”:1,“PowerOnState”:3,“LedState”:0,“LedMask”:“FFFF”,“SaveData”:1,“SaveState”:1,“SwitchTopic”:“0”,“SwitchMode”:[0,0,0,0,0,0,0,0],“ButtonRetain”:0,“SwitchRetain”:0,“SensorRetain”:0,“PowerRetain”:0}}

log from tasmota device console:

2020-01-19 13:32:46.698 [WARN ] [ab.binding.mqtt.generic.ChannelState] - Command '{"Status":{"Module":6,"FriendlyName":["Sonoff0001"],"Topic":"sonoff-0001","ButtonTopic":"0","Power":1,"PowerOnState":3,"LedState":0,"LedMask":"FFFF","SaveData":1,"SaveState":1,"SwitchTopic":"0","SwitchMode":[0,0,0,0,0,0,0,0],"ButtonRetain":0,"SwitchRetain":0,"SensorRetain":0,"PowerRetain":0}}' not supported by type 'OnOffValue': No enum constant org.eclipse.smarthome.core.library.types.OnOffType.{"Status":{"Module":6,"FriendlyName":["Sonoff0001"],"Topic":"sonoff-0001","ButtonTopic":"0","Power":1,"PowerOnState":3,"LedState":0,"LedMask":"FFFF","SaveData":1,"SaveState":1,"SwitchTopic":"0","SwitchMode":[0,0,0,0,0,0,0,0],"ButtonRetain":0,"SwitchRetain":0,"SensorRetain":0,"PowerRetain":0}}`
log from tasmota device console:
13:32:00 MQT: sonoff-0001/stat/STATUS11 = {"StatusSTS":{"Time":"2020-01-19T13:32:00","Uptime":"5T14:45:52","Heap":14,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":19,"POWER":"ON","Wifi":{"AP":1,"SSId":"think-wlan","BSSId":"84:16:F9:6C:64:04","Channel":13,"RSSI":32,"LinkCount":1,"Downtime":"0T00:00:06"}}}
13:32:17 MQT: sonoff-0001/tele/STATE = {"Time":"2020-01-19T13:32:17","Uptime":"5T14:46:09","Heap":14,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":19,"POWER":"ON","Wifi":{"AP":1,"SSId":"think-wlan","BSSId":"84:16:F9:6C:64:04","Channel":13,"RSSI":26,"LinkCount":1,"Downtime":"0T00:00:06"}}
13:32:17 MQT: sonoff-0001/tele/SENSOR = {"Time":"2020-01-19T13:32:17","ENERGY":{"TotalStartTime":"2019-01-25T18:16:46","Total":254.360,"Yesterday":0.333,"Today":0.187,"Period":0,"Power":11,"ApparentPower":23,"ReactivePower":20,"Factor":0.50,"Voltage":229,"Current":0.100}}
13:32:47 MQT: sonoff-0001/stat/STATUS = {"Status":{"Module":6,"FriendlyName":["Sonoff0001"],"Topic":"sonoff-0001","ButtonTopic":"0","Power":1,"PowerOnState":3,"LedState":0,"LedMask":"FFFF","SaveData":1,"SaveState":1,"SwitchTopic":"0","SwitchMode":[0,0,0,0,0,0,0,0],"ButtonRetain":0,"SwitchRetain":0,"SensorRetain":0,"PowerRetain":0}}
13:32:47 MQT: sonoff-0001/stat/STATUS1 = {"StatusPRM":{"Baudrate":115200,"GroupTopic":"sonoffs","OtaUrl":"http://domus1:80/api/arduino/sonoff.ino.bin","RestartReason":"Software/System restart","Uptime":"5T14:46:39","StartupUTC":"2020-01-13T21:46:08","Sleep":50,"CfgHolder":4617,"BootCount":1615,"SaveCount":6585,"SaveAddress":"F7000"}}
13:32:47 MQT: sonoff-0001/stat/STATUS2 = {"StatusFWR":{"Version":"6.6.0(release-sonoff)","BuildDateTime":"2019-07-06T13:10:20","Boot":31,"Core":"2_3_0","SDK":"1.5.3(aec24ac9)"}}
13:32:47 MQT: sonoff-0001/stat/STATUS3 = {"StatusLOG":{"SerialLog":2,"WebLog":2,"SysLog":0,"LogHost":"domus1","LogPort":514,"SSId":["think-wlan","think-wlan2"],"TelePeriod":120,"Resolution":"558180C0","SetOption":["00000009","280500000100060000000000000000000000","00000001"]}}
13:32:47 MQT: sonoff-0001/stat/STATUS4 = {"StatusMEM":{"ProgramSize":503,"Free":500,"Heap":14,"ProgramFlashSize":1024,"FlashSize":4096,"FlashChipId":"1640E0","FlashMode":3,"Features":["00000809","0FDAE396","001783A0","22B617CD","01003BC0"]}}
13:32:47 MQT: sonoff-0001/stat/STATUS5 = {"StatusNET":{"Hostname":"sonoff-0001-1116","IPAddress":"192.168.1.81","Gateway":"192.168.1.1","Subnetmask":"255.255.255.0","DNSServer":"192.168.1.1","Mac":"5C:CF:7F:B4:A4:5C","Webserver":2,"WifiConfig":3}}
13:32:47 MQT: sonoff-0001/stat/STATUS6 = {"StatusMQT":{"MqttHost":"openhabianpi.lan2","MqttPort":1883,"MqttClientMask":"SO0001_%06X","MqttClient":"SO0001_B4A45C","MqttUser":"openhabian","MqttCount":15,"MAX_PACKET_SIZE":1000,"KEEPALIVE":30}}
13:32:47 MQT: sonoff-0001/stat/STATUS7 = {"StatusTIM":{"UTC":"Sun Jan 19 12:32:47 2020","Local":"Sun Jan 19 13:32:47 2020","StartDST":"Sun Mar 29 02:00:00 2020","EndDST":"Sun Oct 25 03:00:00 2020","Timezone":"+01:00","Sunrise":"08:35","Sunset":"17:26"}}
13:32:47 MQT: sonoff-0001/stat/STATUS9 = {"StatusPTH":{"PowerDelta":80,"PowerLow":0,"PowerHigh":0,"VoltageLow":0,"VoltageHigh":0,"CurrentLow":0,"CurrentHigh":0}}
13:32:47 MQT: sonoff-0001/stat/STATUS10 = {"StatusSNS":{"Time":"2020-01-19T13:32:47","ENERGY":{"TotalStartTime":"2019-01-25T18:16:46","Total":254.360,"Yesterday":0.333,"Today":0.187,"Power":11,"ApparentPower":24,"ReactivePower":21,"Factor":0.48,"Voltage":230,"Current":0.103}}}
13:32:47 MQT: sonoff-0001/stat/STATUS11 = {"StatusSTS":{"Time":"2020-01-19T13:32:47","Uptime":"5T14:46:39","Heap":14,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":19,"POWER":"ON","Wifi":{"AP":1,"SSId":"think-wlan","BSSId":"84:16:F9:6C:64:04","Channel":13,"RSSI":28,"LinkCount":1,"Downtime":"0T00:00:06"}}}

So you can see that according the sonoff-0001/stat/STATUS the transformationPattern=“JSONPATH:$.Status.Power” should be right.
So if it is the case that i have to somehow map ON and OFF accordingly i do not know how. And i guess the warning “not supported by type ‘OnOffValue’: No enum constant” suggests i should do that somehow.

Can you help me out please?

Thank you for your help

You can prove that by using the same topic and transformation for a string channel, linking to a test String Item, where you would expect “1” to appear.

If that works, the next step would be transforming 1 into ON. The on= off= params should make that easy, but only if they are applied after the JSONPATH. It’s not clear to me what order this binding manages its multiple transforms in.

Thanks! I gave that a try too… and believe me… i´ve gone through hell…

it looked out of the box like this:

And guess what with the next button presses everything went also in sync.

what i did was recreating the items and things. and by doing that something must have refreshed in the background and it worked. So i did not change from my last configuration and it works.

Thank you! now its in sync.

Must have somehing to do with the java garbage collection?!

Most bindings are not so clever about refreshing any minor edits where you’re using Things files. Generally,the binding can be restarted to ensure it reads new configurations.