Page 1 of 1
need help with mqtt (domoticz/in)
Posted: Saturday 14 December 2024 15:24
by Eugene
Hi Guys,
I feel i got stuck trying to deliver Wireless Mbus meters values to domoticz dummy device via mqtt. The wmbusmeters calls mosquitto_sub and posts the values for 3 counters into the mqtt domoticz/in topic. The problem i am facing is that dummy counters i created are not being updated on Domoticz side. Domoticz does not even show the mqtt message in the log however can see the messages with values posted in the mqtt explorer. The domoticz works fine with zigbee2mqtt meaning domoticz<->mqtt connection is operational. It seems that domoticz does not listen for domoticz/in topic for some reason
The example of the call i make when wmbusmeters read new value:
shell=/usr/bin/mosquitto_pub -u XX -P YY -h mqtt5 -t domoticz/in -m "{\"idx\":548,\"svalue\":\"$METER_TOTAL_M3\"}"
attaching screenshot of MQTT explorer and of Dummy devices i created in Domoticz.
I am on Domoticz Version: 2024.4
Please point me to the right direction. Thanks
Re: need help with mqtt (domoticz/in)
Posted: Saturday 14 December 2024 15:59
by FireWizard
Hi @Eugene,
I think you are missing the command in the message, sent to domoticz/in.
Use: { "command": "udevice", "idx": 548, "svalue": "1234"}
"command": "udevice" is the default and may be omitted.
But this makes the message clearer.
However, I think that the value, you send in the part "svalue" is not a string value, but a numerical value. So check that your $METER_TOTAL_M3 is a string value.
If not, convert it first.
It looks okay, but this is an error that is made often.
Regards
Re: need help with mqtt (domoticz/in)
Posted: Saturday 14 December 2024 16:25
by Eugene
Thanks for suggestions. I am not yet sure how can i control value type in the wmbusmeters but i tried running mosquitto_pub trying to pass number as svalue and nvalue but still no difference. Neither of those reached the device in Domoticz but showing up in MQTT Explorer well
/wmbusmeters # /usr/bin/mosquitto_pub -u XX -P YY -h mqtt5 -t domoticz/in -m "{\"command\":\"udevice\",\"idx\":549,\"nvalue\":12345}"
What is worrying me - i do not see anything with domoticz/in topic in the Domoticz logs. I guess it should be showing up there even if values are screwed and not matching expected types.
Thanks
Re: need help with mqtt (domoticz/in)
Posted: Saturday 14 December 2024 17:26
by Eugene
made a workaround with curl calling domoticz API updating the values. Works with no issues.
I would appreciate thoughts on what did i do wrong with my mqtt
thanks.
Re: need help with mqtt (domoticz/in)
Posted: Sunday 15 December 2024 15:03
by FireWizard
Hi @Eugene,
I looked to a couple of things and at the end I decided to test your string in my Test sytem.
If I use the following string on the command line, it works and it sends its value to Domoticz:
Code: Select all
sudo /usr/bin/mosquitto_pub -h <IP address> -u username -P userpass -t domoticz/in -m "{\"command\": \"udevice\", \"idx\": 15, \"svalue\": \"12345\" }"
This works for me and gives a correct value in Domoticz in a "Custom" sensor.
I had to run mosquitto_pub as "root" user. Do not know why yet.
In my opinion my command is similar to yours. Also without \"command\": \"udevice\" it runs fine.
So there is not much, I can test or suggest anymore.
There is one thing, that might be tricky in my opinion.
You use mqtt5 as the host name.
This might look as a better solution, as you do not have to remember the IP address of your MQTT server (broker)
But it requires that all devices that needs to communicate with the MQTT server, such as the broker, the device that has MQTT Explorer installed and your Domoticz server, has to be aware of the IP address of mqtt5.
So you need either a (caching) DNS server on your local network AND all the network interfaces properly configured, so that they use the correct DNS server, or each device should have a hosts file, in which the mqtt5 is listed.
You might want to check that.
I assume however that this is at least correct for the device with MQTT Explorer and the MQTT broker, but for Domoticz I'm not sure.
Check and test it once more.
Regards
Re: need help with mqtt (domoticz/in)
Posted: Sunday 15 December 2024 16:57
by Eugene
Hi, thanks for testing this for me.
Copied your command, ran as root too, still same behavior sadly. Domoticz does not appear to "hear" those messages for some reason. Mqtt explorer sees those messages well.
Is there a way to debug domoticz to get more details on what it is receiving from mosquitto?
Regarding the DNS hostname - i run domoticz, zwave js ui, zigbee2mqq and mosquitto in docker containers. The containers are bridged into shared docker network. I started using docker internal DNS since one of containers changed its IP for unknown reason.
Re: need help with mqtt (domoticz/in)
Posted: Sunday 15 December 2024 17:18
by Eugene
interesting - i tried running tcpdump on the domoticz interface towards mosquitto and it appears that my messages sent with mosquitto_pub are not even reaching the domoticz

other messages ( zwave, zigbee) are reaching domoticz with no issues.
also tried posting messages with mqtt explorer - those i see on mosquitto_sub but nothing seen on tcpdump on domoticz side.
something for me to think about
Do we control anywhere on domoticz side which topics it is subscribed to on mqtt?
Re: need help with mqtt (domoticz/in)
Posted: Sunday 15 December 2024 17:47
by Eugene
sorry for spam, guys. i was digging into domoticz to mqtt integration, i am currently using "MQTT Autodiscovery" to connect to mosquitto. domoticz\in and domoticz\out topics mentions on the "MQTT client gateway".
Do i need a 2nd link to MQTT from domoticz without auto-discovery in this scenario to make domoticz listening to domoticz\in topic? or is the a way to force domoticz listeining to domoticz/in topic in the existing integration with auto-discovery enabled?
thanks
Re: need help with mqtt (domoticz/in)
Posted: Sunday 15 December 2024 18:52
by FireWizard
Hi @Eugene,
Do i need a 2nd link to MQTT from domoticz without auto-discovery in this scenario to make domoticz listening to domoticz\in topic?
Yes, I think so.
As I do not use "Auto Discovery", it was the normal MQTT interface, I used, when testing
But why not try it?
Regards
Re: need help with mqtt (domoticz/in)
Posted: Sunday 15 December 2024 20:29
by Eugene
FireWizard wrote: ↑Sunday 15 December 2024 18:52
But why not try it?
I confirm, second interface without auto-discovery towards same MQTT broker works fine, my devices are updated!
Now i need to rework my setup from curl to mosquitto_pub
FireWizard, thanks a lot for your help!
Re: need help with mqtt (domoticz/in)
Posted: Sunday 15 December 2024 21:16
by FireWizard
Hello @Eugene,
Great, it was my pleasure.
Can you mark this thread as "Solved"?
Regards.
Re: need help with mqtt (domoticz/in)
Posted: Sunday 15 December 2024 22:02
by Eugene
I tried to solve it, getting "404 Not Found" in response

I will try tomorrow again
Re: need help with mqtt (domoticz/in)
Posted: Monday 16 December 2024 0:06
by waltervl
Eugene wrote: ↑Sunday 15 December 2024 22:02
I tried to solve it, getting "404 Not Found" in response

I will try tomorrow again
There is a bug on mark solve in the forum system after it was moved to another server and updated to latest version. Gizmocuz is working on it
Re: need help with mqtt (domoticz/in)
Posted: Monday 16 December 2024 14:50
by waltervl
waltervl wrote: ↑Monday 16 December 2024 0:06
Eugene wrote: ↑Sunday 15 December 2024 22:02
I tried to solve it, getting "404 Not Found" in response

I will try tomorrow again
There is a bug on mark solve in the forum system after it was moved to another server and updated to latest version. Gizmocuz is working on it
And solved!