Support for second DNS server

This commit is contained in:
Theo Arends 2021-07-29 16:57:04 +02:00
parent fa747a6576
commit 65b7034b0c
11 changed files with 35 additions and 14 deletions

View File

@ -3,7 +3,11 @@ All notable changes to this project will be documented in this file.
## [Unreleased] - Development
## [9.5.0.3]
## [9.5.0.4]
### Added
- Support for second DNS server
## [9.5.0.3] 20210729
### Added
- Command ``SetSensor1..127 0|1`` to globally disable individual sensor driver
- Support for CAN bus and Freedom Won Battery Management System by Marius Bezuidenhout (#12651)
@ -22,6 +26,7 @@ All notable changes to this project will be documented in this file.
### Fixed
- Discovery fails when using ``%hostname%`` in a topic (#12710)
- ESP32-Solo OTA upgrade
- ESP32 buzzer in PWM mode exception (#12717)
## [9.5.0.2] 20210714
### Added

View File

@ -98,11 +98,12 @@ The latter links can be used for OTA upgrades too like ``OtaUrl http://ota.tasmo
[Complete list](BUILDS.md) of available feature and sensors.
## Changelog v9.5.0.3
## Changelog v9.5.0.4
### Added
- Release of [Tasmota WebInstaller](https://arendst.github.io/Tasmota/)
- Command ``SetOption127 1`` to force Wifi in no-sleep mode even if ``Sleep 0`` is not enabled
- Command ``SetSensor1..127 0|1`` to globally disable individual sensor driver
- Support for second DNS server
- Initial support for Tasmota Mesh (TasMesh) providing node/broker communication using ESP-NOW [#11939](https://github.com/arendst/Tasmota/issues/11939)
- Berry ESP32 partition manager [#12465](https://github.com/arendst/Tasmota/issues/12465)
- Berry ESP32 support for I2S audio mp3 playback
@ -147,3 +148,4 @@ The latter links can be used for OTA upgrades too like ``OtaUrl http://ota.tasmo
- Wi-Fi initial setup workaround for 11n only routers [#12566](https://github.com/arendst/Tasmota/issues/12566)
- ESP32 do not use chip temperature sensor as global temperature if external temperature sensor is used [#12630](https://github.com/arendst/Tasmota/issues/12630)
- Discovery fails when using ``%hostname%`` in a topic [#12710](https://github.com/arendst/Tasmota/issues/12710)
- ESP32 buzzer in PWM mode exception (#12717)[#12717](https://github.com/arendst/Tasmota/issues/12717)

View File

@ -68,7 +68,8 @@
#define WIFI_IP_ADDRESS "0.0.0.0" // [IpAddress1] Set to 0.0.0.0 for using DHCP or enter a static IP address
#define WIFI_GATEWAY "192.168.1.1" // [IpAddress2] If not using DHCP set Gateway IP address
#define WIFI_SUBNETMASK "255.255.255.0" // [IpAddress3] If not using DHCP set Network mask
#define WIFI_DNS "192.168.1.1" // [IpAddress4] If not using DHCP set DNS IP address (might be equal to WIFI_GATEWAY)
#define WIFI_DNS "192.168.1.1" // [IpAddress4] If not using DHCP set DNS1 IP address (might be equal to WIFI_GATEWAY)
#define WIFI_DNS2 "0.0.0.0" // [IpAddress5] If not using DHCP set DNS2 IP address (might be equal to WIFI_GATEWAY)
#define STA_SSID1 "" // [Ssid1] Wi-Fi SSID
#define STA_PASS1 "" // [Password1] Wi-Fi password

View File

@ -598,8 +598,7 @@ typedef struct {
uint8_t ina219_mode; // 531
uint16_t pulse_timer[MAX_PULSETIMERS]; // 532
uint16_t button_debounce; // 542
uint32_t ipv4_address[4]; // 544
unsigned long energy_kWhtotal; // 554
uint32_t ipv4_address[5]; // 544
uint8_t free_558[100]; // 558
@ -737,10 +736,11 @@ typedef struct {
uint16_t shd_warmup_brightness; // F5C
uint8_t shd_warmup_time; // F5E
uint8_t free_f5f[65]; // F5F - Decrement if adding new Setting variables just above and below
uint8_t free_f5f[61]; // F5F - Decrement if adding new Setting variables just above and below
// Only 32 bit boundary variables below
unsigned long energy_kWhtotal; // F9C
SBitfield1 sbflag1; // FA0
TeleinfoCfg teleinfo; // FA4
uint64_t rf_protocol_mask; // FA8

View File

@ -859,6 +859,7 @@ void SettingsDefaultSet2(void) {
ParseIPv4(&Settings->ipv4_address[1], PSTR(WIFI_GATEWAY));
ParseIPv4(&Settings->ipv4_address[2], PSTR(WIFI_SUBNETMASK));
ParseIPv4(&Settings->ipv4_address[3], PSTR(WIFI_DNS));
ParseIPv4(&Settings->ipv4_address[4], PSTR(WIFI_DNS2));
Settings->sta_config = WIFI_CONFIG_TOOL;
// Settings->sta_active = 0;
SettingsUpdateText(SET_STASSID1, PSTR(STA_SSID1));
@ -1376,6 +1377,10 @@ void SettingsDelta(void) {
if (Settings->version < 0x09050003) {
memset(&Settings->sensors, 0xFF, 16); // Enable all possible sensors
}
if (Settings->version < 0x09050004) {
Settings->energy_kWhtotal = Settings->ipv4_address[4];
ParseIPv4(&Settings->ipv4_address[4], PSTR(WIFI_DNS2));
}
Settings->version = VERSION;
SettingsSave(1);

View File

@ -567,10 +567,10 @@ void CmndStatus(void)
if ((0 == payload) || (5 == payload)) {
Response_P(PSTR("{\"" D_CMND_STATUS D_STATUS5_NETWORK "\":{\"" D_CMND_HOSTNAME "\":\"%s\",\"" D_CMND_IPADDRESS "\":\"%_I\",\""
D_JSON_GATEWAY "\":\"%_I\",\"" D_JSON_SUBNETMASK "\":\"%_I\",\"" D_JSON_DNSSERVER "\":\"%_I\",\""
D_JSON_GATEWAY "\":\"%_I\",\"" D_JSON_SUBNETMASK "\":\"%_I\",\"" D_JSON_DNSSERVER "1\":\"%_I\",\"" D_JSON_DNSSERVER "2\":\"%_I\",\""
D_JSON_MAC "\":\"%s\",\"" D_CMND_WEBSERVER "\":%d,\"" D_CMND_WIFICONFIG "\":%d,\"" D_CMND_WIFIPOWER "\":%s}}"),
NetworkHostname(), (uint32_t)NetworkAddress(),
Settings->ipv4_address[1], Settings->ipv4_address[2], Settings->ipv4_address[3],
Settings->ipv4_address[1], Settings->ipv4_address[2], Settings->ipv4_address[3], Settings->ipv4_address[4],
NetworkMacAddress().c_str(), Settings->webserver, Settings->sta_config, WifiGetOutputPower().c_str());
CmndStatusResponse(5);
}
@ -1642,12 +1642,12 @@ void CmndLogport(void)
void CmndIpAddress(void)
{
if ((XdrvMailbox.index > 0) && (XdrvMailbox.index <= 4)) {
if ((XdrvMailbox.index > 0) && (XdrvMailbox.index <= 5)) {
char network_address[22];
ext_snprintf_P(network_address, sizeof(network_address), PSTR(" (%_I)"), (uint32_t)NetworkAddress());
if (!XdrvMailbox.usridx) {
ResponseClear();
for (uint32_t i = 0; i < 4; i++) {
for (uint32_t i = 0; i < 5; i++) {
ResponseAppend_P(PSTR("%c\"%s%d\":\"%_I%s\""), (i)?',':'{', XdrvMailbox.command, i +1, Settings->ipv4_address[i], (0 == i)?network_address:"");
}
ResponseJsonEnd();

View File

@ -207,7 +207,7 @@ void WifiBegin(uint8_t flag, uint8_t channel)
Settings->sta_active ^= 1; // Skip empty SSID
}
if (Settings->ipv4_address[0]) {
WiFi.config(Settings->ipv4_address[0], Settings->ipv4_address[1], Settings->ipv4_address[2], Settings->ipv4_address[3]); // Set static IP
WiFi.config(Settings->ipv4_address[0], Settings->ipv4_address[1], Settings->ipv4_address[2], Settings->ipv4_address[3], Settings->ipv4_address[4]); // Set static IP
}
WiFi.hostname(TasmotaGlobal.hostname); // ESP8266 needs this here (after WiFi.mode)
@ -396,6 +396,7 @@ void WifiCheckIp(void)
Settings->ipv4_address[1] = (uint32_t)WiFi.gatewayIP();
Settings->ipv4_address[2] = (uint32_t)WiFi.subnetMask();
Settings->ipv4_address[3] = (uint32_t)WiFi.dnsIP();
Settings->ipv4_address[4] = (uint32_t)WiFi.dnsIP(1);
// Save current AP parameters for quick reconnect
Settings->wifi_channel = WiFi.channel();

View File

@ -20,6 +20,6 @@
#ifndef _TASMOTA_VERSION_H_
#define _TASMOTA_VERSION_H_
const uint32_t VERSION = 0x09050003;
const uint32_t VERSION = 0x09050004;
#endif // _TASMOTA_VERSION_H_

View File

@ -79,7 +79,12 @@ Examples :
#define WIFI_DNS MY_DNS // If not using DHCP set DNS IP address (might be equal to WIFI_GATEWAY)
#endif
// !!! Remember that your changes GOES AT THE BOTTOM OF THIS FILE right before the last #endif !!!
#ifdef MY_DNS2
#undef WIFI_DNS2
#define WIFI_DNS2 MY_DNS2 // If not using DHCP set DNS IP address (might be equal to WIFI_GATEWAY)
#endif
// !!! Remember that your changes GOES AT THE BOTTOM OF THIS FILE right before the last #endif !!!
*/

View File

@ -2310,7 +2310,8 @@ void HandleInformation(void)
if (!TasmotaGlobal.global_state.network_down) {
WSContentSend_P(PSTR("}1" D_GATEWAY "}2%_I"), Settings->ipv4_address[1]);
WSContentSend_P(PSTR("}1" D_SUBNET_MASK "}2%_I"), Settings->ipv4_address[2]);
WSContentSend_P(PSTR("}1" D_DNS_SERVER "}2%_I"), Settings->ipv4_address[3]);
WSContentSend_P(PSTR("}1" D_DNS_SERVER "1}2%_I"), Settings->ipv4_address[3]);
WSContentSend_P(PSTR("}1" D_DNS_SERVER "2}2%_I"), Settings->ipv4_address[4]);
}
if ((WiFi.getMode() >= WIFI_AP) && (static_cast<uint32_t>(WiFi.softAPIP()) != 0)) {
WSContentSend_P(PSTR("}1<hr/>}2<hr/>"));

View File

@ -100,6 +100,7 @@ void EthernetEvent(WiFiEvent_t event) {
Settings->ipv4_address[1] = (uint32_t)ETH.gatewayIP();
Settings->ipv4_address[2] = (uint32_t)ETH.subnetMask();
Settings->ipv4_address[3] = (uint32_t)ETH.dnsIP();
Settings->ipv4_address[4] = (uint32_t)ETH.dnsIP(1);
TasmotaGlobal.global_state.eth_down = 0;
break;
case SYSTEM_EVENT_ETH_DISCONNECTED: