How to store device(Sonoff,s) status in database using node-red?

I install mosquitto on my pi and then use OpenHab in the Sonoff 'Controlers' Protocol.
If you look at the thread Coffee pot timer you will see how I set the controler on a SonOff S20 switch. That and the flow should get you pointed in the right direction.