[SOLVED] Paperui doesnt detect power switch status

hi all.
i configure my sonoff pow via config files. i can success to run what i want. but my device while power on, paperui show power off or vice versa. please help me. here it is my config files:


Bridge mqtt:broker:merkez "MQTT Broker Merkez" [ host="", secure=false] {
  Thing topic pow185 "POW 185" {
      Type string : reachable "Durum"                 [ stateTopic="tele/pow185/LWT" ]
      Type switch : power     "Güç durumu"            [ stateTopic="stat/pow185/POWER",  commandTopic="cmnd/pow185/POWER", on="ON", off="OFF"]
      Type number : powerload "Güç"                   [ stateTopic="tele/pow185/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Power"]
      Type number : voltage   "Voltaj"                [ stateTopic="tele/pow185/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Voltage"]
      Type number : current   "Akım"                  [ stateTopic="tele/pow185/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Current"]
      Type number : today     "Bugünkü toplam enerji" [ stateTopic="tele/pow185/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Today"]
      Type number : yesterday "Dünkü toplam enerji"   [ stateTopic="tele/pow185/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Yesterday"]
      Type number : total     "Toplam Enerji"         [ stateTopic="tele/pow185/SENSOR", transformationPattern="JSONPATH:$.ENERGY.Total"]


Group pow185grp "POW 185"

String pow185_Reachable "Durum"                            (pow185grp) { channel="mqtt:topic:merkez:pow185:reachable" }
Switch pow185_Power     "Güç durumu"                       (pow185grp) { channel="mqtt:topic:merkez:pow185:power" }
Number pow185_Load      "Güç [%.1f W]"                     (pow185grp) { channel="mqtt:topic:merkez:pow185:powerload" }
Number pow185_Voltage   "Voltaj [%.1f V]"                  (pow185grp) { channel="mqtt:topic:merkez:pow185:voltage" }
Number pow185_Current   "Akım [%.3f A]"                    (pow185grp) { channel="mqtt:topic:merkez:pow185:current" }
Number pow185_Today     "Bugünkü toplam enerji [%.3f kWh]" (pow185grp) { channel="mqtt:topic:merkez:pow185:today" }
Number pow185_Yesterday "Dünkü toplam enerji [%.3f kWh]"   (pow185grp) { channel="mqtt:topic:merkez:pow185:yesterday" }
Number pow185_Total     "Toplam Enerji  [%.3f kWh]"        (pow185grp) { channel="mqtt:topic:merkez:pow185:total" }

Not all devices report status well.

So what is displayed in Paper UI is working, it just shows the opposite state as expected - off for on and on for off correct?
Well… don’t worry about it, Paper UI is only really useful for discovering things and making sure they are functioning which yours seems to be
Now, whatever user interface you plan to use may need a little extra configuration to show the ‘correct’ state such as a map or some such. Do you use a user interface? if so which?

no not exactly opposite. device is power on actually but paperui shown as power off at first run. when i clicked power button on but no change on device. another click and device is poer off. and everthing is going on the way

OK well like I said, Paper user interface isn’t really a user interface, it is more of an administrative interface. It is broken in a couple small ways and is abandoned and unmaintained. So the question becomes, does your device work and just not work in paper ui or is the device really not working? Since it runs mqtt, maybe a good way to figure out our answer would be to get something like mqtt.fx running and send some commands using that and see if the device is working

link to download

Are you sure this is not a persistence issue? When OH is first started it does not know the status of anything without some sort of persistence set up.

Please show us your events.log for this

here it is:

2019-09-22 08:25:55.538 [ome.event.ItemCommandEvent] - Item 'pow185_Power' received command ON
2019-09-22 08:25:55.543 [nt.ItemStatePredictedEvent] - pow185_Power predicted to become ON
2019-09-22 08:25:55.549 [vent.ItemStateChangedEvent] - pow185_Power changed from NULL to ON
2019-09-22 08:26:09.548 [ome.event.ItemCommandEvent] - Item 'pow185_Power' received command OFF
2019-09-22 08:26:09.553 [nt.ItemStatePredictedEvent] - pow185_Power predicted to become OFF
2019-09-22 08:26:09.555 [vent.ItemStateChangedEvent] - pow185_Power changed from ON to OFF
2019-09-22 08:26:11.348 [ome.event.ItemCommandEvent] - Item 'pow185_Power' received command ON
2019-09-22 08:26:11.350 [nt.ItemStatePredictedEvent] - pow185_Power predicted to become ON
2019-09-22 08:26:11.353 [vent.ItemStateChangedEvent] - pow185_Power changed from OFF to ON

When receiving this log the switch was powered on but the paperui also showed the power off. then i click and power on in paperui but nothing on the device. then click again both of them power off, click again and both of them power on.

That log tells you that openHAB started with an unknown state for this item (it was NULL).
PaperUI showed that as OFF.
If you would use the StateTopic “tele/pow185/POWER”,the item would be updated with the actual state after each receiving the frequently sent tele message.

1 Like

tele or stat?

The stat topic will be sent after each change of the state, the tele topic is sent regularly. Monitor the console of the sonoff device, you will see those messages. You can also set the time-intervall for those messages

i dont know what happend but working correctly now. just electricity gone and come back. after that paperui show correctly switch status. i also start to learn sitemap for basic ui:

1 Like

i found problem. i think the problem is from my sonoff pow or from its firmware. switch status has stopped working again. when i restarted the device, switch status returned to normal.