1
mirror of https://github.com/rvdbreemen/OTGW-firmware synced 2024-11-16 04:33:49 +01:00

adding LLMNR responder for windows

This commit is contained in:
Robert van den Breemen 2021-03-06 16:42:57 +01:00
parent e19d9d1624
commit 460ad9b4b7
4 changed files with 49 additions and 27 deletions

View File

@ -699,7 +699,7 @@
,[ "mqttconnected", "MQTT Connected"]
,[ "mqttenable", "MQTT Enable"]
,[ "mqtthaprefix", "MQTT Home Assistant prefix"]
,[ "ntpenable", "NTP Enable"]
,[ "ntpenabled", "NTP Enable"]
,[ "ntptimezone", "NTP Timezone"]
,[ "uptime", "Uptime since boot"]
,[ "bootcount", "Nr. Reboots"]

View File

@ -40,6 +40,7 @@
#include <ESP8266WebServer.h> // Version 1.0.0 - part of ESP8266 Core https://github.com/esp8266/Arduino
#include <ESP8266mDNS.h> // part of ESP8266 Core https://github.com/esp8266/Arduino
#include <ESP8266HTTPClient.h>
#include <ESP8266LLMNR.h>
#include <WiFiUdp.h> // part of ESP8266 Core https://github.com/esp8266/Arduino
//#include "ESP8266HTTPUpdateServer.h"
@ -136,21 +137,34 @@ void startTelnet()
} // startTelnet()
//=======================================================================
void startMDNS(const char *Hostname)
void startMDNS(const char *hostname)
{
DebugTf("[1] mDNS setup as [%s.local]\r\n", Hostname);
if (MDNS.begin(Hostname)) // Start the mDNS responder for Hostname.local
DebugTf("mDNS setup as [%s.local]\r\n", hostname);
if (MDNS.begin(hostname)) // Start the mDNS responder for Hostname.local
{
DebugTf("[2] mDNS responder started as [%s.local]\r\n", Hostname);
DebugTf("mDNS responder started as [%s.local]\r\n", hostname);
}
else
{
DebugTln(F("[3] Error setting up MDNS responder!\r\n"));
DebugTln(F("Error setting up MDNS responder!\r\n"));
}
MDNS.addService("http", "tcp", 80);
} // startMDNS()
void startLLMNR(const char *hostname)
{
DebugTf("LLMNR setup as [%s]\r\n", hostname);
if (LLMNR.begin(hostname)) // Start the LLMNR responder for hostname
{
DebugTf("LLMNR responder started as [%s]\r\n", hostname);
}
else
{
DebugTln(F("Error setting up LLMNR responder!\r\n"));
}
} // startLLMNR()
void startNTP(){
// Initialisation ezTime
if (!settingNTPenable) return;

View File

@ -83,7 +83,10 @@ void readSettings(bool show)
settingMQTTuser = doc["MQTTuser"].as<String>();
settingMQTTpasswd = doc["MQTTpasswd"].as<String>();
settingMQTTtopTopic = doc["MQTTtoptopic"].as<String>();
if (settingMQTTtopTopic=="null") { settingMQTTtopTopic = _HOSTNAME; settingMQTTtopTopic.toLowerCase();}
if (settingMQTTtopTopic=="null") {
settingMQTTtopTopic = _HOSTNAME;
settingMQTTtopTopic.toLowerCase();
}
settingMQTThaprefix = doc["MQTThaprefix"].as<String>();
if (settingMQTThaprefix=="null") settingMQTThaprefix = HOMEASSISTANT_PREFIX;
settingNTPenable = doc["NTPenable"];
@ -97,23 +100,24 @@ void readSettings(bool show)
//Update some settings right now
MDNS.setHostname(CSTR(settingHostname)); // start advertising with new(?) settingHostname
DebugTln(F(" .. done\r"));
DebugTln(F(" .. done\r\n"));
if (show) {
Debugln(F("\r\n==== read Settings ===================================================\r"));
Debugf(" Hostname : %s\r\n", CSTR(settingHostname));
Debugf(" MQTT enabled : %s\r\n", CBOOLEAN(settingMQTTenable));
Debugf(" MQTT broker : %s\r\n", CSTR(settingMQTTbroker));
Debugf(" MQTT port : %d\r\n", settingMQTTbrokerPort);
Debugf(" MQTT username : %s\r\n", CSTR(settingMQTTuser));
Debugf(" MQTT password : %s\r\n", CSTR(settingMQTTpasswd));
Debugf(" MQTT toptopic : %s\r\n", CSTR(settingMQTTtopTopic));
Debugf(" HA prefix : %s\r\n", CSTR(settingMQTThaprefix));
Debugf(" NTP enabled : %s\r\n", CBOOLEAN(settingNTPenable));
Debugf(" NPT timezone : %s\r\n", CSTR(settingNTPtimezone));
Debugf("Hostname : %s\r\n", CSTR(settingHostname));
Debugf("MQTT enabled : %s\r\n", CBOOLEAN(settingMQTTenable));
Debugf("MQTT broker : %s\r\n", CSTR(settingMQTTbroker));
Debugf("MQTT port : %d\r\n", settingMQTTbrokerPort);
Debugf("MQTT username : %s\r\n", CSTR(settingMQTTuser));
Debugf("MQTT password : %s\r\n", CSTR(settingMQTTpasswd));
Debugf("MQTT toptopic : %s\r\n", CSTR(settingMQTTtopTopic));
Debugf("HA prefix : %s\r\n", CSTR(settingMQTThaprefix));
Debugf("NTP enabled : %s\r\n", CBOOLEAN(settingNTPenable));
Debugf("NPT timezone : %s\r\n", CSTR(settingNTPtimezone));
Debugf("Led Blink : %s\r\n", CBOOLEAN(settingLEDblink));
}
Debugln(F("-\r"));
Debugln(F("-\r\n"));
} // readSettings()
@ -142,7 +146,10 @@ void updateSetting(const char *field, const char *newValue)
if (stricmp(field, "MQTTpasswd")==0) settingMQTTpasswd = String(newValue);
if (stricmp(field, "MQTTtoptopic")==0) {
settingMQTTtopTopic = String(newValue);
if (settingMQTTtopTopic.length()==0) { settingMQTTtopTopic = _HOSTNAME; settingMQTTtopTopic.toLowerCase();}
if (settingMQTTtopTopic.length()==0) {
settingMQTTtopTopic = _HOSTNAME;
settingMQTTtopTopic.toLowerCase();
}
}
if (stricmp(field, "MQTThaprefix")==0) {
settingMQTThaprefix = String(newValue);

View File

@ -2,14 +2,15 @@
#define _VERSION_MAJOR 0
#define _VERSION_MINOR 8
#define _VERSION_PATCH 0
#define _VERSION_BUILD 756
#define _VERSION_GITHASH e1e6b3e
#define _VERSION_BUILD 762
#define _VERSION_GITHASH e19d9d1
//#define _VERSION_PRERELEASE beta //uncomment to define prerelease labels: alpha - beta - rc
#define _VERSION_DATE "06-03-2021"
#define _VERSION_TIME "12:29:51"
#define _VERSION_TIME "16:41:28"
#define _SEMVER_CORE "0.8.0"
#define _SEMVER_BUILD "0.8.0+756"
#define _SEMVER_FULL "0.8.0+e1e6b3e-756"
#define _SEMVER_BUILD "0.8.0+762"
#define _SEMVER_GITHASH "0.8.0+e19d9d1"
#define _SEMVER_FULL "0.8.0+e19d9d1"
#define _SEMVER_NOBUILD "0.8.0 (06-03-2021)"
#define _VERSION "0.8.0+e1e6b3e-756 (06-03-2021)"
#define _VERSION "0.8.0+e19d9d1 (06-03-2021)"
//The version information is created automatically, more information here: https://github.com/rvdbreemen/autoinc-semver