node-red-contrib-simple-gate
Advanced tools
Comparing version 0.2.3 to 0.2.4
@@ -31,6 +31,6 @@ /** | ||
// Save "this" object | ||
var node = this | ||
var node = this; | ||
var context = node.context(); | ||
var persist = node.persist; | ||
var state = context.get('state'); //debug | ||
var state = context.get('state'); | ||
if (!persist || typeof state === 'undefined') { | ||
@@ -40,3 +40,3 @@ state = node.defaultState; | ||
context.set('state',state); | ||
// Show status | ||
// Initialize status display | ||
status = (state === 'open') ? openStatus:closedStatus; | ||
@@ -48,3 +48,3 @@ node.status(status); | ||
// Change state | ||
if (msg.topic !== undefined && msg.topic.toLowerCase() === node.controlTopic) { | ||
if (typeof msg.topic === 'string' && msg.topic.toLowerCase() === node.controlTopic) { | ||
if (typeof msg.payload != 'string'){ | ||
@@ -51,0 +51,0 @@ node.error('Command must be a string'); |
{ | ||
"name" : "node-red-contrib-simple-gate", | ||
"version" : "0.2.3", | ||
"version" : "0.2.4", | ||
"description" : "A gate node for node-RED", | ||
@@ -5,0 +5,0 @@ "license" : "Apache-2.0", |
@@ -6,3 +6,3 @@ # node-red-contrib-simple-gate | ||
Either use the Manage Palette selection in the Node-RED Editor menu, or run the following command in your Node-RED user directory (typically `~/.node-red`): | ||
Use the Node-RED `Manage Palette` command or run the following in your Node-RED user directory (typically `~/.node-red`): | ||
@@ -25,3 +25,3 @@ npm install node-red-contrib-simple-gate | ||
## State persistence | ||
## State persistence (since version 0.2.0) | ||
By default, the node enters the `Default State` on startup, either when first deployed in the editor, re-deployed as part of a modified flow or entire workspace, or when Node-RED is restarted by the user or by a system service. The user can, however, select the `Restore from saved state` option (checkbox) in the edit dialog. Then, if a persistent form of context storage has been enabled in the Node-RED `settings.js` file, the node will attempt to enter the state last saved in the node context and will use the `Default State` only if no saved state is available. | ||
@@ -28,0 +28,0 @@ |
Sorry, the diff of this file is not supported yet
245781