mirror of https://github.com/arendst/Tasmota.git
Increase ESP32 compatibility
Increase ESP32 compatibility (breaks current ESP32 configuration again!)
This commit is contained in:
parent
a397f3cd5a
commit
e8f3d1d986
|
@ -34,9 +34,9 @@ String ESP_getResetInfo(void)
|
|||
return String(PSTR("0"));
|
||||
}
|
||||
|
||||
String ESP_getBootVersion(void)
|
||||
uint32_t ESP_getBootVersion(void)
|
||||
{
|
||||
return String(PSTR("Unknown"));
|
||||
return 1;
|
||||
}
|
||||
|
||||
bool ESP_rtcUserMemoryWrite(uint32_t offset, uint32_t *data, size_t size)
|
||||
|
@ -59,15 +59,32 @@ uint32_t ESP_getFlashChipId()
|
|||
return 0;
|
||||
}
|
||||
|
||||
uint32_t ESP_getChipId()
|
||||
{
|
||||
uint32_t id = 0;
|
||||
for (uint32_t i = 0; i < 17; i = i +8) {
|
||||
id |= ((ESP.getEfuseMac() >> (40 - i)) & 0xff) << i;
|
||||
}
|
||||
return id;
|
||||
}
|
||||
|
||||
String String_ESP_getChipId()
|
||||
{
|
||||
uint64_t mac = ESP.getEfuseMac();
|
||||
return String(uint32_t(mac >> 32)) + String(uint32_t(mac));
|
||||
}
|
||||
|
||||
/*
|
||||
uint64_t ESP_getChipId()
|
||||
uint32_t ESP_getFlashChipRealSize()
|
||||
{
|
||||
return ESP.getEfuseMac();
|
||||
return ESP.getFlashChipSize();
|
||||
}
|
||||
|
||||
uint32_t ESP_getSketchSize(void)
|
||||
{
|
||||
static uint32_t sketchsize = 0;
|
||||
|
||||
if (!sketchsize) {
|
||||
sketchsize = ESP.getSketchSize(); // This takes almost 2 seconds on an ESP32
|
||||
}
|
||||
return sketchsize;
|
||||
}
|
||||
*/
|
||||
|
|
|
@ -34,13 +34,16 @@
|
|||
#define ESP_flashReadHeader(offset, data, size) ESP32_flashRead(offset, data, size)
|
||||
#define ESP_flashRead(offset, data, size) ESP32_flashRead(offset, data, size)
|
||||
String ESP_getResetReason(void);
|
||||
String ESP_getBootVersion(void);
|
||||
uint32_t ESP_getBootVersion(void);
|
||||
bool ESP_rtcUserMemoryWrite(uint32_t offset, uint32_t *data, size_t size);
|
||||
bool ESP_rtcUserMemoryRead(uint32_t offset, uint32_t *data, size_t size);
|
||||
void ESP_reset();
|
||||
String ESP_getResetInfo(void);
|
||||
uint32_t ESP_getFlashChipId();
|
||||
uint32_t ESP_getChipId();
|
||||
String String_ESP_getChipId();
|
||||
uint32_t ESP_getFlashChipRealSize();
|
||||
uint32_t ESP_getSketchSize();
|
||||
|
||||
// Analog
|
||||
inline void analogWrite(uint8_t pin, int val)
|
||||
|
|
|
@ -562,6 +562,7 @@ char* GetPowerDevice(char* dest, uint32_t idx, size_t size)
|
|||
|
||||
void GetEspHardwareType(void)
|
||||
{
|
||||
#ifdef ESP8266
|
||||
// esptool.py get_efuses
|
||||
uint32_t efuse1 = *(uint32_t*)(0x3FF00050);
|
||||
uint32_t efuse2 = *(uint32_t*)(0x3FF00054);
|
||||
|
@ -572,16 +573,23 @@ void GetEspHardwareType(void)
|
|||
if (is_8285 && (ESP.getFlashChipRealSize() > 1048576)) {
|
||||
is_8285 = false; // ESP8285 can only have 1M flash
|
||||
}
|
||||
#else
|
||||
is_8285 = false; // ESP8285 can only have 1M flash
|
||||
#endif
|
||||
}
|
||||
|
||||
String GetDeviceHardware(void)
|
||||
{
|
||||
char buff[10];
|
||||
#ifdef ESP8266
|
||||
if (is_8285) {
|
||||
strcpy_P(buff, PSTR("ESP8285"));
|
||||
} else {
|
||||
strcpy_P(buff, PSTR("ESP8266EX"));
|
||||
}
|
||||
#else
|
||||
strcpy_P(buff, PSTR("ESP32"));
|
||||
#endif
|
||||
return String(buff);
|
||||
}
|
||||
|
||||
|
|
|
@ -422,7 +422,7 @@ void CmndStatus(void)
|
|||
|
||||
if ((0 == payload) || (2 == payload)) {
|
||||
Response_P(PSTR("{\"" D_CMND_STATUS D_STATUS2_FIRMWARE "\":{\"" D_JSON_VERSION "\":\"%s%s\",\"" D_JSON_BUILDDATETIME "\":\"%s\",\""
|
||||
D_JSON_BOOTVERSION "\":%d,\"" D_JSON_COREVERSION "\":\"" ARDUINO_ESP8266_RELEASE "\",\"" D_JSON_SDKVERSION "\":\"%s\","
|
||||
D_JSON_BOOTVERSION "\":%d,\"" D_JSON_COREVERSION "\":\"" ARDUINO_CORE_RELEASE "\",\"" D_JSON_SDKVERSION "\":\"%s\","
|
||||
"\"Hardware\":\"%s\""
|
||||
"%s}}"),
|
||||
my_version, my_image, GetBuildDateAndTime().c_str(),
|
||||
|
@ -447,8 +447,8 @@ void CmndStatus(void)
|
|||
Response_P(PSTR("{\"" D_CMND_STATUS D_STATUS4_MEMORY "\":{\"" D_JSON_PROGRAMSIZE "\":%d,\"" D_JSON_FREEMEMORY "\":%d,\"" D_JSON_HEAPSIZE "\":%d,\""
|
||||
D_JSON_PROGRAMFLASHSIZE "\":%d,\"" D_JSON_FLASHSIZE "\":%d,\"" D_JSON_FLASHCHIPID "\":\"%06X\",\"" D_JSON_FLASHMODE "\":%d,\""
|
||||
D_JSON_FEATURES "\":[\"%08X\",\"%08X\",\"%08X\",\"%08X\",\"%08X\",\"%08X\",\"%08X\"]"),
|
||||
ESP.getSketchSize()/1024, ESP.getFreeSketchSpace()/1024, ESP.getFreeHeap()/1024,
|
||||
ESP.getFlashChipSize()/1024, ESP.getFlashChipRealSize()/1024, ESP_getFlashChipId(), ESP.getFlashChipMode(),
|
||||
ESP_getSketchSize()/1024, ESP.getFreeSketchSpace()/1024, ESP.getFreeHeap()/1024,
|
||||
ESP.getFlashChipSize()/1024, ESP_getFlashChipRealSize()/1024, ESP_getFlashChipId(), ESP.getFlashChipMode(),
|
||||
LANGUAGE_LCID, feature_drv1, feature_drv2, feature_sns1, feature_sns2, feature5, feature6);
|
||||
XsnsDriverState();
|
||||
ResponseAppend_P(PSTR(",\"Sensors\":"));
|
||||
|
|
|
@ -367,7 +367,7 @@ void RtcSecond(void)
|
|||
if ((Rtc.ntp_sync_minute > 59) && (uptime_minute > 2)) {
|
||||
Rtc.ntp_sync_minute = 1; // If sync prepare for a new cycle
|
||||
}
|
||||
uint8_t offset = (uptime < 30) ? RtcTime.second : (((ESP.getChipId() & 0xF) * 3) + 3) ; // First try ASAP to sync. If fails try once every 60 seconds based on chip id
|
||||
uint8_t offset = (uptime < 30) ? RtcTime.second : (((ESP_getChipId() & 0xF) * 3) + 3) ; // First try ASAP to sync. If fails try once every 60 seconds based on chip id
|
||||
if ( (((offset == RtcTime.second) && ( (RtcTime.year < 2016) || // Never synced
|
||||
(Rtc.ntp_sync_minute == uptime_minute))) || // Re-sync every hour
|
||||
ntp_force_sync ) ) { // Forced sync
|
||||
|
|
|
@ -39,14 +39,14 @@ char* Format(char* output, const char* input, int size)
|
|||
char tmp[size];
|
||||
if (strchr(token, 'd')) {
|
||||
snprintf_P(tmp, size, PSTR("%s%c0%dd"), output, '%', digits);
|
||||
snprintf_P(output, size, tmp, ESP.getChipId() & 0x1fff); // %04d - short chip ID in dec, like in hostname
|
||||
snprintf_P(output, size, tmp, ESP_getChipId() & 0x1fff); // %04d - short chip ID in dec, like in hostname
|
||||
} else {
|
||||
snprintf_P(tmp, size, PSTR("%s%c0%dX"), output, '%', digits);
|
||||
snprintf_P(output, size, tmp, ESP.getChipId()); // %06X - full chip ID in hex
|
||||
snprintf_P(output, size, tmp, ESP_getChipId()); // %06X - full chip ID in hex
|
||||
}
|
||||
} else {
|
||||
if (strchr(token, 'd')) {
|
||||
snprintf_P(output, size, PSTR("%s%d"), output, ESP.getChipId()); // %d - full chip ID in dec
|
||||
snprintf_P(output, size, PSTR("%s%d"), output, ESP_getChipId()); // %d - full chip ID in dec
|
||||
digits = 8;
|
||||
}
|
||||
}
|
||||
|
@ -61,10 +61,10 @@ char* Format(char* output, const char* input, int size)
|
|||
char* GetOtaUrl(char *otaurl, size_t otaurl_size)
|
||||
{
|
||||
if (strstr(SettingsText(SET_OTAURL), "%04d") != nullptr) { // OTA url contains placeholder for chip ID
|
||||
snprintf(otaurl, otaurl_size, SettingsText(SET_OTAURL), ESP.getChipId() & 0x1fff);
|
||||
snprintf(otaurl, otaurl_size, SettingsText(SET_OTAURL), ESP_getChipId() & 0x1fff);
|
||||
}
|
||||
else if (strstr(SettingsText(SET_OTAURL), "%d") != nullptr) { // OTA url contains placeholder for chip ID
|
||||
snprintf_P(otaurl, otaurl_size, SettingsText(SET_OTAURL), ESP.getChipId());
|
||||
snprintf_P(otaurl, otaurl_size, SettingsText(SET_OTAURL), ESP_getChipId());
|
||||
}
|
||||
else {
|
||||
strlcpy(otaurl, SettingsText(SET_OTAURL), otaurl_size);
|
||||
|
@ -824,6 +824,13 @@ void PerformEverySecond(void)
|
|||
// Wifi keep alive to send Gratuitous ARP
|
||||
wifiKeepAlive();
|
||||
#endif // ARDUINO_ESP8266_RELEASE_2_3_0
|
||||
|
||||
|
||||
#ifdef ESP32
|
||||
if (11 == uptime) { // Perform one-time ESP32 houskeeping
|
||||
ESP_getSketchSize(); // Init sketchsize as it can take up to 2 seconds
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------------------------*\
|
||||
|
|
|
@ -655,7 +655,7 @@ void WifiConnect(void)
|
|||
WifiSetOutputPower();
|
||||
WiFi.persistent(false); // Solve possible wifi init errors
|
||||
Wifi.status = 0;
|
||||
Wifi.retry_init = WIFI_RETRY_OFFSET_SEC + (ESP.getChipId() & 0xF); // Add extra delay to stop overrun by simultanous re-connects
|
||||
Wifi.retry_init = WIFI_RETRY_OFFSET_SEC + (ESP_getChipId() & 0xF); // Add extra delay to stop overrun by simultanous re-connects
|
||||
Wifi.retry = Wifi.retry_init;
|
||||
Wifi.counter = 1;
|
||||
|
||||
|
|
|
@ -41,14 +41,14 @@
|
|||
* Power Type
|
||||
\*********************************************************************************************/
|
||||
|
||||
#ifdef ESP8266
|
||||
//#ifdef ESP8266
|
||||
typedef unsigned long power_t; // Power (Relay) type
|
||||
const uint32_t POWER_MASK = 0xffffffffUL; // Power (Relay) full mask
|
||||
#endif // ESP8266
|
||||
#ifdef ESP32
|
||||
typedef uint64_t power_t; // Power (Relay) type
|
||||
const uint64_t POWER_MASK = 0xffffffffffffffffull; // Power (Relay) full mask
|
||||
#endif // ESP32
|
||||
//#endif // ESP8266
|
||||
//#ifdef ESP32
|
||||
//typedef uint64_t power_t; // Power (Relay) type
|
||||
//const uint64_t POWER_MASK = 0xffffffffffffffffull; // Power (Relay) full mask
|
||||
//#endif // ESP32
|
||||
|
||||
/*********************************************************************************************\
|
||||
* Constants
|
||||
|
|
|
@ -276,7 +276,7 @@ void setup(void)
|
|||
Format(mqtt_topic, SettingsText(SET_MQTT_TOPIC), sizeof(mqtt_topic));
|
||||
if (strstr(SettingsText(SET_HOSTNAME), "%") != nullptr) {
|
||||
SettingsUpdateText(SET_HOSTNAME, WIFI_HOSTNAME);
|
||||
snprintf_P(my_hostname, sizeof(my_hostname)-1, SettingsText(SET_HOSTNAME), mqtt_topic, ESP.getChipId() & 0x1FFF);
|
||||
snprintf_P(my_hostname, sizeof(my_hostname)-1, SettingsText(SET_HOSTNAME), mqtt_topic, ESP_getChipId() & 0x1FFF);
|
||||
} else {
|
||||
snprintf_P(my_hostname, sizeof(my_hostname)-1, SettingsText(SET_HOSTNAME));
|
||||
}
|
||||
|
@ -290,7 +290,7 @@ void setup(void)
|
|||
|
||||
SetPowerOnState();
|
||||
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR(D_PROJECT " %s %s " D_VERSION " %s%s-" ARDUINO_ESP8266_RELEASE), PROJECT, SettingsText(SET_FRIENDLYNAME1), my_version, my_image);
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR(D_PROJECT " %s %s " D_VERSION " %s%s-" ARDUINO_CORE_RELEASE), PROJECT, SettingsText(SET_FRIENDLYNAME1), my_version, my_image);
|
||||
#ifdef FIRMWARE_MINIMAL
|
||||
AddLog_P2(LOG_LEVEL_INFO, PSTR(D_WARNING_MINIMAL_VERSION));
|
||||
#endif // FIRMWARE_MINIMAL
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
// Modul
|
||||
#undef MODULE
|
||||
#define MODULE WEMOS // [Module] Select default model
|
||||
#endif
|
||||
#endif // ESP32
|
||||
|
||||
#ifdef ESP8266
|
||||
// ESP8266
|
||||
|
@ -17,6 +17,9 @@
|
|||
#define ESP_reset() ESP.reset()
|
||||
#define ESP_getBootVersion() ESP.getBootVersion()
|
||||
#define ESP_getFlashChipId() ESP.getFlashChipId()
|
||||
#define ESP_getFlashChipRealSize() ESP.getFlashChipRealSize()
|
||||
#define ESP_getSketchSize() ESP.getSketchSize()
|
||||
#define ESP_getChipId() ESP.getChipId()
|
||||
//
|
||||
// we need different ESP_flashRead for ESP32
|
||||
//
|
||||
|
@ -28,4 +31,4 @@
|
|||
//
|
||||
// Serial minimal type to hold the config
|
||||
#define SerConfu8 uint8_t
|
||||
#endif // ESP32
|
||||
#endif // ESP8266
|
||||
|
|
|
@ -117,8 +117,19 @@ extern "C" void resetPins();
|
|||
#define MESSZ (MQTT_MAX_PACKET_SIZE -TOPSZ -7) // Max number of characters in JSON message string
|
||||
#endif
|
||||
|
||||
#ifdef ESP8266
|
||||
#ifndef ARDUINO_ESP8266_RELEASE
|
||||
#define ARDUINO_ESP8266_RELEASE "STAGE"
|
||||
#define ARDUINO_CORE_RELEASE "STAGE"
|
||||
#else
|
||||
#define ARDUINO_CORE_RELEASE ARDUINO_ESP8266_RELEASE
|
||||
#endif
|
||||
#endif
|
||||
#ifdef ESP32
|
||||
#ifndef ARDUINO_ESP32_RELEASE
|
||||
#define ARDUINO_CORE_RELEASE "STAGE"
|
||||
#else
|
||||
#define ARDUINO_CORE_RELEASE ARDUINO_ESP32_RELEASE
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef USE_PWM_DIMMER_REMOTE
|
||||
|
|
|
@ -2120,7 +2120,7 @@ void HandleInformation(void)
|
|||
WSContentSend_P(PSTR("<table style='width:100%%'><tr><th>"));
|
||||
WSContentSend_P(PSTR(D_PROGRAM_VERSION "}2%s%s"), my_version, my_image);
|
||||
WSContentSend_P(PSTR("}1" D_BUILD_DATE_AND_TIME "}2%s"), GetBuildDateAndTime().c_str());
|
||||
WSContentSend_P(PSTR("}1" D_CORE_AND_SDK_VERSION "}2" ARDUINO_ESP8266_RELEASE "/%s"), ESP.getSdkVersion());
|
||||
WSContentSend_P(PSTR("}1" D_CORE_AND_SDK_VERSION "}2" ARDUINO_CORE_RELEASE "/%s"), ESP.getSdkVersion());
|
||||
WSContentSend_P(PSTR("}1" D_UPTIME "}2%s"), GetUptime().c_str());
|
||||
WSContentSend_P(PSTR("}1" D_FLASH_WRITE_COUNT "}2%d at 0x%X"), Settings.save_flag, GetSettingsAddress());
|
||||
WSContentSend_P(PSTR("}1" D_BOOT_COUNT "}2%d"), Settings.bootcount);
|
||||
|
@ -2195,11 +2195,11 @@ void HandleInformation(void)
|
|||
#endif // USE_DISCOVERY
|
||||
|
||||
WSContentSend_P(PSTR("}1}2 ")); // Empty line
|
||||
WSContentSend_P(PSTR("}1" D_ESP_CHIP_ID "}2%d"), ESP.getChipId());
|
||||
WSContentSend_P(PSTR("}1" D_ESP_CHIP_ID "}2%d"), ESP_getChipId());
|
||||
WSContentSend_P(PSTR("}1" D_FLASH_CHIP_ID "}20x%06X"), ESP_getFlashChipId());
|
||||
WSContentSend_P(PSTR("}1" D_FLASH_CHIP_SIZE "}2%dkB"), ESP.getFlashChipRealSize() / 1024);
|
||||
WSContentSend_P(PSTR("}1" D_FLASH_CHIP_SIZE "}2%dkB"), ESP_getFlashChipRealSize() / 1024);
|
||||
WSContentSend_P(PSTR("}1" D_PROGRAM_FLASH_SIZE "}2%dkB"), ESP.getFlashChipSize() / 1024);
|
||||
WSContentSend_P(PSTR("}1" D_PROGRAM_SIZE "}2%dkB"), ESP.getSketchSize() / 1024);
|
||||
WSContentSend_P(PSTR("}1" D_PROGRAM_SIZE "}2%dkB"), ESP_getSketchSize() / 1024);
|
||||
WSContentSend_P(PSTR("}1" D_FREE_PROGRAM_SPACE "}2%dkB"), ESP.getFreeSketchSpace() / 1024);
|
||||
WSContentSend_P(PSTR("}1" D_FREE_MEMORY "}2%dkB"), freeMem / 1024);
|
||||
WSContentSend_P(PSTR("</td></tr></table>"));
|
||||
|
|
|
@ -180,12 +180,12 @@ void HAssAnnounceRelayLight(void)
|
|||
mqtt_data[0] = '\0'; // Clear retained message
|
||||
|
||||
// Clear "other" topic first in case the device has been reconfigured from light to switch or vice versa
|
||||
snprintf_P(unique_id, sizeof(unique_id), PSTR("%06X_%s_%d"), ESP.getChipId(), (is_topic_light) ? "RL" : "LI", i);
|
||||
snprintf_P(unique_id, sizeof(unique_id), PSTR("%06X_%s_%d"), ESP_getChipId(), (is_topic_light) ? "RL" : "LI", i);
|
||||
snprintf_P(stopic, sizeof(stopic), PSTR(HOME_ASSISTANT_DISCOVERY_PREFIX "/%s/%s/config"),
|
||||
(is_topic_light) ? "switch" : "light", unique_id);
|
||||
MqttPublish(stopic, true);
|
||||
// Clear or Set topic
|
||||
snprintf_P(unique_id, sizeof(unique_id), PSTR("%06X_%s_%d"), ESP.getChipId(), (is_topic_light) ? "LI" : "RL", i);
|
||||
snprintf_P(unique_id, sizeof(unique_id), PSTR("%06X_%s_%d"), ESP_getChipId(), (is_topic_light) ? "LI" : "RL", i);
|
||||
snprintf_P(stopic, sizeof(stopic), PSTR(HOME_ASSISTANT_DISCOVERY_PREFIX "/%s/%s/config"),
|
||||
(is_topic_light) ? "light" : "switch", unique_id);
|
||||
|
||||
|
@ -210,7 +210,7 @@ void HAssAnnounceRelayLight(void)
|
|||
|
||||
Response_P(HASS_DISCOVER_BASE, name, state_topic, availability_topic);
|
||||
TryResponseAppend_P(HASS_DISCOVER_RELAY, command_topic, value_template, SettingsText(SET_STATE_TXT1), SettingsText(SET_STATE_TXT2));
|
||||
TryResponseAppend_P(HASS_DISCOVER_DEVICE_INFO_SHORT, unique_id, ESP.getChipId());
|
||||
TryResponseAppend_P(HASS_DISCOVER_DEVICE_INFO_SHORT, unique_id, ESP_getChipId());
|
||||
|
||||
#ifdef USE_LIGHT
|
||||
if (is_light
|
||||
|
@ -270,7 +270,7 @@ void HAssAnnouncerTriggers(uint8_t device, uint8_t present, uint8_t key, uint8_t
|
|||
mqtt_data[0] = '\0'; // Clear retained message
|
||||
|
||||
for (uint8_t i = 2; i <= 3; i++) {
|
||||
snprintf_P(unique_id, sizeof(unique_id), PSTR("%06X_%s_%d_%s"), ESP.getChipId(), key ? "SW" : "BTN", device + 1, GetStateText(i));
|
||||
snprintf_P(unique_id, sizeof(unique_id), PSTR("%06X_%s_%d_%s"), ESP_getChipId(), key ? "SW" : "BTN", device + 1, GetStateText(i));
|
||||
snprintf_P(stopic, sizeof(stopic), PSTR(HOME_ASSISTANT_DISCOVERY_PREFIX "/device_automation/%s/config"), unique_id);
|
||||
|
||||
if (Settings.flag.hass_discovery && present) { // SetOption19 - Control Home Assistantautomatic discovery (See SetOption59)
|
||||
|
@ -294,7 +294,7 @@ void HAssAnnouncerTriggers(uint8_t device, uint8_t present, uint8_t key, uint8_t
|
|||
if (i == 3) { pload = hold; }
|
||||
GetTextIndexed(param, sizeof(param), pload, kHAssTriggerType);
|
||||
snprintf_P(subtype, sizeof(subtype), PSTR("%s_%d"), key ? "switch" : "button", device + 1);
|
||||
Response_P(HASS_TRIGGER_TYPE, state_topic, GetStateText(i), param, subtype, ESP.getChipId());
|
||||
Response_P(HASS_TRIGGER_TYPE, state_topic, GetStateText(i), param, subtype, ESP_getChipId());
|
||||
} else { mqtt_data[0] = '\0'; } // Need to be cleaned again to avoid duplicate.
|
||||
}
|
||||
MqttPublish(stopic, true);
|
||||
|
@ -310,7 +310,7 @@ void HAssAnnouncerBinSensors(uint8_t device, uint8_t present, uint8_t dual, uint
|
|||
|
||||
mqtt_data[0] = '\0'; // Clear retained message
|
||||
|
||||
snprintf_P(unique_id, sizeof(unique_id), PSTR("%06X_SW_%d"), ESP.getChipId(), device + 1);
|
||||
snprintf_P(unique_id, sizeof(unique_id), PSTR("%06X_SW_%d"), ESP_getChipId(), device + 1);
|
||||
snprintf_P(stopic, sizeof(stopic), PSTR(HOME_ASSISTANT_DISCOVERY_PREFIX "/binary_sensor/%s/config"), unique_id);
|
||||
|
||||
|
||||
|
@ -335,7 +335,7 @@ void HAssAnnouncerBinSensors(uint8_t device, uint8_t present, uint8_t dual, uint
|
|||
} else {
|
||||
TryResponseAppend_P(HASS_DISCOVER_BIN_PIR, PSTR(D_RSLT_STATE), SettingsText(SET_STATE_TXT2));
|
||||
}
|
||||
TryResponseAppend_P(HASS_DISCOVER_DEVICE_INFO_SHORT, unique_id, ESP.getChipId());
|
||||
TryResponseAppend_P(HASS_DISCOVER_DEVICE_INFO_SHORT, unique_id, ESP_getChipId());
|
||||
TryResponseAppend_P(PSTR("}"));
|
||||
}
|
||||
}
|
||||
|
@ -491,7 +491,7 @@ void HAssAnnounceSensor(const char *sensorname, const char *subsensortype, const
|
|||
|
||||
// Clear or Set topic
|
||||
NoAlNumToUnderscore(subname, MultiSubName); //Replace all non alphaumeric characters to '_' to avoid topic name issues
|
||||
snprintf_P(unique_id, sizeof(unique_id), PSTR("%06X_%s_%s"), ESP.getChipId(), sensorname, subname);
|
||||
snprintf_P(unique_id, sizeof(unique_id), PSTR("%06X_%s_%s"), ESP_getChipId(), sensorname, subname);
|
||||
snprintf_P(stopic, sizeof(stopic), PSTR(HOME_ASSISTANT_DISCOVERY_PREFIX "/sensor/%s/config"), unique_id);
|
||||
|
||||
if (Settings.flag.hass_discovery)
|
||||
|
@ -506,7 +506,7 @@ void HAssAnnounceSensor(const char *sensorname, const char *subsensortype, const
|
|||
GetTopic_P(availability_topic, TELE, mqtt_topic, S_LWT);
|
||||
|
||||
Response_P(HASS_DISCOVER_BASE, name, state_topic, availability_topic);
|
||||
TryResponseAppend_P(HASS_DISCOVER_DEVICE_INFO_SHORT, unique_id, ESP.getChipId());
|
||||
TryResponseAppend_P(HASS_DISCOVER_DEVICE_INFO_SHORT, unique_id, ESP_getChipId());
|
||||
|
||||
|
||||
char jname[32];
|
||||
|
@ -632,7 +632,7 @@ void HAssAnnounceStatusSensor(void)
|
|||
mqtt_data[0] = '\0'; // Clear retained message
|
||||
|
||||
// Clear or Set topic
|
||||
snprintf_P(unique_id, sizeof(unique_id), PSTR("%06X_status"), ESP.getChipId());
|
||||
snprintf_P(unique_id, sizeof(unique_id), PSTR("%06X_status"), ESP_getChipId());
|
||||
snprintf_P(stopic, sizeof(stopic), PSTR(HOME_ASSISTANT_DISCOVERY_PREFIX "/sensor/%s/config"), unique_id);
|
||||
|
||||
if (Settings.flag.hass_discovery)
|
||||
|
@ -648,7 +648,7 @@ void HAssAnnounceStatusSensor(void)
|
|||
|
||||
Response_P(HASS_DISCOVER_BASE, name, state_topic, availability_topic);
|
||||
TryResponseAppend_P(HASS_DISCOVER_SENSOR_HASS_STATUS, state_topic);
|
||||
TryResponseAppend_P(HASS_DISCOVER_DEVICE_INFO, unique_id, ESP.getChipId(), SettingsText(SET_FRIENDLYNAME1),
|
||||
TryResponseAppend_P(HASS_DISCOVER_DEVICE_INFO, unique_id, ESP_getChipId(), SettingsText(SET_FRIENDLYNAME1),
|
||||
ModuleName().c_str(), my_version, my_image);
|
||||
TryResponseAppend_P(PSTR("}"));
|
||||
}
|
||||
|
@ -658,7 +658,7 @@ void HAssAnnounceStatusSensor(void)
|
|||
void HAssPublishStatus(void)
|
||||
{
|
||||
Response_P(PSTR("{\"" D_JSON_VERSION "\":\"%s%s\",\"" D_JSON_BUILDDATETIME "\":\"%s\","
|
||||
"\"" D_JSON_COREVERSION "\":\"" ARDUINO_ESP8266_RELEASE "\",\"" D_JSON_SDKVERSION "\":\"%s\","
|
||||
"\"" D_JSON_COREVERSION "\":\"" ARDUINO_CORE_RELEASE "\",\"" D_JSON_SDKVERSION "\":\"%s\","
|
||||
"\"" D_CMND_MODULE "\":\"%s\",\"" D_JSON_RESTARTREASON "\":\"%s\",\"" D_JSON_UPTIME "\":\"%s\","
|
||||
"\"WiFi " D_JSON_LINK_COUNT "\":%d,\"WiFi " D_JSON_DOWNTIME "\":\"%s\",\"" D_JSON_MQTT_COUNT "\":%d,"
|
||||
"\"" D_JSON_BOOTCOUNT "\":%d,\"" D_JSON_SAVECOUNT "\":%d,\"" D_CMND_IPADDRESS "\":\"%s\","
|
||||
|
|
|
@ -192,7 +192,7 @@ String GetHueUserId(void)
|
|||
{
|
||||
char userid[7];
|
||||
|
||||
snprintf_P(userid, sizeof(userid), PSTR("%03x"), ESP.getChipId());
|
||||
snprintf_P(userid, sizeof(userid), PSTR("%03x"), ESP_getChipId());
|
||||
return String(userid);
|
||||
}
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ String WemoSerialnumber(void)
|
|||
{
|
||||
char serial[16];
|
||||
|
||||
snprintf_P(serial, sizeof(serial), PSTR("201612K%08X"), ESP.getChipId());
|
||||
snprintf_P(serial, sizeof(serial), PSTR("201612K%08X"), ESP_getChipId());
|
||||
return String(serial);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue