This is a
playground to test code. It runs a full
Node.js environment and already has all of
npm’s 400,000 packages pre-installed, including
node-red-contrib-mysensors with all
npm packages installed. Try it out:
node-red-contrib-mysensors lists no main file and has no index.js, so it can't be directly required. If this is a mistake, please let us know. It may however contain internal files that you can require manually:
This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.
A node-RED mysensors protocol decoder / encoder / wrapper package, including basic controller functionality Contains a node to decode / encode mysensors serial protocol to / from node-red messages, and a node for adding mysensors specific data like sensor type, nodeid etc. which can then be sent to mysensors network
Please note, that you probably need to have node 6 and above for version 2.1 and above (I got reports of problems with node v4).
Within your local installation of Node-RED run:
npm install node-red-contrib-mysensors
Once installed, restart your node-red server, and you will have a set of new nodes available in your palette under mysensors:
This decodes the mysensors serial protocol packages or a MQTT topic from a mysensors MQTT gateway, and enriches the Node-RED msg object with the following extra data:
msg.payload // Payload data from sensor network msg.nodeId // node of the origin msg.childSensorId msg.messageType msg.ack msg.subType msg.messageTypeStr msg.subTypeStr
The last two parameters are text representations for message type and sub type. No other mysensros node is actively using these values.
see mysensors API v2.x for more info on the different parts
The following nodes will be able to use these properties to interact with the messages from the mysensors network
This encodes a message into either mysensors serial, or a mysensors mqtt topic.
If using MQTT, then set topicRoot on the message, before sending it into this node, in order to set your own root topic, or set it in the node to set the topicRoot like
This will add the message properties mentioned under mysdecenc to the message object of an existing Node-RED message. By sending the output through mysencode, you can create a message that can be sent to your sensor network, or sent to another controller that understands MySensors serial protocol or MQTT topic format.
If you want to send it to another controller as a serial port format, use socat for creating a dummy serial port (on linux):
socat PTY,link=/dev/ttyS80,mode=666,group=dialout,raw PTY,link=/dev/ttyUSB20,mode=666,group=dialout,raw &
/dev/ttyS80 in a serial port node in node-red, and use
/dev/ttyUSB20 in your chosen controller.
This will decode the mysensors serial protocol payload, and enrich it with descriptions of sensor types etc. Meant as a debugging tool. Data will be sent out of the node, and can be used in a debug node, or dumped to disk, for file logging
This node can handle ID assignment to nodes on your network. Will respond with a new ID everytime it sees a request for an ID from a node. You need to define a database location, which should be a path to a writable location/file in your filesystem. The node will create the file pointed to, and create the needed tables using sqlite3 format.
The controller keeps track of when it hears the nodes, sketch name / version reported during presentation etc. and will be shown when you look at the configuration page of the node.