Using node red with MQTT-AD

For devices supporting the Auto Discovery feature. Like ZWaveJS2MQTT, Zigbee2MQTT.

Moderator: leecollings

Post Reply
User avatar
heggink
Posts: 972
Joined: Tuesday 08 September 2015 21:44
Target OS: Raspberry Pi / ODroid
Domoticz version: 12451
Location: NL
Contact:

Using node red with MQTT-AD

Post by heggink »

From node-red, you can send AD messages to domoticz, listen on mqtt for commands as well as return any message back to domoticz. The beauty of node-red is that there are many integrations readily available (tuya local API, Shell charge station API, BMW car API, the list is endless) making it really easy to integrate asynchronously with domoticz and, with that, not locking domoticz whilst these updates are happening.

I originally worked with basic mqtt integration until Rob (gizmocuz) gave me some help on the scripting for our Victron based home battery builds and decided to base everything on AD. Since then, that has been the basis for any integration I do with node red.

The principle is quite simple:
  • the startup function defines all the devices as well as sends all the AD messages
  • the domo mqtt ad flow processes all these and sends them to mqtt
  • in your flows, you can listen for any command for any device and act in any way you want but remember to report back the result as, otherwise, domoticz won't see the change
As an example, I integrated the tuya local API so I don't have to interface with any cloud service and can control devices wether or not I have an internet connection.

I have put some examples of my integrations on https://github.com/heggink/domo-nodered. Clearly, you need to install the underlying integrations in node red (menu->manage palette->Install e.g. node-red-contrib-tuya-smart-device, node-red-contrib-car-bmw, similar for the shell new motion API).

Some of these scripts can probably be improved and optimised although I am completely out of bandwidth to do that ATM. Suggestions are welcome as are questions.

H
Docker in Truenas scale, close to latest beta
DASHTICZ 🙃
RFXCOM, zwavejs2mqtt, zigbee2mqtt,
P1 meter & solar panel
Google home, Wifi Cams motion detection
Geofence iCloud, Bluetooth & Wifi ping
Harmony hub, Nest, lots more :-)
User avatar
sincze
Posts: 1299
Joined: Monday 02 June 2014 22:46
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.4
Location: Netherlands / Breda Area
Contact:

Re: Using node red with MQTT-AD

Post by sincze »

Tnx for sharing ;-) I can work with that ;-)
Pass2php
LAN: RFLink, P1, OTGW, MySensors
USB: RFXCom, ZWave, Sonoff 3
MQTT: ZIgbee2MQTT,
ZWAVE: Zwave-JS-UI
WIFI: Mi-light, Tasmota, Xiaomi Shelly
Solar: Omnik, PVOutput
Video: Kodi, Harmony HUB, Chromecast
Sensors: You name it I got 1.
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests