npm

Does your artifact manager get in the way? Join us on Oct. 8 at 10am PT, to discuss how npm can help.Sign up »

node-red-contrib-mysensors

3.3.0 • Public • Published

node-red-contrib-mysensors

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

Install

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:

Node-RED mysdecode

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

Node-RED mysencode

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

topicRoot/nodeId/childSensorId/ack/subType

Node-RED mysencap

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 &

Now use /dev/ttyS80 in a serial port node in node-red, and use /dev/ttyUSB20 in your chosen controller.

Node-RED mysdebug

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

Node-RED myscontroller

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.

install

npm i node-red-contrib-mysensors

Downloadsweekly downloads

19

version

3.3.0

license

GPL-2.0

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability