Allow setting the hostname
Allows setting the hostname if MY_ESP6266_HOSTNAME is defined.
This commit is contained in:
@@ -103,6 +103,9 @@ bool gatewayTransportInit() {
|
|||||||
#if defined(MY_ESP8266_SSID)
|
#if defined(MY_ESP8266_SSID)
|
||||||
// Turn off access point
|
// Turn off access point
|
||||||
WiFi.mode (WIFI_STA);
|
WiFi.mode (WIFI_STA);
|
||||||
|
#if defined(MY_ESP8266_HOSTNAME)
|
||||||
|
WiFi.hostname(MY_EPS8266_HOSTNAME);
|
||||||
|
#endif
|
||||||
(void)WiFi.begin(MY_ESP8266_SSID, MY_ESP8266_PASSWORD);
|
(void)WiFi.begin(MY_ESP8266_SSID, MY_ESP8266_PASSWORD);
|
||||||
#ifdef MY_IP_ADDRESS
|
#ifdef MY_IP_ADDRESS
|
||||||
WiFi.config(_ethernetGatewayIP, gateway, subnet);
|
WiFi.config(_ethernetGatewayIP, gateway, subnet);
|
||||||
|
|||||||
@@ -167,6 +167,9 @@ bool gatewayTransportInit() {
|
|||||||
#if defined(MY_GATEWAY_ESP8266)
|
#if defined(MY_GATEWAY_ESP8266)
|
||||||
// Turn off access point
|
// Turn off access point
|
||||||
WiFi.mode (WIFI_STA);
|
WiFi.mode (WIFI_STA);
|
||||||
|
#if defined(MY_ESP8266_HOSTNAME)
|
||||||
|
WiFi.hostname(MY_ESP8266_HOSTNAME);
|
||||||
|
#endif
|
||||||
(void)WiFi.begin(MY_ESP8266_SSID, MY_ESP8266_PASSWORD);
|
(void)WiFi.begin(MY_ESP8266_SSID, MY_ESP8266_PASSWORD);
|
||||||
#ifdef MY_IP_ADDRESS
|
#ifdef MY_IP_ADDRESS
|
||||||
WiFi.config(_clientIp, _gatewayIp, _subnetIp);
|
WiFi.config(_clientIp, _gatewayIp, _subnetIp);
|
||||||
|
|||||||
@@ -86,6 +86,10 @@
|
|||||||
// Enable UDP communication
|
// Enable UDP communication
|
||||||
//#define MY_USE_UDP
|
//#define MY_USE_UDP
|
||||||
|
|
||||||
|
// Set the hostname for the WiFi Client. This is the hostname
|
||||||
|
// it will pass to the DHCP server if not static.
|
||||||
|
// #define MY_ESP8266_HOSTNAME "sensor-gateway"
|
||||||
|
|
||||||
// Enable MY_IP_ADDRESS here if you want a static ip address (no DHCP)
|
// Enable MY_IP_ADDRESS here if you want a static ip address (no DHCP)
|
||||||
//#define MY_IP_ADDRESS 192,168,178,87
|
//#define MY_IP_ADDRESS 192,168,178,87
|
||||||
|
|
||||||
|
|||||||
@@ -88,6 +88,10 @@
|
|||||||
#define MY_ESP8266_SSID "MySSID"
|
#define MY_ESP8266_SSID "MySSID"
|
||||||
#define MY_ESP8266_PASSWORD "MyVerySecretPassword"
|
#define MY_ESP8266_PASSWORD "MyVerySecretPassword"
|
||||||
|
|
||||||
|
// Set the hostname for the WiFi Client. This is the hostname
|
||||||
|
// it will pass to the DHCP server if not static.
|
||||||
|
// #define MY_ESP8266_HOSTNAME "mqtt-sensor-gateway"
|
||||||
|
|
||||||
// Enable MY_IP_ADDRESS here if you want a static ip address (no DHCP)
|
// Enable MY_IP_ADDRESS here if you want a static ip address (no DHCP)
|
||||||
#define MY_IP_ADDRESS 192,168,178,87
|
#define MY_IP_ADDRESS 192,168,178,87
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user