I have a Dingtian relay. It has a LAN and also a WIFI connection. Works with MQTT, but the device ID is different on wifi and on LAN (let’s call them DTWifi and DTLAN). Mainly I’d like to use it with LAN, but if there is any problem (e.g. cutting LAN cable), I’d like to use with wifi. So there are two switches under HA: one for LAN, one for Wifi. Both of them switch the same relay. Can I merge them into one entity? I mean if the LAN switch is available, it will be the LAN switch, if the LAN switch is “unavailable” it will be the wifi based switch.
Thinking about this another way, you could create an automation that re-sends states from the two relay ID state_topics to a third topic that you set as the state_topic for your switch. The same automation could also re-send commands to both relay ID topics.
Sory, I don’t understand this. My aim to see one switch entity, but behind tis there is a default switch, or if this defaoult switch is not available, it should be another switch.
You then need another automation ( or you could add to the above ) to get states from either version of your Dingtain switch back to the template switch