contextStorage - cflurin/node-red-contrib-dsm GitHub Wiki

Version 0.10.0 and higher supports contextStorage which has been introduced with node-red version 0.19.0.

First define the dsm configuration once using e.g. an inject node.

The configuration is stored in the context and if the contextStorage is defined (in the settings.js) it will be stored accordantly. The next time you start node-red the dsm will read the configuration from the contextStorage.

contextstorage

Flow

[{"id":"72575040.6fde","type":"debug","z":"57ef434a.058a6c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","x":410,"y":1780,"wires":[]},{"id":"1a6e9628.f41d2a","type":"inject","z":"57ef434a.058a6c","name":"open","topic":"open","payload":"open","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":90,"y":1740,"wires":["e2df41dc.b5869"](/cflurin/node-red-contrib-dsm/wiki/"e2df41dc.b5869")},{"id":"103c4725.0c1029","type":"inject","z":"57ef434a.058a6c","name":"close","topic":"close","payload":"close","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":90,"y":1780,"wires":["e2df41dc.b5869"](/cflurin/node-red-contrib-dsm/wiki/"e2df41dc.b5869")},{"id":"e2df41dc.b5869","type":"dsm","z":"57ef434a.058a6c","name":"door","sm_config":"","x":250,"y":1780,"wires":["72575040.6fde"](/cflurin/node-red-contrib-dsm/wiki/"72575040.6fde")},{"id":"dc403762.7cc598","type":"inject","z":"57ef434a.058a6c","name":"stop","topic":"stop","payload":"stop","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":90,"y":1820,"wires":["e2df41dc.b5869"](/cflurin/node-red-contrib-dsm/wiki/"e2df41dc.b5869")},{"id":"6b1e5329.02c86c","type":"inject","z":"57ef434a.058a6c","name":"set","topic":"set","payload":"{\"currentState\":\"closed\",\"states\":{\"opened\":{\"close\":\"closed\",\"stop\":\"stopped\"},\"closed\":{\"open\":\"opened\",\"stop\":\"stopped\"},\"stopped\":{\"open\":\"opened\",\"close\":\"closed\"}}}","payloadType":"json","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":90,"y":1680,"wires":["e2df41dc.b5869"](/cflurin/node-red-contrib-dsm/wiki/"e2df41dc.b5869")}]