mqttclient.cpp: Set Ethernet hostname

This commit is contained in:
cyberman54 2021-04-12 17:51:29 +02:00
parent e6782185ca
commit fc1ac508ef

View File

@ -22,6 +22,7 @@ esp_err_t mqtt_init(void) {
// setup network connection and MQTT client // setup network connection and MQTT client
ETH.begin(); ETH.begin();
ETH.setHostname(clientId);
mqttClient.begin(MQTT_SERVER, MQTT_PORT, netClient); mqttClient.begin(MQTT_SERVER, MQTT_PORT, netClient);
mqttClient.setKeepAlive(MQTT_KEEPALIVE); mqttClient.setKeepAlive(MQTT_KEEPALIVE);
mqttClient.onMessageAdvanced(mqtt_callback); mqttClient.onMessageAdvanced(mqtt_callback);