Hello people, I’m new here and also to HA, using the latest version 17.7. I am an embedded software Engineer from the Netherlands and I’m pretty keen on using ESP8266 and ESP32 devices for home automation. In the past I created web-interfaces to control these devices but I want to integrate in HA using MQTT now.
Google and youtube helped me get started but now I get stuck. I have an 8-relay board with ESP32 controller for which I created my own (basic) firmware.
The board has a pretty simple MQTT interface: unique ID ‘eldi’, topic ‘debug/rX’ where X can be a number 1 to 8 referring to the associated relay.
In HA I split the MQTT configuration yaml from the main configuration yaml and entered the following to control the relays in mqtt.yaml:
After reloading the YAML configuration (and also reboot of HA) I can only find the first relay. If I move another relay to the top position, I can only find that relay.
So, the problem I have is that I can’t refer multiple relays. What am I missing ?
Show us what you did there. I’m guessing you have the wrong include statement…
Here is how I split mine. It’s a bit tricky because it’s a dictionary of lists, or maybe the other way around, but something like that.
It is one device (aka unique device) servicing 8 relays, I would be able to setup 8 connections in the device with each unique device controlling one relay but that sounds a bit like overkill.
Hello Sir Goodenough,
That could be the problem indeed, all the samples I find seem to have a single sensor or single light.
My configuration.yaml file:
# Loads default set of integrations. Do not remove.
default_config:
# Load frontend themes from the themes folder
frontend:
themes: !include_dir_merge_named themes
mqtt: !include mqtt.yaml
An ID that uniquely identifies this light. If two lights have the same unique ID, Home Assistant will raise an exception. Required when used with device-based discovery.
Thanks ! That is indeed the solution. In ESP code I have to setup a connection to a WiFiClient and pass the unique ID I want to use. I might have mixed up the unique id from each seperate light. I removed the unique_id entries from the yaml file (and no change in ESP code) and now I can control each relay.
This topic can be closed
Oops, I missed that. 123 is absolutely right.
I suggest don’t set the unique_id to anything human readable, because you will mess your self up thinking you can refer to it later. You really can’t for anything useful. I just load a UUID string in there that my editor can generate for me. It’s there so that you can change the names and other things, and is used as the ‘name’ that the UI can refer to. Think of it like the mish-mash device_id, not meant to be human readable.