Custom Widget: original switch style with RSSI and online status

I don’t have much coding skill, please spare me if it’s with bug or not good enough, please feel free to optimize it and share your version.

I don’t like separate items/line to indicate device is online or not, I always wish OH2 can have it combine, as sonoff / MQTT have very easy to bind with OH2 with RSSI and LWT status, so I modify it and make it similar to original switch.

RSSI still remain last status when offline unless you set rules
backdrop icon may select by manually entry with name

eg:
Backdrop Icon Set: freepik-household
Backdrop Icon Name: lamp-4.svg

items need 3

Switch LivingRoom_Light “Living Room Light” (LR,gLight) { mqtt=">[broker:cmnd/sonoff-A00F9D/power:command:*:default],<[broker:stat/sonoff-A00F9D/POWER:state:default]" }

Number LivingRoom_Light_RSSI “Living Room Light: RSSI [%d %%]” (gRSSI) { mqtt="<[broker:tele/sonoff-A00F9D/STATE:state:JSONPATH($.Wifi.RSSI)]" }

Switch LivingRoom_Light_Unreach “Living Room Light: unreachable” (gUnreach) { mqtt="<[broker:tele/sonoff-A00F9D/LWT:state:default" }

sonoff.widget.json (2.7 KB)

P.S. code were start with someone’s share and modify to widget version :grinning:

3 Likes