Sonoff - Wifi signal % on sitemap, cant get it to work


Forgive me, i searched and followed some topics on similar issues but still cant seem to get my sonoff wifi signal to show up on my sitemap.

  • openhab 2
  • raspberry pi 3
  • sonoff basic running Tasmota 5.14
  • mqtt setup and running ok
  • json installed
  • map installed

if i open up mqqt.fx app i see the sonoff sending data ok to broker:



Switch Bedside_Lamp "Bedside Lamp" <light>
    { mqtt=">[broker:cmnd/bedside_lamp/power:command:*:default],
            <[broker:stat/bedside_lamp/POWER:state:default]" }

Switch Alive "Bedside lamp accessible"
{ mqtt="<[broker:tele/bedside_lamp/LWT:state:MAP(]" }

Number Wifi "Wifi Signal [%d %%]" 
    { mqtt="<[broker:tele/bedside_lamp/STATE:state:JSONPATH($.Wifi.RSSI)]" } 

String Mqtt "Bedside lamp: [%s]"
{ mqtt="<[broker:tele/bedside_lamp/INFO1:state:default],
        <[broker:stat/bedside_lamp/RESULT:state:default]" }  


     Frame label="Bedside Lamp"
   Switch item=Bedside_Lamp
   Switch item=Alive
   Text item=Wifi
   Text item=Mqtt

And yet in my sitemap it is only showing a placeholder?

It feels like the sonoff or the json isnt working, but as a newbie i am sure i am missing something here?

Is the JSONPATH transform installed?

1 Like

What do you get if you use

String Wifi "Wifi Signal [%s]" { mqtt="<[broker:tele/bedside_lamp/STATE:state:JSONPATH($.Wifi.RSSI)]" }
1 Like

Yes as OP, Json is installed :ok_hand:

No change with string…

My set-up:

Number LivingRoom_AquariumPump_RSSI "Living Room Aquarium Pump: RSSI [%d %%]" (gRSSI, Persist) { mqtt="<[mybroker:tele/LivingRoom_AquariumPump/STATE:state:JSONPATH($.Wifi.RSSI)]" }

Similar to yours
What does your logs say? event.log AND openhab.log?
Also do you get an error when saving the items file?

If your sonoff is sending data to the broker then nothing wrong with sonoff
Your items are getting updated which points to an error with your mqtt binding

What is your mqtt.cfg?
You showed the data from the sonoff but not the topic, can you show that as well, please?



Just trying to find logs for you, i see in browser log viewer no errors

Its not my topics is it?

==> /var/log/openhab2/openhab.log <==
2018-07-30 16:06:52.952 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'home.sitemap'
2018-07-30 16:06:53.355 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'home.things'
2018-07-30 16:06:53.362 [WARN ] [el.core.internal.ModelRepositoryImpl] - Configuration model 'home.things' is either empty or cannot be parsed correctly!
2018-07-30 16:06:55.739 [INFO ] [] - MQTT Service initialization completed.
2018-07-30 16:06:55.742 [INFO ] [t.mqtt.internal.MqttBrokerConnection] - Starting MQTT broker connection 'broker'
2018-07-30 16:06:56.462 [INFO ] [basic.internal.servlet.WebAppServlet] - Started Basic UI at /basicui/app
2018-07-30 16:06:56.924 [INFO ] [assic.internal.servlet.WebAppServlet] - Started Classic UI at /classicui/app
2018-07-30 16:06:57.044 [INFO ] [arthome.ui.paper.internal.PaperUIApp] - Started Paper UI at /paperui
2018-07-30 16:06:57.218 [INFO ] [ui.habmin.internal.servlet.HABminApp] - Started HABmin servlet at /habmin
2018-07-30 16:06:57.329 [INFO ] [panel.internal.HABPanelDashboardTile] - Started HABPanel at /habpanel

==> /var/log/openhab2/events.log <==
2018-07-30 16:07:42.183 [ome.event.ItemCommandEvent] - Item 'Standard_Lamp' received command ON
2018-07-30 16:07:42.196 [vent.ItemStateChangedEvent] - Standard_Lamp changed from OFF to ON
2018-07-30 16:07:42.807 [ome.event.ItemCommandEvent] - Item 'Standard_Lamp' received command OFF
2018-07-30 16:07:42.821 [vent.ItemStateChangedEvent] - Standard_Lamp changed from ON to OFF
2018-07-30 16:07:43.785 [ome.event.ItemCommandEvent] - Item 'Bedside_Lamp' received command ON
2018-07-30 16:07:43.793 [vent.ItemStateChangedEvent] - Bedside_Lamp changed from NULL to ON
2018-07-30 16:07:43.901 [vent.ItemStateChangedEvent] - Mqtt changed from NULL to {"POWER":"ON"}
2018-07-30 16:07:44.498 [ome.event.ItemCommandEvent] - Item 'Bedside_Lamp' received command OFF
2018-07-30 16:07:44.524 [vent.ItemStateChangedEvent] - Bedside_Lamp changed from ON to OFF
2018-07-30 16:07:44.580 [vent.ItemStateChangedEvent] - Mqtt changed from {"POWER":"ON"} to {"POWER":"OFF"}

Trying find best way to open logs?
They not in Samba in windows, the above is from SSH

Looking at broker in mqtt.fx do my topics look right?
Sorry just learning MQTT as i go (yes read the guides, but getting head around it) and i notice some of the topics created show “bedside” and others as “bedside_lamp”

Number Wifi "Wifi Signal [%d %%]" 
    { mqtt="<[broker:tele/home/firstfloor/bedroom/bedside/STATE:state:JSONPATH($.Wifi.RSSI)]" } 

I tried that myself earlier, no joy still

In mqtt.cfg set retain as false
You don’t really need that

In the sonoff config set your topic back to default:

And use what comes out in mqtt.fx

1 Like

Im getting more confused to be honest, it looks to me i followed all tutorials right but it just doesn’t work. Like the JSON transformation isnt working, but i uninstalled and reinstalled it etc. still nothing

The second i typed that and it just started working !
Hmm, now to diagnose the issue with topics i guess

Change the topic to bedside_lamp
Keep it simple for now and change it later once you get it working

Thanks i will do, one issue thats confusing me still…
We changed retain to false, yet mqtt.fx is still showing retained messages, rebooted 2-3 times but still pile of retained messages?