I’m trying to include a ESP32 to HA via the new MQTT Device Discovery feature. Currently the ESP32 does nothing, it only sends the mqtt message to the “homeassistant/device/3823147816S/config” topic telling that the device has a light entity.
But HA doesn’t discover it.
Can someone tell me what is wrong, incoherent or missing please?
Hi,
Start simple, build up - and more importantly, use the search facility on this forum for worked MQTT Discovery examples to adapt:
# Send a MQTT Discovery message to create a soil moisture sensor
# Note the difference between the DEVICE name and the moisture ENTITY (allowing several sensor channels)
# Note the additional DEVICE parameters such as manufacturer, version, and the 'suggested_location' which can be used to set the Area
# Note the additional ENTITY parameters such as an icon, the device class and unit of measurement which both allow long-term logging to give the user data graphs.
mosquitto_pub -r -h 127.0.0.1 -p 1883 -t 'homeassistant/sensor/grow-1_chan1/config' --retain -m '{"name":"Channel 1 ENTITY", "stat_t":"tele/grow-1/SENSOR", "val_tpl":"{{value_json.Channel1}}", "avty_t":"tele/grow-1/LWT", "pl_avail":"Online", "pl_not_avail":"Offline", "uniq_id":"grow-1_chan1", "dev": {"ids":["grow-1"], "name":"Grow 1 DEVICE", "mf":"Great Devices", "mdl":"Grow Sensor", "sw":"0.2", "sa":"Conservatory"}, "icon":"mdi:sprout", "dev_cla":"humidity", "unit_of_meas":"%", "expire_after":"1200", "frc_upd": true}'
MQTT discovery is instant, so you should be able to quickly prototype your code quickly.
If you need more help, the community needs details like:
What software / firmware / language / other are you using for this?
What entity are you trying to create? (light / switch / dimmer - all different)
I have got the temperature, voltage, power, current sensors to be recognized
You were right, start simple and build up.
But there is one entity I don’t know how to program.
I need a light entity where I can adjust the brightness and also the color temperature (1800-4000K)
I found out how to do it for the brightness, but not for the color_temp.
Any help please?