2017-04-03 20:51:49 +02:00
|
|
|
node-red-node-discovery
|
|
|
|
=======================
|
2015-03-04 20:55:53 +01:00
|
|
|
|
|
|
|
A <a href="http://nodered.org" target="_new">Node-RED</a> node that uses Bonjour
|
|
|
|
/ Avahi to discover local network services such as iTunes libraries, printers, etc.
|
|
|
|
|
2020-02-04 20:09:53 +01:00
|
|
|
It also supports announcing new services.
|
2015-05-08 21:57:15 +02:00
|
|
|
|
2015-03-04 20:55:53 +01:00
|
|
|
Prerequisites
|
|
|
|
-------------
|
|
|
|
|
|
|
|
please read the [install instructions](https://www.npmjs.com/package/mdns) for the underlying npm.
|
|
|
|
|
|
|
|
For Debian / Ubuntu this requires installing
|
|
|
|
|
2020-02-04 20:09:53 +01:00
|
|
|
sudo apt-get install libavahi-compat-libdnssd-dev libudev-dev
|
2015-03-04 20:55:53 +01:00
|
|
|
|
|
|
|
Install
|
|
|
|
-------
|
|
|
|
|
2016-03-02 14:26:19 +01:00
|
|
|
Run the following command in your Node-RED user directory - typically `~/.node-red`
|
2015-03-04 20:55:53 +01:00
|
|
|
|
2016-03-02 14:26:19 +01:00
|
|
|
npm i node-red-node-discovery
|
2015-03-04 20:55:53 +01:00
|
|
|
|
|
|
|
Usage
|
|
|
|
-----
|
|
|
|
|
2015-05-08 21:57:15 +02:00
|
|
|
### Discovery
|
|
|
|
|
2016-03-02 14:26:19 +01:00
|
|
|
Uses an implementation of mdns to provide a Bonjour / Avahi
|
2015-03-04 20:55:53 +01:00
|
|
|
service discovery capability.
|
|
|
|
|
2016-03-02 14:26:19 +01:00
|
|
|
`msg.payload` contains the service object on both arrival and leaving.
|
2015-03-04 20:55:53 +01:00
|
|
|
|
2017-11-23 21:53:44 +01:00
|
|
|
`msg.payload.state` contains boolean true or false depending if the service has arrived (true) or gone away (false)..
|
2015-03-04 20:55:53 +01:00
|
|
|
|
2016-03-02 14:26:19 +01:00
|
|
|
Within the `msg.payload` object the most interesting things are:
|
2015-03-04 20:55:53 +01:00
|
|
|
|
|
|
|
* msg.payload.name
|
|
|
|
* msg.payload.interface
|
|
|
|
* msg.payload.port
|
|
|
|
* msg.payload.addresses
|
|
|
|
* msg.payload.txtRecord
|
|
|
|
|
|
|
|
For a full list of official service types see [this list](http://www.dns-sd.org/ServiceTypes.html" target="_new).
|
|
|
|
|
2016-03-02 14:26:19 +01:00
|
|
|
### Announce
|
2015-05-08 21:57:15 +02:00
|
|
|
|
|
|
|
Provides a Bonjour / Avahi / Zeroconf announcement node.
|
|
|
|
|
2017-11-23 21:53:44 +01:00
|
|
|
If `msg.payload` is `false` - the announcement is stopped. Any other value starts the announcement process.
|
2015-05-08 21:57:15 +02:00
|
|
|
|
|
|
|
The announcement can be customised by the msg if not configured in the edit panel.
|
|
|
|
|
2016-03-02 14:26:19 +01:00
|
|
|
- `msg.service` - For a full list of official service types see <a href="http://www.dns-sd.org/ServiceTypes.html" target="_new">this list</a>.
|
|
|
|
- `msg.port` - the tcp or udp port to use.
|
|
|
|
- `msg.name` - the short description name of the service. If you use %h in the name, it will be replaced by the machine hostname.
|
|
|
|
- `msg.txtRecord` - a set of comma separated name:value pairs
|
2015-05-08 21:57:15 +02:00
|
|
|
|
2016-03-02 14:26:19 +01:00
|
|
|
### Note:
|
2015-05-08 21:57:15 +02:00
|
|
|
|
2016-03-02 14:26:19 +01:00
|
|
|
When Node-RED starts you will get a big WARNING message about the Bonjour Compatibility layer... this is just a warning so don't worry.
|