Open proasnet opened 3 months ago
I am trying another methods... Method 1:
WiFiClient wificlient;
EthernetClient ethernetclient;
HADevice device;
HAMqtt *mqtt;
void setup() {
if ( ethernet_connected ) {
mqtt = new HAMqtt( ethernetclient , device , 40 );
debug.println( "eth MQTT" );
}
if ( wifi_connected ) {
mqtt = new HAMqtt( wificlient , device , 40 );
debug.println( "wifi MQTT" );
}
}
Method 2:
Client *client;
HADevice device;
HAMqtt *mqtt;
void setup() {
if ( ethernet_connected ) {
client = new EthernetClient;
debug.println( "eth MQTT" );
}
if ( wifi_connected ) {
client = new WifiClient;
debug.println( "wifi MQTT" );
}
mqtt = new HAMqtt( client , device , 40 );
}
Compile is work fine, but not discovered too.
Dear @dawidchyrzynski, very thanks for your library.
In my project with ESP32 I am using two connection types ( Wifi or Ethernet W5500 ) selectable via UI, so only one connection in time, not simultaneously
If I comment "//" one of them, discovery working. Else not. Is any way for use both constructors and working discovery by HA? Thank you