MQTT / NodeRed help with NSPanel and Tasmota

1,028 views
Skip to first unread message

jonrus...@googlemail.com

unread,
Sep 15, 2022, 7:43:55 PM9/15/22
to TasmotaUsers
Hi.
I've bought a Sonoff NSPanel and successfully flashed it with Tasmota.
I'm trying to understand how the interface works.
I edited the nspanel.be to understand how it works, and changed the first widget group to "Lamp". I want to link that widget on the NSPanel to a lamp in my lounge on a Sonoff S20 running Tasmota (topic cmnd/basica/POWER). So, when I toggle the widget on the panel, the lamp toggles.

When I toggle the widget on the NSPanel I get :

23:51:22.811 MQT: tele/nspanel/RESULT = {"NSPanel":{"ctype":"group","id":"1","params":{"switch":"on","switches":[{"switch":"on","outlet":0}]}}}
23:51:44.011 MQT: tele/nspanel/RESULT = {"NSPanel":{"ctype":"group","id":"1","params":{"switch":"off","switches":[{"switch":"off","outlet":0}]}}}

What is the best way to link this to the lamp via MQTT? I assume two options; a berry script on the NSPanel or a flow in NodeRed?

How do I easily decode the "RESULT" message in NodeRed? Is the best way to write a function?

This works, but I dont think its the right way?

nsp = msg.payload["NSPanel"]
p = msg.payload["NSPanel"].params
node.warn(nsp);
node.warn(p);

if(nsp.ctype=="group"){
    if(nsp.id==1){
        node.warn("G1");
        msg.topic="cmnd/basica/POWER"
        node.warn(p.switch)
        if(p.switch=="on"){
            msg.payload="ON"
        }
        if(p.switch=="off"){
            msg.payload="OFF"
        }
    }
}
return msg;

Any pointers gratefully received. 

Thanks

Jon.

Philip Knowles

unread,
Sep 16, 2022, 3:42:35 AM9/16/22
to jonrus...@googlemail.com, TasmotaUsers

There’s some help here

gerard33/nspanel-lovelance-ui: Custom HMI for NsPanel with the design of HomeAssistant's lovelance in mind, works with Tasmota. (github.com)

 

I’m running mine using openHAB using these instructions

 

NSPanel-setup/OpenHAB3 and Sonoff NSPanel v2.9.pdf at main · alfpf/NSPanel-setup (github.com)

 

There are some minor errors but it might give an idea of how to get it to work in node-red.

 

Sent from Mail for Windows

--
You received this message because you are subscribed to the Google Groups "TasmotaUsers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sonoffusers...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/sonoffusers/9aae0d1e-d6d6-4c4d-a862-fef06f9e520an%40googlegroups.com.

 

jonrus...@googlemail.com

unread,
Sep 16, 2022, 5:07:56 PM9/16/22
to TasmotaUsers
Very helpful.
Thanks.

Steep learning curve :-)

Regards,

Jon.
Reply all
Reply to author
Forward
0 new messages