Page 1 of 1

help for convert MQTT message to MQTT discovery

Posted: Friday 18 August 2023 16:44
by david31
Hello

I have many scripts MQTT and ESP qui old MQTT protocol with example:
{"command": "switchlight", "idx": 701, "switchcmd": "On" }

My idx is a swith and name is Portilon:

I have tested with prefix "domoticz"
mosquitto_pub -h 127.0.0.1 -p 1883 -t "domoticz/switch/Portillon/set" -m ON

any message is received, any error

i have read the wiki https://www.domoticz.com/wiki/MQTT https://www.domoticz.com/wiki/Zigbee2MQ ... todiscover https://www.home-assistant.io/integrati ... -discovery

Re: help for convert MQTT message to MQTT discovery

Posted: Friday 18 August 2023 16:54
by waltervl
Why change to AutoDiscover, these old messages are Domoticz native so are all fine.
Autodiscover is build on the principle you send first a config message so Domoticz will create a device end then send a state messsage to update the device. I would just keep using these messages.

But perhaps the firmware on the ESP is already Autodiscover compatible, just switch it on.
Firmwares that support Autodiscover:
ESPHome, ecowitt2mqtt, EsPurna, IOTLink, MiFlora MQTT Daemon, OpenMQTTGateway, Teleinfo MQTT, Wyzesense2MQTT, Arduino HAMqttDevice