Page 1 of 1

Using node red with MQTT-AD

Posted: Sunday 03 November 2024 10:26
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

Re: Using node red with MQTT-AD

Posted: Thursday 14 November 2024 18:04
by sincze
Tnx for sharing ;-) I can work with that ;-)