Browse Source

Small changes

i18n
Xose Pérez 6 years ago
parent
commit
34c72859ef
6 changed files with 13 additions and 12 deletions
  1. +1
    -0
      code/espurna/config/arduino.h
  2. +3
    -3
      code/espurna/config/general.h
  3. +4
    -0
      code/espurna/domoticz.ino
  4. +2
    -5
      code/espurna/mqtt.ino
  5. +2
    -3
      code/espurna/ntp.ino
  6. +1
    -1
      code/espurna/utils.ino

+ 1
- 0
code/espurna/config/arduino.h View File

@ -93,6 +93,7 @@
//-------------------------------------------------------------------------------- //--------------------------------------------------------------------------------
//#define ANALOG_SUPPORT 1 //#define ANALOG_SUPPORT 1
//#define BH1750_SUPPORT 1
//#define BMX280_SUPPORT 1 //#define BMX280_SUPPORT 1
//#define DALLAS_SUPPORT 1 //#define DALLAS_SUPPORT 1
//#define DHT_SUPPORT 1 //#define DHT_SUPPORT 1


+ 3
- 3
code/espurna/config/general.h View File

@ -396,7 +396,7 @@ PROGMEM const char* const custom_reset_string[] = {
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#ifndef SPIFFS_SUPPORT #ifndef SPIFFS_SUPPORT
#define SPIFFS_SUPPORT 0 // Do not add support for SPIFFS by default
#define SPIFFS_SUPPORT 0 // Do not add support for SPIFFS by default
#endif #endif
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
@ -427,7 +427,7 @@ PROGMEM const char* const custom_reset_string[] = {
#ifndef MQTT_USE_ASYNC #ifndef MQTT_USE_ASYNC
#define MQTT_USE_ASYNC 1 // Use AysncMQTTClient (1) or PubSubClient
#define MQTT_USE_ASYNC 1 // Use AysncMQTTClient (1) or PubSubClient (0)
#endif #endif
// MQTT OVER SSL // MQTT OVER SSL
@ -699,7 +699,7 @@ PROGMEM const char* const custom_reset_string[] = {
#define NTP_UPDATE_INTERVAL 1800 // NTP check every 30 minutes #define NTP_UPDATE_INTERVAL 1800 // NTP check every 30 minutes
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// FAUXMO
// ALEXA
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// This setting defines whether Alexa support should be built into the firmware // This setting defines whether Alexa support should be built into the firmware


+ 4
- 0
code/espurna/domoticz.ino View File

@ -74,6 +74,8 @@ void _domoticzMqtt(unsigned int type, const char * topic, const char * payload)
}; };
#if WEB_SUPPORT
void _domoticzWebSocketOnSend(JsonObject& root) { void _domoticzWebSocketOnSend(JsonObject& root) {
root["dczVisible"] = 1; root["dczVisible"] = 1;
@ -99,6 +101,8 @@ void _domoticzWebSocketOnSend(JsonObject& root) {
} }
#endif // WEB_SUPPORT
void _domoticzConfigure() { void _domoticzConfigure() {
_dcz_enabled = getSetting("dczEnabled", DOMOTICZ_ENABLED).toInt() == 1; _dcz_enabled = getSetting("dczEnabled", DOMOTICZ_ENABLED).toInt() == 1;
_domoticzMqttSubscribe(_dcz_enabled); _domoticzMqttSubscribe(_dcz_enabled);


+ 2
- 5
code/espurna/mqtt.ino View File

@ -233,10 +233,6 @@ void _mqttWebSocketOnSend(JsonObject& root) {
root["mqttUseJson"] = getSetting("mqttUseJson", MQTT_USE_JSON).toInt() == 1; root["mqttUseJson"] = getSetting("mqttUseJson", MQTT_USE_JSON).toInt() == 1;
} }
void _mqttConfigure() {
if (getSetting("mqttClientID").length() == 0) delSetting("mqttClientID");
}
#endif #endif
void _mqttCallback(unsigned int type, const char * topic, const char * payload) { void _mqttCallback(unsigned int type, const char * topic, const char * payload) {
@ -483,6 +479,7 @@ void mqttConfigure() {
_mqtt_qos = getSetting("mqttQoS", MQTT_QOS).toInt(); _mqtt_qos = getSetting("mqttQoS", MQTT_QOS).toInt();
_mqtt_retain = getSetting("mqttRetain", MQTT_RETAIN).toInt() == 1; _mqtt_retain = getSetting("mqttRetain", MQTT_RETAIN).toInt() == 1;
_mqtt_keepalive = getSetting("mqttKeep", MQTT_KEEPALIVE).toInt(); _mqtt_keepalive = getSetting("mqttKeep", MQTT_KEEPALIVE).toInt();
if (getSetting("mqttClientID").length() == 0) delSetting("mqttClientID");
// Enable // Enable
if (getSetting("mqttServer", MQTT_SERVER).length() == 0) { if (getSetting("mqttServer", MQTT_SERVER).length() == 0) {
@ -565,7 +562,7 @@ void mqttSetup() {
#if WEB_SUPPORT #if WEB_SUPPORT
wsOnSendRegister(_mqttWebSocketOnSend); wsOnSendRegister(_mqttWebSocketOnSend);
wsOnAfterParseRegister(_mqttConfigure);
wsOnAfterParseRegister(mqttConfigure);
#endif #endif
} }


+ 2
- 3
code/espurna/ntp.ino View File

@ -13,7 +13,6 @@ Copyright (C) 2016-2018 by Xose Pérez <xose dot perez at gmail dot com>
#include <WiFiClient.h> #include <WiFiClient.h>
#include <Ticker.h> #include <Ticker.h>
WiFiEventHandler _ntp_wifi_onSTA;
Ticker _ntp_delay; Ticker _ntp_delay;
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
@ -86,8 +85,8 @@ void ntpSetup() {
} }
}); });
_ntp_wifi_onSTA = WiFi.onStationModeGotIP([](WiFiEventStationModeGotIP ipInfo) {
_ntpConfigure();
wifiRegister([](justwifi_messages_t code, char * parameter) {
if (code == MESSAGE_CONNECTED) _ntpConfigure();
}); });
#if WEB_SUPPORT #if WEB_SUPPORT


+ 1
- 1
code/espurna/utils.ino View File

@ -11,7 +11,7 @@ Ticker _defer_reset;
String getIdentifier() { String getIdentifier() {
char buffer[20]; char buffer[20];
snprintf_P(buffer, sizeof(buffer), PSTR("ESPURNA_%06X"), ESP.getChipId());
snprintf_P(buffer, sizeof(buffer), PSTR("%s_%06X"), APP_NAME, ESP.getChipId());
return String(buffer); return String(buffer);
} }


Loading…
Cancel
Save