Page 1 of 1

Using mqtt auto discovery (or mqtt in general) to integrate devices from Home Assistant?

Posted: Wednesday 26 October 2022 15:52
by Nautilus
Hi,

in the past there's been intermittent discussion about integrating items between Domoticz and Home assistant and while it is not ideal, in some cases where HA component is already available, it might be easiest to just integrate it from HA to Domoticz. I've been using the REST APIs in few cases like this, but typically it requires a lot of manual work.

Has anyone thought of a way to build a more stable (and device type agnostic, hopefully two-way) integration between these two platforms utilizing mqtt? I've seen some attempts from the past discussions (mostly from Domoticz to HA though, e.g. https://community.home-assistant.io/t/h ... oticz/8375), but maybe the currently available auto discovery would help in this?

Or have you come across any other way to achieve this?

Re: Using mqtt auto discovery (or mqtt in general) to integrate devices from Home Assistant?

Posted: Thursday 27 October 2022 18:55
by mjray
Is there any down side to letting domoticz also get the mqtt messages that Home Assistant gets and letting domoticz create duplicate controls from them? If either HA or Dz send a command over mqtt, the device will send a status update in response, changing (for example), the switch display on both.

But I guess that only handles devices doing autodiscovery MQTT themselves, so you'd still need to connect up the devices with a plugin for only one system or the other.

To answer the main question: I'm not running HA so not something I'm working on or come across, no.

Re: Using mqtt auto discovery (or mqtt in general) to integrate devices from Home Assistant?

Posted: Friday 28 October 2022 10:25
by waltervl
If Home-Assistant sends/receives MQTT HA-Autodiscover messages than intergration should be easy as Domoticz supports it (for some device types). So this would be an HA-issue.
On the other side, I do not see the use case to run Domoticz and Home-Assistant next to each other, it is like putting 2 fuel engines in 1 car.

Re: Using mqtt auto discovery (or mqtt in general) to integrate devices from Home Assistant?

Posted: Monday 07 November 2022 10:10
by Nautilus
mjray wrote: Thursday 27 October 2022 18:55 Is there any down side to letting domoticz also get the mqtt messages that Home Assistant gets and letting domoticz create duplicate controls from them? If either HA or Dz send a command over mqtt, the device will send a status update in response, changing (for example), the switch display on both.

But I guess that only handles devices doing autodiscovery MQTT themselves, so you'd still need to connect up the devices with a plugin for only one system or the other.

To answer the main question: I'm not running HA so not something I'm working on or come across, no.
With the autodiscovery, devices work in both systems (show correct status, can be controlled) just fine. At least in the scenario where zigbee2mqtt is used to control the devices. Of course, in the case of integrating the two systems this componen drops from the equation which makes it a different scenario...

Re: Using mqtt auto discovery (or mqtt in general) to integrate devices from Home Assistant?

Posted: Monday 07 November 2022 10:14
by Nautilus
waltervl wrote: Friday 28 October 2022 10:25 If Home-Assistant sends/receives MQTT HA-Autodiscover messages than intergration should be easy as Domoticz supports it (for some device types). So this would be an HA-issue.
On the other side, I do not see the use case to run Domoticz and Home-Assistant next to each other, it is like putting 2 fuel engines in 1 car.
Yeah, e.g. https://github.com/Jalle19/eda-modbus-bridge works directly in Domoticz, thanks to it using the "autodiscovery logic".

I agree running both systems is not the optimal way - but in some cases the only way for a non-coder (like me) who likes Domoticz, but wants to integrate devices which are not yet supported in Domoticz :)

So instead of describing it as putting two fuel engines into one car, I would describe it as a hybrid. For example, I much prefer the electric drive train, but some other features of the fuel engine are still ahead of the electric. I guess that is why hybrids are so popular nowadays :lol:

Re: Using mqtt auto discovery (or mqtt in general) to integrate devices from Home Assistant?

Posted: Tuesday 08 November 2022 10:27
by TurboX
Since few month, I use home assistant (synology docker) in parallele of domoticz in order to be able to easily catch news integration or not implemented in domoticz (cozytouch, synology, enphase envoy firm v7, ..). With Zwave JS UI, both system work fine in parallele (monitoring and command) it's powerfull thanks to MQTT autodiscovery.
As I prefer domoticz to HA, I have decided to push over with a link between HA and domoticz with MQTT autodiscovery and it works ! Now I have made a script which declare the devices in MQTT, then domoticz create device automatically and HA send data to MQTT broker (with automation).

Re: Using mqtt auto discovery (or mqtt in general) to integrate devices from Home Assistant?

Posted: Thursday 10 November 2022 8:07
by Nautilus
Sounds great - care to share your setup? :)

Re: Using mqtt auto discovery (or mqtt in general) to integrate devices from Home Assistant?

Posted: Monday 21 November 2022 10:03
by TurboX
Yes, I will do as soon as possible.

Re: Using mqtt auto discovery (or mqtt in general) to integrate devices from Home Assistant?

Posted: Monday 21 November 2022 11:47
by Nautilus
TurboX wrote: Monday 21 November 2022 10:03 Yes, I will do as soon as possible.
Excellent! 8-)

Re: Using mqtt auto discovery (or mqtt in general) to integrate devices from Home Assistant?

Posted: Friday 25 November 2022 11:24
by Gravityz
yes i like to see that script as well

at the moment i am struggling to implement an RGBWW light in domoticz
this light supports HA MQTT but domoticz autodiscovery does not recognize it correctly(domoticz is not 100% HA compatible)

i am trying to add it manually by figuring out what domoticz wants to receive to create a specific device but i can not find the documentation.

i know the commands from the light but what i do not know to what values/variables they need to be mapped

Re: Using mqtt auto discovery (or mqtt in general) to integrate devices from Home Assistant?

Posted: Thursday 12 January 2023 10:57
by TurboX
Hello,

Sorry for my late reply.
Here my tutorial (french) for a link between Home Assistant and Domoticz using MQTT autodiscovery.
It is my first version, the script will be improved. For the moment it has been tested from HA to Domoticz with Energy sensors.
https://blogmotion.fr/diy/connecter-dom ... mqtt-20653

The github link https://github.com/Turbox35/MQTTlink.

Re: Using mqtt auto discovery (or mqtt in general) to integrate devices from Home Assistant?

Posted: Monday 16 January 2023 8:29
by Nautilus
Thanks, will definitely check this option. I guess MQTTlink.py needs to be made run as a service (or enough to run once to create the needed mqtt topics)? In case you or anyone else is interested, there are more details now available for the alternative method of integrating HA & Domoticz through standard mqtt (domoticz/in / domoticz/out) which of course needs the dummy devices to be created manually.

https://community.home-assistant.io/t/h ... cz/8375/59

Re: Using mqtt auto discovery (or mqtt in general) to integrate devices from Home Assistant?

Posted: Monday 16 January 2023 9:28
by TurboX
MQTTlink.py must be run one time (for device creation in MQTT with retain flag).
I have tested with temperature sensor and works fine without modification.

In a first time, I would like to test/validate other sensor kind after what I wish to dockerize it (a challenge for me as I'm not a developper).