Domoticz MQTT support

hey guys,

I am trying to integrate OpenMQTTGateway with Domoticz Via MQTT.

I will try to explain my project. I Have 4 x 5v 16Mhz Arduino pro minis in weatherproof boxes on the property, they each have:

  • 1x hc-sr501 Passive Infrared Sensor
  • 1x 433,92Mhz transmitter
  • 1x 5v Solar panel
  • 1x 5v
  • 1x 18650 lithium ion battery

The sketch running on the Arduinos is using the same rc-swtch library as OpenMQTTGateway.

The Basic sketch functions:

  • go to sleep
  • Wakeup every 4 hours and TX battery Voltage
  • Waekup for TX Motion alerts after sunset (these will later turn on appropriate floodlights)

My basic idea was to TX a 5-bit unit-id before either sending battery info or motion alerts, this way you could distinguish between the multiple units and their values. I am no longer sure that is the right way to go, any insight there would be greatly appreciated.

So i have this as my setup, the Arduino sketches sending 433 codes to openMQTTGateway,
OMG then connects to the broker using “domoticz/in” topic.

So as of now Domoticz is receiving the MQTT messages perfectly…

But it seems like Domoticz doesn’t know what to do with them unless it has an IDX value.
the IDX value corresponds to actual or virtual devices in domotics.

so from mosquito (my broker) if i send:

 mosquitto_pub -h  -m '{ "idx" : 1, "nvalue" : 0, "svalue" : "25.0" }' -t 'domoticz/in'

It will update the device with that idx value with the svalue information.

my thoughts are this, if i can take a 8-bit Unit-ID and convert it to a IDX value, and also get my battery voltage in Millivolts (16bit), and or special motion code (16bit) for a total of 24bit message.

so my messages out to domoticz on mqtt would look like something like this:
{"idx" : 1,"svalue" : "3810"}
for my timer based battery check.

Is this possible to do in OpenMQTT gateway?
am i just trying to reinvent the wheel here? or is there a better option for the messaging idea.
I can post the code of my Arduino sketches if anyone is interested in seeing them.

I think i might be able to accomplish this by modifying the omg code a little bit, but not sure where to begin, or if there is already a protocol for 433 to do what i want and i am just peeing against the wind here trying to create a scheme!

Thanks in advance for any responses!

Hi,

What I will advise is to use Nodered so as to add the idx instead of modifying OMG code.

But before this, I would search if Domoticz has other ways to read MQTT payloads “as they are coming” without expecting a Domoticz generated id.

Added to that note that ZgatewayRF2 generate a device id, it is not an IDX but maybe could be mapped into Domoticz.

Regarding your protocol usage, it is close to what I did a few years ago with a temperature sensor, it worked.

1 Like

Ooh that’s my question to. It should be so nice to add OpenMQTT gateway a lot simpeler. It’s difficult to find a good instruction. Zigbee2mqtt works with a Domoticz plugin. very simple.

If someone have some tips that should be very nice.

Thanks for the response. I was under the impression this already worked with domoticz.

It’s ok, I have identified what I need OpenMQTTGateway to do. I started to rewrite the rfgateway section to do what I need it to, as far as idx <—> unit id, and the message format domoticz expects as far as mqtt topic etc.

Unfortunately a family member fell ill and is in the ICU. That pretty much halted my progress so far, I’ll be able to work on it a little bit each day. I’ll come back when it’s finished if you guys would like the modified rfgateway code that works with domoticz, and super cheap 433mhz modules.

That sound’s really awesome. I just want to use it for BLE but i think the basic is the same.

My thoughts to your family :pray:

1 Like

Excuse me that i ignore this heavy line. That is very rude. But i wish you, your family and family member all the best and hope that the family member could quickly come back to home to restore.

Just a general remark:
In Domoticz currently the HA AutoDiscover function is being implemented (still in Beta but almost finished).
So it should be easy now to connect devices through OpenMQTTGateway as it is default enabled Advanced configuration of the gateway | OpenMQTTGateway v0.9.9beta

Domoticz documentation for AutoDiscover:
https://www.domoticz.com/wiki/MQTT#AutoDiscover

1 Like

Great, Did you test it by any chance?

No sorry, I did not test it yet.