mirror of https://github.com/arendst/Tasmota.git
Merge branch 'arendst/development' into development
This commit is contained in:
commit
78f7280d83
|
@ -1,7 +1,7 @@
|
|||
## Sonoff-Tasmota
|
||||
Provide ESP8266 based Sonoff by [iTead Studio](https://www.itead.cc/) and ElectroDragon IoT Relay with Serial, Web and MQTT control allowing 'Over the Air' or OTA firmware updates using Arduino IDE.
|
||||
|
||||
Current version is **5.11.1b** - See [sonoff/_releasenotes.ino](https://github.com/arendst/Sonoff-Tasmota/blob/development/sonoff/_releasenotes.ino) for change information.
|
||||
Current version is **5.11.1d** - See [sonoff/_releasenotes.ino](https://github.com/arendst/Sonoff-Tasmota/blob/development/sonoff/_releasenotes.ino) for change information.
|
||||
|
||||
### ATTENTION All versions
|
||||
|
||||
|
|
|
@ -24,7 +24,8 @@
|
|||
// MQTT_MAX_PACKET_SIZE : Maximum packet size
|
||||
#ifndef MQTT_MAX_PACKET_SIZE
|
||||
//#define MQTT_MAX_PACKET_SIZE 128
|
||||
#define MQTT_MAX_PACKET_SIZE 512
|
||||
//#define MQTT_MAX_PACKET_SIZE 512 // Tasmota
|
||||
#define MQTT_MAX_PACKET_SIZE 1000 // Tasmota v5.11.1c
|
||||
#endif
|
||||
|
||||
// MQTT_KEEPALIVE : keepAlive interval in Seconds
|
||||
|
|
|
@ -12,11 +12,13 @@ src_dir = sonoff
|
|||
|
||||
; *** Uncomment one of the lines below to build/upload only one environment
|
||||
;env_default = sonoff
|
||||
;env_default = sonoff-NL
|
||||
;env_default = sonoff-DE
|
||||
;env_default = sonoff-PL
|
||||
;env_default = sonoff-ES
|
||||
;env_default = sonoff-FR
|
||||
;env_default = sonoff-IT
|
||||
;env_default = sonoff-emulation
|
||||
;env_default = sonoff-NL
|
||||
;env_default = sonoff-PL
|
||||
;env_default = sonoff-CN
|
||||
;env_default = sonoff-minimal
|
||||
;env_default = sonoff-ds18x20
|
||||
|
||||
|
@ -25,13 +27,15 @@ platform = espressif8266
|
|||
framework = arduino
|
||||
board = esp01_1m
|
||||
board_flash_mode = dout
|
||||
build_flags = -Wl,-Tesp8266.flash.1m0.ld -DMQTT_MAX_PACKET_SIZE=512
|
||||
build_flags = -Wl,-Tesp8266.flash.1m0.ld
|
||||
lib_deps = PubSubClient, NeoPixelBus, IRremoteESP8266, ArduinoJSON
|
||||
|
||||
; *** Serial Monitor options
|
||||
monitor_baud = 115200
|
||||
|
||||
; *** Upload Serial reset method for Wemos and NodeMCU
|
||||
;upload_port = COM5
|
||||
;upload_speed = 115200
|
||||
;upload_resetmethod = nodemcu
|
||||
|
||||
; *** Upload file to OTA server using SCP
|
||||
|
@ -42,34 +46,34 @@ monitor_baud = 115200
|
|||
;upload_port = domus1:80/api/upload-arduino.php
|
||||
;extra_scripts = pio/http-uploader.py
|
||||
|
||||
[env:sonoff-NL]
|
||||
platform = espressif8266
|
||||
framework = arduino
|
||||
board = esp01_1m
|
||||
board_flash_mode = dout
|
||||
build_flags = -Wl,-Tesp8266.flash.1m0.ld -DMQTT_MAX_PACKET_SIZE=512 -DMY_LANGUAGE=nl-NL
|
||||
lib_deps = PubSubClient, NeoPixelBus, IRremoteESP8266, ArduinoJSON
|
||||
|
||||
; *** Serial Monitor options
|
||||
monitor_baud = 115200
|
||||
|
||||
[env:sonoff-DE]
|
||||
platform = espressif8266
|
||||
framework = arduino
|
||||
board = esp01_1m
|
||||
board_flash_mode = dout
|
||||
build_flags = -Wl,-Tesp8266.flash.1m0.ld -DMQTT_MAX_PACKET_SIZE=512 -DMY_LANGUAGE=de-DE
|
||||
build_flags = -Wl,-Tesp8266.flash.1m0.ld -DMY_LANGUAGE=de-DE
|
||||
lib_deps = PubSubClient, NeoPixelBus, IRremoteESP8266, ArduinoJSON
|
||||
|
||||
; *** Serial Monitor options
|
||||
monitor_baud = 115200
|
||||
|
||||
[env:sonoff-PL]
|
||||
[env:sonoff-ES]
|
||||
platform = espressif8266
|
||||
framework = arduino
|
||||
board = esp01_1m
|
||||
board_flash_mode = dout
|
||||
build_flags = -Wl,-Tesp8266.flash.1m0.ld -DMQTT_MAX_PACKET_SIZE=512 -DMY_LANGUAGE=pl-PL
|
||||
build_flags = -Wl,-Tesp8266.flash.1m0.ld -DMY_LANGUAGE=es-AR
|
||||
lib_deps = PubSubClient, NeoPixelBus, IRremoteESP8266, ArduinoJSON
|
||||
|
||||
; *** Serial Monitor options
|
||||
monitor_baud = 115200
|
||||
|
||||
[env:sonoff-FR]
|
||||
platform = espressif8266
|
||||
framework = arduino
|
||||
board = esp01_1m
|
||||
board_flash_mode = dout
|
||||
build_flags = -Wl,-Tesp8266.flash.1m0.ld -DMY_LANGUAGE=fr-FR
|
||||
lib_deps = PubSubClient, NeoPixelBus, IRremoteESP8266, ArduinoJSON
|
||||
|
||||
; *** Serial Monitor options
|
||||
|
@ -80,43 +84,62 @@ platform = espressif8266
|
|||
framework = arduino
|
||||
board = esp01_1m
|
||||
board_flash_mode = dout
|
||||
build_flags = -Wl,-Tesp8266.flash.1m0.ld -DMQTT_MAX_PACKET_SIZE=512 -DMY_LANGUAGE=it-IT
|
||||
build_flags = -Wl,-Tesp8266.flash.1m0.ld -DMY_LANGUAGE=it-IT
|
||||
lib_deps = PubSubClient, NeoPixelBus, IRremoteESP8266, ArduinoJSON
|
||||
|
||||
; *** Serial Monitor options
|
||||
monitor_baud = 115200
|
||||
|
||||
; Sonoff with Wemo and Hue emulation
|
||||
[env:sonoff-emulation]
|
||||
[env:sonoff-NL]
|
||||
platform = espressif8266
|
||||
framework = arduino
|
||||
board = esp01_1m
|
||||
board_flash_mode = dout
|
||||
build_flags = -Wl,-Tesp8266.flash.1m0.ld -DMQTT_MAX_PACKET_SIZE=512 -DUSE_EMULATION
|
||||
build_flags = -Wl,-Tesp8266.flash.1m0.ld -DMY_LANGUAGE=nl-NL
|
||||
lib_deps = PubSubClient, NeoPixelBus, IRremoteESP8266, ArduinoJSON
|
||||
|
||||
; Serial Monitor options
|
||||
; *** Serial Monitor options
|
||||
monitor_baud = 115200
|
||||
|
||||
[env:sonoff-PL]
|
||||
platform = espressif8266
|
||||
framework = arduino
|
||||
board = esp01_1m
|
||||
board_flash_mode = dout
|
||||
build_flags = -Wl,-Tesp8266.flash.1m0.ld -DMY_LANGUAGE=pl-PL
|
||||
lib_deps = PubSubClient, NeoPixelBus, IRremoteESP8266, ArduinoJSON
|
||||
|
||||
; *** Serial Monitor options
|
||||
monitor_baud = 115200
|
||||
|
||||
[env:sonoff-CN]
|
||||
platform = espressif8266
|
||||
framework = arduino
|
||||
board = esp01_1m
|
||||
board_flash_mode = dout
|
||||
build_flags = -Wl,-Tesp8266.flash.1m0.ld -DMY_LANGUAGE=zh-CN
|
||||
lib_deps = PubSubClient, NeoPixelBus, IRremoteESP8266, ArduinoJSON
|
||||
|
||||
; *** Serial Monitor options
|
||||
monitor_baud = 115200
|
||||
|
||||
; Sonoff minimal
|
||||
[env:sonoff-minimal]
|
||||
platform = espressif8266
|
||||
framework = arduino
|
||||
board = esp01_1m
|
||||
board_flash_mode = dout
|
||||
build_flags = -Wl,-Tesp8266.flash.1m0.ld -DMQTT_MAX_PACKET_SIZE=512 -DBE_MINIMAL
|
||||
build_flags = -Wl,-Tesp8266.flash.1m0.ld -DBE_MINIMAL
|
||||
lib_deps = PubSubClient, NeoPixelBus, IRremoteESP8266, ArduinoJSON
|
||||
|
||||
; Serial Monitor options
|
||||
monitor_baud = 115200
|
||||
|
||||
; Sonoff multiple DS18x20
|
||||
[env:sonoff-ds18x20]
|
||||
platform = espressif8266
|
||||
framework = arduino
|
||||
board = esp01_1m
|
||||
board_flash_mode = dout
|
||||
build_flags = -Wl,-Tesp8266.flash.1m0.ld -DMQTT_MAX_PACKET_SIZE=707 -DUSE_DS18x20 -DMESSZ=600
|
||||
build_flags = -Wl,-Tesp8266.flash.1m0.ld -DUSE_DS18x20
|
||||
lib_deps = PubSubClient, NeoPixelBus, IRremoteESP8266, ArduinoJSON
|
||||
|
||||
; Serial Monitor options
|
||||
|
|
|
@ -1,4 +1,28 @@
|
|||
/* 5.11.1b
|
||||
/* 5.11.1d
|
||||
* Add locale Decimal Separator to Web sensor page
|
||||
* Add command State to retrieve device state information (same data as teleperiod state and status 11 in slightly different JSON format)
|
||||
* Extent state information with Light parameters
|
||||
* Fix IRSend parameter translation (#1636)
|
||||
* Add optional login to Webserver AP mode (#1587, #1635)
|
||||
* Fix BME680 teleperiod resistance measuring (#1647)
|
||||
*
|
||||
* 5.11.1c
|
||||
* Make command color parameter input less strict to ease Hass support
|
||||
* Add ColorTemperature to light status message
|
||||
* Change PubSubClient.h define MQTT_MAX_PACKET_SIZE from 512 to 1000 for Hass support
|
||||
* Make define MESSZ dependent on PubSubClient.h define MQTT_MAX_PACKET_SIZE
|
||||
* Fix logging line length around 400 characters
|
||||
* Change module name Wemos D1 mini into Generic (#1220)
|
||||
* Revert HTML change from width=100% to style=width:100% supporting HTML5 (#1358)
|
||||
* Add experimental (still Hass python exceptions) Home Assistant Discovery for switch and light to be enabled by command SetOption19 1 (#1534)
|
||||
* Updated French Translation (#1561)
|
||||
* Fix DS18B20 temperature JSON decimal dot (#1561)
|
||||
* Add Spanish language file (#1589)
|
||||
* Update Italian Language file (#1594)
|
||||
* Consolidate WIFI_MANAGER_SEC into WIFI_CONFIG_SEC (#1616)
|
||||
* Fix Energy JSON message (#1621)
|
||||
*
|
||||
* 5.11.1b
|
||||
* Add command PowerOnState option 5 which inverts PulseTime and allows for delayed always on after power on
|
||||
* Changed OSWATCH_RESET_TIME (Blocked loop) from 30 to 120 seconds to allow slow networks (#1556)
|
||||
* Add French language file (#1561)
|
||||
|
|
|
@ -166,6 +166,7 @@
|
|||
#define D_STATUS9_MARGIN "PTH"
|
||||
#define D_STATUS10_SENSOR "SNS"
|
||||
#define D_STATUS11_STATUS "STS"
|
||||
#define D_CMND_STATE "State"
|
||||
#define D_CMND_POWER "Power"
|
||||
#define D_CMND_POWERONSTATE "PowerOnState"
|
||||
#define D_CMND_PULSETIME "PulseTime"
|
||||
|
@ -255,7 +256,18 @@
|
|||
|
||||
// Commands xdrv_02_irremote.ino
|
||||
#define D_CMND_IRSEND "IRSend"
|
||||
#define D_JSON_INVALID_JSON "Invalid JSON"
|
||||
#define D_JSON_PROTOCOL_NOT_SUPPORTED "Protocol not supported"
|
||||
#define D_JSON_IR_PROTOCOL "PROTOCOL"
|
||||
#define D_JSON_IR_BITS "BITS"
|
||||
#define D_JSON_IR_DATA "DATA"
|
||||
#define D_CMND_IRHVAC "IRHVAC"
|
||||
#define D_JSON_IRHVAC_VENDOR "VENDOR"
|
||||
#define D_JSON_IRHVAC_POWER "POWER"
|
||||
#define D_JSON_IRHVAC_MODE "MODE"
|
||||
#define D_JSON_IRHVAC_FANSPEED "FANSPEED"
|
||||
#define D_JSON_IRHVAC_TEMP "TEMP"
|
||||
#define D_JSON_IRRECEIVED "IrReceived"
|
||||
|
||||
// Commands xdrv_03_energy.ino
|
||||
#define D_CMND_POWERLOW "PowerLow"
|
||||
|
|
|
@ -335,19 +335,6 @@
|
|||
#define D_HUE_POST_ARGS "Hue POST args"
|
||||
#define D_3_RESPONSE_PACKETS_SENT "3 Antwortpakete gesendet"
|
||||
|
||||
// xdrv_02_irremote.ino
|
||||
#define D_JSON_INVALID_JSON "ungültiger JSON"
|
||||
#define D_JSON_PROTOCOL_NOT_SUPPORTED "Protokoll nicht unterstützt"
|
||||
#define D_JSON_IR_PROTOCOL "PROTOKOLL"
|
||||
#define D_JSON_IR_BITS "BITS"
|
||||
#define D_JSON_IR_DATA "DATEN"
|
||||
#define D_JSON_IRHVAC_VENDOR "HERSTELLER"
|
||||
#define D_JSON_IRHVAC_POWER "STROM"
|
||||
#define D_JSON_IRHVAC_MODE "MODUS"
|
||||
#define D_JSON_IRHVAC_FANSPEED "LÜFTERGESCHWINDIGKEIT"
|
||||
#define D_JSON_IRHVAC_TEMP "TEMPERATUR"
|
||||
#define D_JSON_IRRECEIVED "IR empfangen"
|
||||
|
||||
// xdrv_05_domoticz.ino
|
||||
#define D_DOMOTICZ_PARAMETERS "Domoticz parameters"
|
||||
#define D_DOMOTICZ_IDX "Idx"
|
||||
|
|
|
@ -335,19 +335,6 @@
|
|||
#define D_HUE_POST_ARGS "Hue POST args"
|
||||
#define D_3_RESPONSE_PACKETS_SENT "3 response packets sent"
|
||||
|
||||
// xdrv_02_irremote.ino
|
||||
#define D_JSON_INVALID_JSON "Invalid JSON"
|
||||
#define D_JSON_PROTOCOL_NOT_SUPPORTED "Protocol not supported"
|
||||
#define D_JSON_IR_PROTOCOL "PROTOCOL"
|
||||
#define D_JSON_IR_BITS "BITS"
|
||||
#define D_JSON_IR_DATA "DATA"
|
||||
#define D_JSON_IRHVAC_VENDOR "VENDOR"
|
||||
#define D_JSON_IRHVAC_POWER "POWER"
|
||||
#define D_JSON_IRHVAC_MODE "MODE"
|
||||
#define D_JSON_IRHVAC_FANSPEED "FANSPEED"
|
||||
#define D_JSON_IRHVAC_TEMP "TEMP"
|
||||
#define D_JSON_IRRECEIVED "IrReceived"
|
||||
|
||||
// xdrv_05_domoticz.ino
|
||||
#define D_DOMOTICZ_PARAMETERS "Domoticz parameters"
|
||||
#define D_DOMOTICZ_IDX "Idx"
|
||||
|
|
|
@ -0,0 +1,456 @@
|
|||
/*
|
||||
es-AR.h - localization for Spanish - Argentina for Sonoff-Tasmota
|
||||
|
||||
Copyright (C) 2018 Adrian Scillato
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef _LANGUAGE_ES_AR_H_
|
||||
#define _LANGUAGE_ES_AR_H_
|
||||
|
||||
/*************************** ATTENTION *******************************\
|
||||
*
|
||||
* Due to memory constraints only UTF-8 is supported.
|
||||
* To save code space keep text as short as possible.
|
||||
* Time and Date provided by SDK can not be localized (yet).
|
||||
* Use online command StateText to translate ON, OFF, HOLD and TOGGLE.
|
||||
* Use online command Prefix to translate cmnd, stat and tele.
|
||||
*
|
||||
\*********************************************************************/
|
||||
|
||||
// "2017-03-07T11:08:02" - ISO8601:2004
|
||||
#define D_YEAR_MONTH_SEPARATOR "-"
|
||||
#define D_MONTH_DAY_SEPARATOR "-"
|
||||
#define D_DATE_TIME_SEPARATOR "T"
|
||||
#define D_HOUR_MINUTE_SEPARATOR ":"
|
||||
#define D_MINUTE_SECOND_SEPARATOR ":"
|
||||
|
||||
#define D_DAY3LIST "DomLunMarMieJueVieSab"
|
||||
#define D_MONTH3LIST "EneFebMarAbrMayJunJulAgoSepOctNovDic"
|
||||
|
||||
// Non JSON decimal separator
|
||||
#define D_DECIMAL_SEPARATOR ","
|
||||
|
||||
// Common
|
||||
#define D_ADMIN "Admin"
|
||||
#define D_AIR_QUALITY "Calidad del Aire"
|
||||
#define D_AP "AP" // Access Point
|
||||
#define D_AS "como"
|
||||
#define D_AUTO "AUTO"
|
||||
#define D_BLINK "Blink"
|
||||
#define D_BLINKOFF "BlinkOff"
|
||||
#define D_BOOT_COUNT "Conteo Reinicios"
|
||||
#define D_BRIGHTLIGHT "Brillo"
|
||||
#define D_BUTTON "Botón"
|
||||
#define D_BY "por" // Written by me
|
||||
#define D_BYTES "Bytes"
|
||||
#define D_CELSIUS "Celsius"
|
||||
#define D_CO2 "CO2"
|
||||
#define D_CODE "código" // Button code
|
||||
#define D_COLDLIGHT "Fría"
|
||||
#define D_COMMAND "Comando"
|
||||
#define D_CONNECTED "Conectado"
|
||||
#define D_COUNT "Conteo"
|
||||
#define D_COUNTER "Contador"
|
||||
#define D_CURRENT "Corriente" // As in Voltage and Current
|
||||
#define D_DATA "Datos"
|
||||
#define D_DARKLIGHT "Oscura"
|
||||
#define D_DEBUG "Debug"
|
||||
#define D_DISABLED "Deshabilitado"
|
||||
#define D_DNS_SERVER "DNS Server"
|
||||
#define D_DONE "Listo"
|
||||
#define D_DST_TIME "DST"
|
||||
#define D_EMULATION "Emulación"
|
||||
#define D_ENABLED "Habilitado"
|
||||
#define D_ERASE "Borrar"
|
||||
#define D_ERROR "Error"
|
||||
#define D_FAHRENHEIT "Fahrenheit"
|
||||
#define D_FAILED "Fallo"
|
||||
#define D_FALLBACK "Fallback"
|
||||
#define D_FALLBACK_TOPIC "FallbackTopic"
|
||||
#define D_FALSE "Falso"
|
||||
#define D_FILE "Archivo"
|
||||
#define D_FREE_MEMORY "Memoria Libre"
|
||||
#define D_GAS "Gas"
|
||||
#define D_GATEWAY "Gateway"
|
||||
#define D_GROUP "Grupo"
|
||||
#define D_HOST "Host"
|
||||
#define D_HOSTNAME "Hostname"
|
||||
#define D_HUMIDITY "Humedad"
|
||||
#define D_ILLUMINANCE "Luminancia"
|
||||
#define D_IMMEDIATE "inmediato" // Button immediate
|
||||
#define D_INDEX "Índice"
|
||||
#define D_INFO "Información"
|
||||
#define D_INITIALIZED "Inicializado"
|
||||
#define D_IP_ADDRESS "Dirección IP"
|
||||
#define D_LIGHT "Luz"
|
||||
#define D_LWT "LWT"
|
||||
#define D_MODULE "Módulo"
|
||||
#define D_MQTT "MQTT"
|
||||
#define D_MULTI_PRESS "multi-press"
|
||||
#define D_NOISE "Ruido"
|
||||
#define D_NONE "Ninguno"
|
||||
#define D_OFF "Apagado"
|
||||
#define D_OFFLINE "Offline"
|
||||
#define D_OK "Ok"
|
||||
#define D_ON "Encendido"
|
||||
#define D_ONLINE "Online"
|
||||
#define D_PASSWORD "Clave"
|
||||
#define D_PORT "Puerto"
|
||||
#define D_POWER_FACTOR "Factor de Potencia"
|
||||
#define D_POWERUSAGE "Potencia"
|
||||
#define D_PRESSURE "Presión"
|
||||
#define D_PRESSUREATSEALEVEL "Presión al nivel del mar"
|
||||
#define D_PROGRAM_FLASH_SIZE "Tamaño de Flash de Programa"
|
||||
#define D_PROGRAM_SIZE "Tamaño Programa"
|
||||
#define D_PROJECT "Proyecto"
|
||||
#define D_RECEIVED "Recibido"
|
||||
#define D_RESTART "Reinicio"
|
||||
#define D_RESTARTING "Reiniciando"
|
||||
#define D_RESTART_REASON "Causa Reinicio"
|
||||
#define D_RESTORE "Restauración"
|
||||
#define D_RETAINED "Grabado"
|
||||
#define D_SAVE "Grabar"
|
||||
#define D_SENSOR "Sensor"
|
||||
#define D_SSID "SSId"
|
||||
#define D_START "Iniciar"
|
||||
#define D_STD_TIME "STD"
|
||||
#define D_STOP "Detener"
|
||||
#define D_SUBNET_MASK "Máscara Subred"
|
||||
#define D_SUBSCRIBE_TO "Suscribir a"
|
||||
#define D_SUCCESSFUL "Exitosa"
|
||||
#define D_TEMPERATURE "Temperatura"
|
||||
#define D_TO "a"
|
||||
#define D_TOGGLE "Conmutar"
|
||||
#define D_TOPIC "Topic"
|
||||
#define D_TRANSMIT "Transmitir"
|
||||
#define D_TRUE "Verdadero"
|
||||
#define D_UPGRADE "Actualización"
|
||||
#define D_UPLOAD "Carga"
|
||||
#define D_UPTIME "Tiempo Encendido"
|
||||
#define D_USER "Usuario"
|
||||
#define D_UTC_TIME "UTC"
|
||||
#define D_UV_LEVEL "Nivel UV"
|
||||
#define D_VERSION "Versión"
|
||||
#define D_VOLTAGE "Tensión"
|
||||
#define D_WARMLIGHT "Cálida"
|
||||
#define D_WEB_SERVER "Servidor Web"
|
||||
|
||||
// sonoff.ino
|
||||
#define D_WARNING_MINIMAL_VERSION "Precaución, esta versión no salva los cambios"
|
||||
#define D_LEVEL_10 "level 1-0"
|
||||
#define D_LEVEL_01 "level 0-1"
|
||||
#define D_SERIAL_LOGGING_DISABLED "Log serial deshabilitado"
|
||||
#define D_SYSLOG_LOGGING_REENABLED "Syslog re-habilitado"
|
||||
|
||||
#define D_SET_BAUDRATE_TO "Baudrate a"
|
||||
#define D_RECEIVED_TOPIC "Topic Recibido"
|
||||
#define D_DATA_SIZE "Tamaño de Datos"
|
||||
#define D_ANALOG_INPUT "Entrada Analógica"
|
||||
|
||||
#define D_FINGERPRINT "Verificar TLS fingerprint..."
|
||||
#define D_TLS_CONNECT_FAILED_TO "Falló Conección TLS a"
|
||||
#define D_RETRY_IN "Reintentando"
|
||||
#define D_VERIFIED "Verificado"
|
||||
#define D_INSECURE "Conección insegura por Fingerprint no válido"
|
||||
#define D_CONNECT_FAILED_TO "Falló Conección a"
|
||||
|
||||
// support.ino
|
||||
#define D_OSWATCH "osWatch"
|
||||
#define D_BLOCKED_LOOP "Ciclo Bloqueado"
|
||||
#define D_WPS_FAILED_WITH_STATUS "WPSconfig FALLÓ con estado"
|
||||
#define D_ACTIVE_FOR_3_MINUTES "activo por 3 minutos"
|
||||
#define D_FAILED_TO_START "falló inicio"
|
||||
#define D_PATCH_ISSUE_2186 "Patch issue 2186"
|
||||
#define D_CONNECTING_TO_AP "Connectando a AP"
|
||||
#define D_IN_MODE "en modo"
|
||||
#define D_CONNECT_FAILED_NO_IP_ADDRESS "Falló Conección, Dirección IP no recibida"
|
||||
#define D_CONNECT_FAILED_AP_NOT_REACHED "Falló Conección, AP no pudo ser contactado"
|
||||
#define D_CONNECT_FAILED_WRONG_PASSWORD "Falló Conección, clave de AP incorrecta"
|
||||
#define D_CONNECT_FAILED_AP_TIMEOUT "Falló Conección, timeout de AP"
|
||||
#define D_ATTEMPTING_CONNECTION "Intentando conectar..."
|
||||
#define D_CHECKING_CONNECTION "Probando conección..."
|
||||
#define D_QUERY_DONE "Consulta lista. Servicio MQTT encontrado"
|
||||
#define D_MQTT_SERVICE_FOUND "Servicio MQTT encontrado en"
|
||||
#define D_FOUND_AT "encontrado en"
|
||||
#define D_SYSLOG_HOST_NOT_FOUND "Syslog Host no encontrado"
|
||||
|
||||
// settings.ino
|
||||
#define D_SAVED_TO_FLASH_AT "Grabado a la flash en"
|
||||
#define D_LOADED_FROM_FLASH_AT "Cargado desde flash en"
|
||||
#define D_USE_DEFAULTS "Usar valores por defecto"
|
||||
#define D_ERASED_SECTOR "Sector borrado"
|
||||
|
||||
// webserver.ino
|
||||
#define D_MINIMAL_FIRMWARE_PLEASE_UPGRADE "firmware MÍNIMO - actualice por favor"
|
||||
#define D_WEBSERVER_ACTIVE_ON "Servidor web activo en"
|
||||
#define D_WITH_IP_ADDRESS "con dirección IP"
|
||||
#define D_WEBSERVER_STOPPED "Servidor web detenido"
|
||||
#define D_FILE_NOT_FOUND "Archivo No Encontrado"
|
||||
#define D_REDIRECTED "Redireccinado al portal captivo"
|
||||
#define D_WIFIMANAGER_SET_ACCESSPOINT_AND_STATION "Wifimanager como AccessPoint y Estación"
|
||||
#define D_WIFIMANAGER_SET_ACCESSPOINT "Wifimanager como AccessPoint"
|
||||
#define D_TRYING_TO_CONNECT "Intentado conectar dispositivo a la red"
|
||||
|
||||
#define D_RESTART_IN "Reinicio en"
|
||||
#define D_SECONDS "segundos"
|
||||
#define D_DEVICE_WILL_RESTART "El dispositivo se reiniciará en pocos segundos"
|
||||
#define D_BUTTON_TOGGLE "Alternar ON/OFF"
|
||||
#define D_CONFIGURATION "Configuración"
|
||||
#define D_INFORMATION "Información"
|
||||
#define D_FIRMWARE_UPGRADE "Actualización Firmware"
|
||||
#define D_CONSOLE "Consola"
|
||||
#define D_CONFIRM_RESTART "Confirmar Reinicio"
|
||||
|
||||
#define D_CONFIGURE_MODULE "Configuración del Módulo"
|
||||
#define D_CONFIGURE_WIFI "Configuración WiFi"
|
||||
#define D_CONFIGURE_MQTT "Configuración MQTT"
|
||||
#define D_CONFIGURE_DOMOTICZ "Configuración Domoticz"
|
||||
#define D_CONFIGURE_LOGGING "Configuración Logging"
|
||||
#define D_CONFIGURE_OTHER "Configuración Extra"
|
||||
#define D_CONFIRM_RESET_CONFIGURATION "Confirmar Reset Configuración"
|
||||
#define D_RESET_CONFIGURATION "Reset de Configuración"
|
||||
#define D_BACKUP_CONFIGURATION "Backup de Configuración"
|
||||
#define D_RESTORE_CONFIGURATION "Restaurar Configuración"
|
||||
#define D_MAIN_MENU "Menú Principal"
|
||||
|
||||
#define D_MODULE_PARAMETERS "Parámetros del módulo"
|
||||
#define D_MODULE_TYPE "Tipo módulo"
|
||||
#define D_GPIO "GPIO"
|
||||
#define D_SERIAL_IN "Serial In"
|
||||
#define D_SERIAL_OUT "Serial Out"
|
||||
|
||||
#define D_WIFI_PARAMETERS "Parámetros Wifi"
|
||||
#define D_SCAN_FOR_WIFI_NETWORKS "Buscar redes wifi"
|
||||
#define D_SCAN_DONE "Busqueda finalizada"
|
||||
#define D_NO_NETWORKS_FOUND "Ninguna red encontrada"
|
||||
#define D_REFRESH_TO_SCAN_AGAIN "Recargar página para buscar nuevamente"
|
||||
#define D_DUPLICATE_ACCESSPOINT "AccessPoint duplicado"
|
||||
#define D_SKIPPING_LOW_QUALITY "Ignorado debido a baja calidad"
|
||||
#define D_RSSI "RSSI"
|
||||
#define D_WEP "WEP"
|
||||
#define D_WPA_PSK "WPA PSK"
|
||||
#define D_WPA2_PSK "WPA2 PSK"
|
||||
#define D_AP1_SSID "SSId AP1"
|
||||
#define D_AP1_PASSWORD "Clave AP1"
|
||||
#define D_AP2_SSID "SSId AP2"
|
||||
#define D_AP2_PASSWORD "Clave AP2"
|
||||
|
||||
#define D_MQTT_PARAMETERS "Parámetros MQTT"
|
||||
#define D_CLIENT "Cliente"
|
||||
#define D_FULL_TOPIC "Full Topic"
|
||||
|
||||
#define D_LOGGING_PARAMETERS "Parámetros Logging"
|
||||
#define D_SERIAL_LOG_LEVEL "Nivel de log Serial"
|
||||
#define D_WEB_LOG_LEVEL "Nivel de log Web"
|
||||
#define D_SYS_LOG_LEVEL "Nivel de Syslog"
|
||||
#define D_MORE_DEBUG "Mas Debug"
|
||||
#define D_SYSLOG_HOST "Host del Syslog"
|
||||
#define D_SYSLOG_PORT "Puerto del Syslog"
|
||||
#define D_TELEMETRY_PERIOD "Período de Telemetría"
|
||||
|
||||
#define D_OTHER_PARAMETERS "Otros parámetros"
|
||||
#define D_WEB_ADMIN_PASSWORD "Clave Administrador Web"
|
||||
#define D_MQTT_ENABLE "Habilitar MQTT"
|
||||
#define D_FRIENDLY_NAME "Nombre Amigable"
|
||||
#define D_BELKIN_WEMO "Belkin WeMo"
|
||||
#define D_HUE_BRIDGE "Hue Bridge"
|
||||
#define D_SINGLE_DEVICE "dispositivo simple"
|
||||
#define D_MULTI_DEVICE "dispositivo múltiple"
|
||||
|
||||
#define D_SAVE_CONFIGURATION "Grabar configuración"
|
||||
#define D_CONFIGURATION_SAVED "Configuración grabada"
|
||||
#define D_CONFIGURATION_RESET "Configuración restablecida"
|
||||
|
||||
#define D_PROGRAM_VERSION "Versión del Programa"
|
||||
#define D_BUILD_DATE_AND_TIME "Fecha y Hora de la Compilación"
|
||||
#define D_CORE_AND_SDK_VERSION "Versión Core/SDK"
|
||||
#define D_FLASH_WRITE_COUNT "Contador de escritura en Flash"
|
||||
#define D_MAC_ADDRESS "Dirección MAC"
|
||||
#define D_MQTT_HOST "Host MQTT"
|
||||
#define D_MQTT_PORT "Puerto MQTT"
|
||||
#define D_MQTT_CLIENT "Cliente MQTT"
|
||||
#define D_MQTT_USER "Usuario MQTT"
|
||||
#define D_MQTT_TOPIC "Topic MQTT"
|
||||
#define D_MQTT_GROUP_TOPIC "Group Topic MQTT"
|
||||
#define D_MQTT_FULL_TOPIC "Full Topic MQTT"
|
||||
#define D_MDNS_DISCOVERY "mDNS Discovery"
|
||||
#define D_MDNS_ADVERTISE "mDNS Advertise"
|
||||
#define D_ESP_CHIP_ID "ESP Chip Id"
|
||||
#define D_FLASH_CHIP_ID "Flash Chip Id"
|
||||
#define D_FLASH_CHIP_SIZE "Tamaño Flash"
|
||||
#define D_FREE_PROGRAM_SPACE "Memoria de Programa Libre"
|
||||
|
||||
#define D_UPGRADE_BY_WEBSERVER "Actualizar por servidor web"
|
||||
#define D_OTA_URL "OTA Url"
|
||||
#define D_START_UPGRADE "Comenzar actualización"
|
||||
#define D_UPGRADE_BY_FILE_UPLOAD "Actualizar cargando archivo bin"
|
||||
#define D_UPLOAD_STARTED "Cargando archivo"
|
||||
#define D_UPGRADE_STARTED "Actualización iniciada"
|
||||
#define D_UPLOAD_DONE "Carga finalizada"
|
||||
#define D_UPLOAD_ERR_1 "Ningún archivo seleccionado"
|
||||
#define D_UPLOAD_ERR_2 "Espacio insuficiente"
|
||||
#define D_UPLOAD_ERR_3 "Magic byte no corresponde a 0xE9"
|
||||
#define D_UPLOAD_ERR_4 "El tamaño de la memoria de programa es mayor que la de la flash"
|
||||
#define D_UPLOAD_ERR_5 "Error de comparación del buffer de carga"
|
||||
#define D_UPLOAD_ERR_6 "Carga fallida. Habilitar logging 3"
|
||||
#define D_UPLOAD_ERR_7 "Carga cancelada"
|
||||
#define D_UPLOAD_ERR_8 "Archivo no válido"
|
||||
#define D_UPLOAD_ERR_9 "Archivo muy grande"
|
||||
#define D_UPLOAD_ERROR_CODE "Código de error de carga"
|
||||
|
||||
#define D_ENTER_COMMAND "Ingresar comando"
|
||||
#define D_ENABLE_WEBLOG_FOR_RESPONSE "Habilitar weblog 2 si desea respuesta"
|
||||
#define D_NEED_USER_AND_PASSWORD "Se necesita user=<username>&password=<password>"
|
||||
|
||||
// xdrv_wemohue.ino
|
||||
#define D_MULTICAST_DISABLED "Multicast deshabilitado"
|
||||
#define D_MULTICAST_REJOINED "Multicast (re)conectado"
|
||||
#define D_MULTICAST_JOIN_FAILED "Conección Multicast fallida"
|
||||
#define D_FAILED_TO_SEND_RESPONSE "Falla al enviar respuesta"
|
||||
|
||||
#define D_WEMO "WeMo"
|
||||
#define D_WEMO_BASIC_EVENT "Evento base de WeMo"
|
||||
#define D_WEMO_EVENT_SERVICE "Evento de servicio de WeMo"
|
||||
#define D_WEMO_META_SERVICE "Meta Servicio de WeMo"
|
||||
#define D_WEMO_SETUP "Configuración de WeMo"
|
||||
#define D_RESPONSE_SENT "Respuesta enviada"
|
||||
|
||||
#define D_HUE "Hue"
|
||||
#define D_HUE_BRIDGE_SETUP "Configuración Hue"
|
||||
#define D_HUE_API_NOT_IMPLEMENTED "API de Hue no implementada"
|
||||
#define D_HUE_API "Hue API"
|
||||
#define D_HUE_POST_ARGS "Hue POST args"
|
||||
#define D_3_RESPONSE_PACKETS_SENT "3 paquetes de respuesta enviados"
|
||||
|
||||
// xdrv_05_domoticz.ino
|
||||
#define D_DOMOTICZ_PARAMETERS "Parámetros Domoticz"
|
||||
#define D_DOMOTICZ_IDX "Idx"
|
||||
#define D_DOMOTICZ_KEY_IDX "Key idx"
|
||||
#define D_DOMOTICZ_SWITCH_IDX "Switch idx"
|
||||
#define D_DOMOTICZ_SENSOR_IDX "Sensor idx"
|
||||
#define D_DOMOTICZ_TEMP "Temp"
|
||||
#define D_DOMOTICZ_TEMP_HUM "Temp,Hum"
|
||||
#define D_DOMOTICZ_TEMP_HUM_BARO "Temp,Hum,Baro"
|
||||
#define D_DOMOTICZ_POWER_ENERGY "Potencia,Energía"
|
||||
#define D_DOMOTICZ_ILLUMINANCE "Luminancia"
|
||||
#define D_DOMOTICZ_COUNT "Contador"
|
||||
#define D_DOMOTICZ_VOLTAGE "Voltaje"
|
||||
#define D_DOMOTICZ_CURRENT "Corriente"
|
||||
#define D_DOMOTICZ_AIRQUALITY "Calidad del Aire"
|
||||
#define D_DOMOTICZ_UPDATE_TIMER "Intervalo de refresco"
|
||||
|
||||
// xdrv_03_energy.ino
|
||||
#define D_ENERGY_TODAY "Energía Hoy"
|
||||
#define D_ENERGY_YESTERDAY "Energía Ayer"
|
||||
#define D_ENERGY_TOTAL "Energía Total"
|
||||
|
||||
// xsns_05_ds18b20.ino
|
||||
#define D_SENSOR_BUSY "Sensor ocupado"
|
||||
#define D_SENSOR_CRC_ERROR "Error CRC del Sensor"
|
||||
#define D_SENSORS_FOUND "Sensores encontrados"
|
||||
|
||||
// xsns_06_dht.ino
|
||||
#define D_TIMEOUT_WAITING_FOR "Espera de timeout por"
|
||||
#define D_START_SIGNAL_LOW "iniciar señal baja"
|
||||
#define D_START_SIGNAL_HIGH "iniciar señal alta"
|
||||
#define D_PULSE "pulso"
|
||||
#define D_CHECKSUM_FAILURE "Checksum fallido"
|
||||
|
||||
// xsns_07_sht1x.ino
|
||||
#define D_SENSOR_DID_NOT_ACK_COMMAND "Sensor no ha enviado el comando ACK"
|
||||
#define D_SHT1X_FOUND "SHT1X encontrado"
|
||||
|
||||
// xsns_18_pms5003.ino
|
||||
#define D_STANDARD_CONCENTRATION "Concentración Standard"
|
||||
#define D_ENVIRONMENTAL_CONCENTRATION "Concentración en Medio Ambiente"
|
||||
#define D_PARTICALS_BEYOND "Partículas sobre"
|
||||
|
||||
// sonoff_template.h
|
||||
// Max string length is 8 characters including suffixes
|
||||
#define D_SENSOR_NONE "Ninguno"
|
||||
#define D_SENSOR_DHT11 "DHT11"
|
||||
#define D_SENSOR_AM2301 "AM2301"
|
||||
#define D_SENSOR_SI7021 "SI7021"
|
||||
#define D_SENSOR_DS18X20 "DS18x20"
|
||||
#define D_SENSOR_I2C_SCL "I2C SCL"
|
||||
#define D_SENSOR_I2C_SDA "I2C SDA"
|
||||
#define D_SENSOR_WS2812 "WS2812"
|
||||
#define D_SENSOR_IRSEND "IR TX"
|
||||
#define D_SENSOR_SWITCH "Llave" // Suffix "1"
|
||||
#define D_SENSOR_BUTTON "Botón" // Suffix "1"
|
||||
#define D_SENSOR_RELAY "Relé" // Suffix "1i"
|
||||
#define D_SENSOR_LED "Led" // Suffix "1i"
|
||||
#define D_SENSOR_PWM "PWM" // Suffix "1"
|
||||
#define D_SENSOR_COUNTER "Counter" // Suffix "1"
|
||||
#define D_SENSOR_IRRECV "IR RX"
|
||||
#define D_SENSOR_MHZ_RX "MHZ Rx"
|
||||
#define D_SENSOR_MHZ_TX "MHZ Tx"
|
||||
#define D_SENSOR_PZEM_RX "PZEM Rx"
|
||||
#define D_SENSOR_PZEM_TX "PZEM Tx"
|
||||
#define D_SENSOR_SAIR_RX "SAir Rx"
|
||||
#define D_SENSOR_SAIR_TX "SAir Tx"
|
||||
#define D_SENSOR_SPI_CS "SPI CS"
|
||||
#define D_SENSOR_SPI_DC "SPI DC"
|
||||
#define D_SENSOR_BACKLIGHT "BkLight"
|
||||
#define D_SENSOR_PMS5003 "PMS5003"
|
||||
|
||||
// Units
|
||||
#define D_UNIT_AMPERE "A"
|
||||
#define D_UNIT_HOUR "Hr"
|
||||
#define D_UNIT_KILOOHM "kOhm"
|
||||
#define D_UNIT_KILOWATTHOUR "kWh"
|
||||
#define D_UNIT_LUX "lx"
|
||||
#define D_UNIT_MICROGRAM_PER_CUBIC_METER "ug/m3"
|
||||
#define D_UNIT_MICROMETER "um"
|
||||
#define D_UNIT_MICROSECOND "us"
|
||||
#define D_UNIT_MILLIAMPERE "mA"
|
||||
#define D_UNIT_MILLISECOND "ms"
|
||||
#define D_UNIT_MINUTE "Min"
|
||||
#define D_UNIT_PARTS_PER_DECILITER "ppd"
|
||||
#define D_UNIT_PARTS_PER_MILLION "ppm"
|
||||
#define D_UNIT_PRESSURE "hPa"
|
||||
#define D_UNIT_SECOND "seg"
|
||||
#define D_UNIT_SECTORS "sectores"
|
||||
#define D_UNIT_VOLT "V"
|
||||
#define D_UNIT_WATT "W"
|
||||
#define D_UNIT_WATTHOUR "Wh"
|
||||
|
||||
// Log message prefix
|
||||
#define D_LOG_APPLICATION "APP: " // Application
|
||||
#define D_LOG_BRIDGE "BRG: " // Bridge
|
||||
#define D_LOG_CONFIG "CFG: " // Settings
|
||||
#define D_LOG_COMMAND "CMD: " // Command
|
||||
#define D_LOG_DEBUG "DBG: " // Debug
|
||||
#define D_LOG_DHT "DHT: " // DHT sensor
|
||||
#define D_LOG_DOMOTICZ "DOM: " // Domoticz
|
||||
#define D_LOG_DSB "DSB: " // DS18xB20 sensor
|
||||
#define D_LOG_HTTP "HTP: " // HTTP webserver
|
||||
#define D_LOG_I2C "I2C: " // I2C
|
||||
#define D_LOG_IRR "IRR: " // Infra Red Received
|
||||
#define D_LOG_LOG "LOG: " // Logging
|
||||
#define D_LOG_MODULE "MOD: " // Module
|
||||
#define D_LOG_MDNS "DNS: " // mDNS
|
||||
#define D_LOG_MQTT "MQT: " // MQTT
|
||||
#define D_LOG_OTHER "OTH: " // Other
|
||||
#define D_LOG_RESULT "RSL: " // Result
|
||||
#define D_LOG_RFR "RFR: " // RF Received
|
||||
#define D_LOG_SERIAL "SER: " // Serial
|
||||
#define D_LOG_SHT1 "SHT: " // SHT1x sensor
|
||||
#define D_LOG_UPLOAD "UPL: " // Upload
|
||||
#define D_LOG_UPNP "UPP: " // UPnP
|
||||
#define D_LOG_WIFI "WIF: " // Wifi
|
||||
|
||||
#endif // _LANGUAGE_ES_AR_H_
|
|
@ -57,7 +57,7 @@
|
|||
#define D_BY "par" // Written by me
|
||||
#define D_BYTES "Bytes"
|
||||
#define D_CELSIUS "Celsius"
|
||||
#define D_CO2 "Dioxyde arbone"
|
||||
#define D_CO2 "Dioxyde de carbone"
|
||||
#define D_CODE "code" // Button code
|
||||
#define D_COLDLIGHT "Froid"
|
||||
#define D_COMMAND "Commande"
|
||||
|
@ -149,7 +149,7 @@
|
|||
#define D_WEB_SERVER "Serveur web"
|
||||
|
||||
// sonoff.ino
|
||||
#define D_WARNING_MINIMAL_VERSION "WARNING This version does not support persistent settings"
|
||||
#define D_WARNING_MINIMAL_VERSION "ATTENTION Cette version ne supporte pas les réglages persistants"
|
||||
#define D_LEVEL_10 "level 1-0"
|
||||
#define D_LEVEL_01 "level 0-1"
|
||||
#define D_SERIAL_LOGGING_DISABLED "Journalisation série désactivé"
|
||||
|
@ -264,7 +264,7 @@
|
|||
#define D_OTHER_PARAMETERS "Autres paramètres"
|
||||
#define D_WEB_ADMIN_PASSWORD "Mot de passe Web Admin"
|
||||
#define D_MQTT_ENABLE "MQTT activé"
|
||||
#define D_FRIENDLY_NAME "Nom d'usage"
|
||||
#define D_FRIENDLY_NAME "Surnom"
|
||||
#define D_BELKIN_WEMO "Belkin WeMo"
|
||||
#define D_HUE_BRIDGE "Hue Bridge"
|
||||
#define D_SINGLE_DEVICE "module unique"
|
||||
|
@ -335,19 +335,6 @@
|
|||
#define D_HUE_POST_ARGS "Hue POST args"
|
||||
#define D_3_RESPONSE_PACKETS_SENT "3 paquets response envoyés"
|
||||
|
||||
// xdrv_02_irremote.ino
|
||||
#define D_JSON_INVALID_JSON "JSON Invalide"
|
||||
#define D_JSON_PROTOCOL_NOT_SUPPORTED "Protocole non supporté"
|
||||
#define D_JSON_IR_PROTOCOL "PROTOCOL"
|
||||
#define D_JSON_IR_BITS "BITS"
|
||||
#define D_JSON_IR_DATA "DATA"
|
||||
#define D_JSON_IRHVAC_VENDOR "VENDOR"
|
||||
#define D_JSON_IRHVAC_POWER "POWER"
|
||||
#define D_JSON_IRHVAC_MODE "MODE"
|
||||
#define D_JSON_IRHVAC_FANSPEED "FANSPEED"
|
||||
#define D_JSON_IRHVAC_TEMP "TEMP"
|
||||
#define D_JSON_IRRECEIVED "IrReceived"
|
||||
|
||||
// xdrv_05_domoticz.ino
|
||||
#define D_DOMOTICZ_PARAMETERS "Paramètres Domoticz"
|
||||
#define D_DOMOTICZ_IDX "Idx"
|
||||
|
@ -383,13 +370,13 @@
|
|||
#define D_CHECKSUM_FAILURE "Echec checksum"
|
||||
|
||||
// xsns_07_sht1x.ino
|
||||
#define D_SENSOR_DID_NOT_ACK_COMMAND "Sensor did not ACK command"
|
||||
#define D_SENSOR_DID_NOT_ACK_COMMAND "Le capteur n'a pas ACK la commande"
|
||||
#define D_SHT1X_FOUND "SHT1X found"
|
||||
|
||||
// xsns_18_pms5003.ino
|
||||
#define D_STANDARD_CONCENTRATION "Standard Concentration"
|
||||
#define D_ENVIRONMENTAL_CONCENTRATION "Environmental Concentration"
|
||||
#define D_PARTICALS_BEYOND "Particals beyond"
|
||||
#define D_STANDARD_CONCENTRATION "Concentration standard"
|
||||
#define D_ENVIRONMENTAL_CONCENTRATION "Concentration environmentale"
|
||||
#define D_PARTICALS_BEYOND "Particules au-delà"
|
||||
|
||||
// sonoff_template.h
|
||||
// Max string length is 8 characters including suffixes
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
#define D_AUTO "AUTO"
|
||||
#define D_BLINK "Blink"
|
||||
#define D_BLINKOFF "BlinkOff"
|
||||
#define D_BOOT_COUNT "Boot Count"
|
||||
#define D_BOOT_COUNT "Numero di boot"
|
||||
#define D_BRIGHTLIGHT "Luminoso"
|
||||
#define D_BUTTON "Pulsante"
|
||||
#define D_BY "da" // Written by me
|
||||
|
@ -60,7 +60,7 @@
|
|||
#define D_CO2 "CO2"
|
||||
#define D_CODE "codice" // Button code
|
||||
#define D_COLDLIGHT "Fredda"
|
||||
#define D_COMMAND "Command"
|
||||
#define D_COMMAND "Comando"
|
||||
#define D_CONNECTED "Connesso"
|
||||
#define D_COUNT "Conteggio"
|
||||
#define D_COUNTER "Contatore"
|
||||
|
@ -74,30 +74,30 @@
|
|||
#define D_DST_TIME "DST"
|
||||
#define D_EMULATION "Emulazione"
|
||||
#define D_ENABLED "Abilitato"
|
||||
#define D_ERASE "Erase"
|
||||
#define D_ERROR "Error"
|
||||
#define D_ERASE "Cancellare"
|
||||
#define D_ERROR "Errore"
|
||||
#define D_FAHRENHEIT "Fahrenheit"
|
||||
#define D_FAILED "Fallito"
|
||||
#define D_FALLBACK "Fallback"
|
||||
#define D_FALLBACK "Riserva"
|
||||
#define D_FALLBACK_TOPIC "Topic Riserva"
|
||||
#define D_FALSE "False"
|
||||
#define D_FALSE "Falso"
|
||||
#define D_FILE "File"
|
||||
#define D_FREE_MEMORY "Memoria Libera"
|
||||
#define D_GAS "Gas"
|
||||
#define D_GATEWAY "Gateway"
|
||||
#define D_GROUP "Gruppo"
|
||||
#define D_HOST "Host"
|
||||
#define D_HOSTNAME "Hostname"
|
||||
#define D_HOSTNAME "Nome Host"
|
||||
#define D_HUMIDITY "Umidita'"
|
||||
#define D_ILLUMINANCE "Illuminazione"
|
||||
#define D_IMMEDIATE "immediato" // Button immediate
|
||||
#define D_INDEX "Index"
|
||||
#define D_INDEX "Indice"
|
||||
#define D_INFO "Info"
|
||||
#define D_INITIALIZED "Inizializzato"
|
||||
#define D_IP_ADDRESS "Indirizzo IP"
|
||||
#define D_LIGHT "Luce"
|
||||
#define D_LWT "LWT"
|
||||
#define D_MODULE "Module"
|
||||
#define D_MODULE "Modulo"
|
||||
#define D_MQTT "MQTT"
|
||||
#define D_MULTI_PRESS "multi-pressione"
|
||||
#define D_NOISE "Rumore"
|
||||
|
@ -115,10 +115,10 @@
|
|||
#define D_PRESSUREATSEALEVEL "Pressione al livello del mare"
|
||||
#define D_PROGRAM_FLASH_SIZE "Dimensione Flash Programma"
|
||||
#define D_PROGRAM_SIZE "Dimensione Programma"
|
||||
#define D_PROJECT "Project"
|
||||
#define D_PROJECT "Progetto"
|
||||
#define D_RECEIVED "Ricevuto"
|
||||
#define D_RESTART "Riavvio"
|
||||
#define D_RESTARTING "Restarting"
|
||||
#define D_RESTARTING "Riavviando"
|
||||
#define D_RESTART_REASON "Causa Riavvio"
|
||||
#define D_RESTORE "ripristino"
|
||||
#define D_RETAINED "salvato"
|
||||
|
@ -130,8 +130,8 @@
|
|||
#define D_STOP "Stop"
|
||||
#define D_SUBNET_MASK "Maschera sottorete"
|
||||
#define D_SUBSCRIBE_TO "Sottoscrivi a"
|
||||
#define D_SUCCESSFUL "Successful"
|
||||
#define D_TEMPERATURE "Temperature"
|
||||
#define D_SUCCESSFUL "Riuscito"
|
||||
#define D_TEMPERATURE "Temperatura"
|
||||
#define D_TO "a"
|
||||
#define D_TOGGLE "Toggle"
|
||||
#define D_TOPIC "Topic"
|
||||
|
@ -143,13 +143,13 @@
|
|||
#define D_USER "Utente"
|
||||
#define D_UTC_TIME "UTC"
|
||||
#define D_UV_LEVEL "Livello UV"
|
||||
#define D_VERSION "Version"
|
||||
#define D_VERSION "Versione"
|
||||
#define D_VOLTAGE "Tensione"
|
||||
#define D_WARMLIGHT "Calda"
|
||||
#define D_WEB_SERVER "Web Server"
|
||||
|
||||
// sonoff.ino
|
||||
#define D_WARNING_MINIMAL_VERSION "WARNING This version does not support persistent settings"
|
||||
#define D_WARNING_MINIMAL_VERSION "ATTENZIONE Questa versione non supporta il salvataggio delle impostazioni"
|
||||
#define D_LEVEL_10 "level 1-0"
|
||||
#define D_LEVEL_01 "level 0-1"
|
||||
#define D_SERIAL_LOGGING_DISABLED "Log seriale disabilitato"
|
||||
|
@ -335,19 +335,6 @@
|
|||
#define D_HUE_POST_ARGS "Hue POST argomenti"
|
||||
#define D_3_RESPONSE_PACKETS_SENT "3 pacchetti di risposta inviati"
|
||||
|
||||
// xdrv_02_irremote.ino
|
||||
#define D_JSON_INVALID_JSON "JSON non valido"
|
||||
#define D_JSON_PROTOCOL_NOT_SUPPORTED "Protocollo non supportato"
|
||||
#define D_JSON_IR_PROTOCOL "PROTOCOL"
|
||||
#define D_JSON_IR_BITS "BITS"
|
||||
#define D_JSON_IR_DATA "DATA"
|
||||
#define D_JSON_IRHVAC_VENDOR "VENDOR"
|
||||
#define D_JSON_IRHVAC_POWER "POWER"
|
||||
#define D_JSON_IRHVAC_MODE "MODE"
|
||||
#define D_JSON_IRHVAC_FANSPEED "FANSPEED"
|
||||
#define D_JSON_IRHVAC_TEMP "TEMP"
|
||||
#define D_JSON_IRRECEIVED "IrReceived"
|
||||
|
||||
// xdrv_05_domoticz.ino
|
||||
#define D_DOMOTICZ_PARAMETERS "Parametri Domoticz"
|
||||
#define D_DOMOTICZ_IDX "Idx"
|
||||
|
@ -387,9 +374,9 @@
|
|||
#define D_SHT1X_FOUND "SHT1X trovato"
|
||||
|
||||
// xsns_18_pms5003.ino
|
||||
#define D_STANDARD_CONCENTRATION "Standard Concentration"
|
||||
#define D_ENVIRONMENTAL_CONCENTRATION "Environmental Concentration"
|
||||
#define D_PARTICALS_BEYOND "Particals beyond"
|
||||
#define D_STANDARD_CONCENTRATION "Concentrazione Standard"
|
||||
#define D_ENVIRONMENTAL_CONCENTRATION "Concentrazione Ambientale"
|
||||
#define D_PARTICALS_BEYOND "Particelle oltre"
|
||||
|
||||
// sonoff_template.h
|
||||
// Max string length is 8 characters including suffixes
|
||||
|
|
|
@ -335,19 +335,6 @@
|
|||
#define D_HUE_POST_ARGS "Hue POST argumenten"
|
||||
#define D_3_RESPONSE_PACKETS_SENT "3 antwoord paketten verstuurd"
|
||||
|
||||
// xdrv_02_irremote.ino
|
||||
#define D_JSON_INVALID_JSON "Ongeldig JSON"
|
||||
#define D_JSON_PROTOCOL_NOT_SUPPORTED "Protocol wordt niet ondersteund"
|
||||
#define D_JSON_IR_PROTOCOL "PROTOCOL"
|
||||
#define D_JSON_IR_BITS "BITS"
|
||||
#define D_JSON_IR_DATA "DATA"
|
||||
#define D_JSON_IRHVAC_VENDOR "VENDOR"
|
||||
#define D_JSON_IRHVAC_POWER "POWER"
|
||||
#define D_JSON_IRHVAC_MODE "MODE"
|
||||
#define D_JSON_IRHVAC_FANSPEED "FANSPEED"
|
||||
#define D_JSON_IRHVAC_TEMP "TEMP"
|
||||
#define D_JSON_IRRECEIVED "IrReceived"
|
||||
|
||||
// xdrv_05_domoticz.ino
|
||||
#define D_DOMOTICZ_PARAMETERS "Domoticz parameters"
|
||||
#define D_DOMOTICZ_IDX "Idx"
|
||||
|
|
|
@ -335,19 +335,6 @@
|
|||
#define D_HUE_POST_ARGS "Hue POST args"
|
||||
#define D_3_RESPONSE_PACKETS_SENT "3 pakiety odpowiedzi wysylane"
|
||||
|
||||
// xdrv_02_irremote.ino
|
||||
#define D_JSON_INVALID_JSON "Invalid JSON"
|
||||
#define D_JSON_PROTOCOL_NOT_SUPPORTED "Protokol nie jest obslugiwany"
|
||||
#define D_JSON_IR_PROTOCOL "PROTOCOL"
|
||||
#define D_JSON_IR_BITS "BITS"
|
||||
#define D_JSON_IR_DATA "DATA"
|
||||
#define D_JSON_IRHVAC_VENDOR "VENDOR"
|
||||
#define D_JSON_IRHVAC_POWER "POWER"
|
||||
#define D_JSON_IRHVAC_MODE "MODE"
|
||||
#define D_JSON_IRHVAC_FANSPEED "FANSPEED"
|
||||
#define D_JSON_IRHVAC_TEMP "TEMP"
|
||||
#define D_JSON_IRRECEIVED "IrReceived"
|
||||
|
||||
// xdrv_05_domoticz.ino
|
||||
#define D_DOMOTICZ_PARAMETERS "Parametry Domoticz"
|
||||
#define D_DOMOTICZ_IDX "Idx"
|
||||
|
|
|
@ -335,19 +335,6 @@
|
|||
#define D_HUE_POST_ARGS "Hue POST 参数"
|
||||
#define D_3_RESPONSE_PACKETS_SENT "3 请求包发送"
|
||||
|
||||
// xdrv_02_irremote.ino
|
||||
#define D_JSON_INVALID_JSON "无效的JSON"
|
||||
#define D_JSON_PROTOCOL_NOT_SUPPORTED "协议不支持"
|
||||
#define D_JSON_IR_PROTOCOL "协议"
|
||||
#define D_JSON_IR_BITS "BITS"
|
||||
#define D_JSON_IR_DATA "数据"
|
||||
#define D_JSON_IRHVAC_VENDOR "供应商"
|
||||
#define D_JSON_IRHVAC_POWER "电源"
|
||||
#define D_JSON_IRHVAC_MODE "模式"
|
||||
#define D_JSON_IRHVAC_FANSPEED "风扇转速"
|
||||
#define D_JSON_IRHVAC_TEMP "温度"
|
||||
#define D_JSON_IRRECEIVED "IrReceived"
|
||||
|
||||
// xdrv_05_domoticz.ino
|
||||
#define D_DOMOTICZ_PARAMETERS "Domoticz 设置"
|
||||
#define D_DOMOTICZ_IDX "Idx"
|
||||
|
|
|
@ -85,6 +85,8 @@ typedef unsigned long power_t; // Power (Relay) type
|
|||
#define INPUT_BUFFER_SIZE 250 // Max number of characters in (serial) command buffer
|
||||
#define CMDSZ 24 // Max number of characters in command
|
||||
#define TOPSZ 100 // Max number of characters in topic string
|
||||
#define LOGSZ 400 // Max number of characters in log
|
||||
#define MIN_MESSZ 893 // Min number of characters in MQTT message
|
||||
#ifdef USE_MQTT_TLS
|
||||
#define MAX_LOG_LINES 10 // Max number of lines in weblog
|
||||
#else
|
||||
|
@ -124,6 +126,8 @@ enum LedStateOptions {LED_OFF, LED_POWER, LED_MQTTSUB, LED_POWER_MQTTSUB, LED_MQ
|
|||
|
||||
enum EmulationOptions {EMUL_NONE, EMUL_WEMO, EMUL_HUE, EMUL_MAX};
|
||||
|
||||
enum TopicOptions { CMND, STAT, TELE, nu1, RESULT_OR_CMND, RESULT_OR_STAT, RESULT_OR_TELE };
|
||||
|
||||
enum ButtonStates {PRESSED, NOT_PRESSED};
|
||||
|
||||
enum SettingsParmaIndex {P_HOLD_TIME, P_MAX_POWER_RETRY, P_MAX_PARAM8};
|
||||
|
@ -137,8 +141,14 @@ enum LichtSubtypes {LST_NONE, LST_SINGLE, LST_COLDWARM, LST_RGB, LST_RGBW, LST_R
|
|||
enum LichtSchemes {LS_POWER, LS_WAKEUP, LS_CYCLEUP, LS_CYCLEDN, LS_RANDOM, LS_MAX};
|
||||
|
||||
enum XsnsFunctions {FUNC_INIT, FUNC_EVERY_50_MSECOND, FUNC_EVERY_SECOND, FUNC_PREP_BEFORE_TELEPERIOD, FUNC_JSON_APPEND, FUNC_WEB_APPEND, FUNC_SAVE_BEFORE_RESTART,
|
||||
FUNC_COMMAND, FUNC_MQTT_SUBSCRIBE, FUNC_MQTT_CONNECTED, FUNC_MQTT_DATA, FUNC_SET_POWER, FUNC_SHOW_SENSOR};
|
||||
FUNC_COMMAND, FUNC_MQTT_SUBSCRIBE, FUNC_MQTT_INIT, FUNC_MQTT_DATA, FUNC_SET_POWER, FUNC_SHOW_SENSOR};
|
||||
|
||||
const uint8_t kDefaultRfCode[9] PROGMEM = { 0x21, 0x16, 0x01, 0x0E, 0x03, 0x48, 0x2E, 0x1A, 0x00 };
|
||||
|
||||
/*********************************************************************************************\
|
||||
* Extern global variables
|
||||
\*********************************************************************************************/
|
||||
|
||||
extern uint8_t light_device; // Light device number
|
||||
|
||||
#endif // _SONOFF_H_
|
|
@ -19,13 +19,13 @@
|
|||
/*====================================================
|
||||
Prerequisites:
|
||||
- Change libraries/PubSubClient/src/PubSubClient.h
|
||||
#define MQTT_MAX_PACKET_SIZE 512
|
||||
#define MQTT_MAX_PACKET_SIZE 1000
|
||||
|
||||
- Select IDE Tools - Flash Mode: "DOUT"
|
||||
- Select IDE Tools - Flash Size: "1M (no SPIFFS)"
|
||||
====================================================*/
|
||||
|
||||
#define VERSION 0x050B0102 // 5.11.1b
|
||||
#define VERSION 0x050B0104 // 5.11.1d
|
||||
|
||||
// Location specific includes
|
||||
#include "sonoff.h" // Enumaration used in user_config.h
|
||||
|
@ -37,10 +37,12 @@
|
|||
|
||||
// Libraries
|
||||
#include <PubSubClient.h> // MQTT
|
||||
|
||||
// Max message size calculated by PubSubClient is (MQTT_MAX_PACKET_SIZE < 5 + 2 + strlen(topic) + plength)
|
||||
#if (MQTT_MAX_PACKET_SIZE -TOPSZ -7) < MESSZ // If the max message size is too small, throw an error at compile time. See PubSubClient.cpp line 359
|
||||
#error "MQTT_MAX_PACKET_SIZE is too small in libraries/PubSubClient/src/PubSubClient.h, increase it to at least 512"
|
||||
#if (MQTT_MAX_PACKET_SIZE -TOPSZ -7) < MIN_MESSZ // If the max message size is too small, throw an error at compile time. See PubSubClient.cpp line 359
|
||||
#error "MQTT_MAX_PACKET_SIZE is too small in libraries/PubSubClient/src/PubSubClient.h, increase it to at least 1000"
|
||||
#endif
|
||||
|
||||
#include <Ticker.h> // RTC, Energy, OSWatch
|
||||
#include <ESP8266WiFi.h> // MQTT, Ota, WifiManager
|
||||
#include <ESP8266HTTPClient.h> // MQTT, Ota
|
||||
|
@ -65,7 +67,7 @@
|
|||
#include "settings.h"
|
||||
|
||||
enum TasmotaCommands {
|
||||
CMND_BACKLOG, CMND_DELAY, CMND_POWER, CMND_STATUS, CMND_POWERONSTATE, CMND_PULSETIME,
|
||||
CMND_BACKLOG, CMND_DELAY, CMND_POWER, CMND_STATUS, CMND_STATE, CMND_POWERONSTATE, CMND_PULSETIME,
|
||||
CMND_BLINKTIME, CMND_BLINKCOUNT, CMND_SAVEDATA, CMND_SETOPTION, CMND_TEMPERATURE_RESOLUTION, CMND_HUMIDITY_RESOLUTION,
|
||||
CMND_PRESSURE_RESOLUTION, CMND_POWER_RESOLUTION, CMND_VOLTAGE_RESOLUTION, CMND_CURRENT_RESOLUTION, CMND_ENERGY_RESOLUTION, CMND_MODULE, CMND_MODULES,
|
||||
CMND_GPIO, CMND_GPIOS, CMND_PWM, CMND_PWMFREQUENCY, CMND_PWMRANGE, CMND_COUNTER, CMND_COUNTERTYPE,
|
||||
|
@ -75,7 +77,7 @@ enum TasmotaCommands {
|
|||
CMND_TELEPERIOD, CMND_RESTART, CMND_RESET, CMND_TIMEZONE, CMND_ALTITUDE, CMND_LEDPOWER, CMND_LEDSTATE,
|
||||
CMND_CFGDUMP, CMND_I2CSCAN, CMND_INA219MODE, CMND_EXCEPTION };
|
||||
const char kTasmotaCommands[] PROGMEM =
|
||||
D_CMND_BACKLOG "|" D_CMND_DELAY "|" D_CMND_POWER "|" D_CMND_STATUS "|" D_CMND_POWERONSTATE "|" D_CMND_PULSETIME "|"
|
||||
D_CMND_BACKLOG "|" D_CMND_DELAY "|" D_CMND_POWER "|" D_CMND_STATUS "|" D_CMND_STATE "|" D_CMND_POWERONSTATE "|" D_CMND_PULSETIME "|"
|
||||
D_CMND_BLINKTIME "|" D_CMND_BLINKCOUNT "|" D_CMND_SAVEDATA "|" D_CMND_SETOPTION "|" D_CMND_TEMPERATURE_RESOLUTION "|" D_CMND_HUMIDITY_RESOLUTION "|"
|
||||
D_CMND_PRESSURE_RESOLUTION "|" D_CMND_POWER_RESOLUTION "|" D_CMND_VOLTAGE_RESOLUTION "|" D_CMND_CURRENT_RESOLUTION "|" D_CMND_ENERGY_RESOLUTION "|" D_CMND_MODULE "|" D_CMND_MODULES "|"
|
||||
D_CMND_GPIO "|" D_CMND_GPIOS "|" D_CMND_PWM "|" D_CMND_PWMFREQUENCY "|" D_CMND_PWMRANGE "|" D_CMND_COUNTER "|" D_CMND_COUNTERTYPE "|"
|
||||
|
@ -192,8 +194,8 @@ char my_version[33]; // Composed version string
|
|||
char my_hostname[33]; // Composed Wifi hostname
|
||||
char mqtt_client[33]; // Composed MQTT Clientname
|
||||
char serial_in_buffer[INPUT_BUFFER_SIZE + 2]; // Receive buffer
|
||||
char mqtt_data[MESSZ + TOPSZ]; // MQTT publish buffer (MESSZ) and web page ajax buffer (MESSZ + TOPSZ)
|
||||
char log_data[TOPSZ + MESSZ]; // Logging
|
||||
char mqtt_data[MESSZ]; // MQTT publish buffer and web page ajax buffer
|
||||
char log_data[LOGSZ]; // Logging
|
||||
String web_log[MAX_LOG_LINES]; // Web log buffer
|
||||
String backlog[MAX_BACKLOG]; // Command backlog
|
||||
|
||||
|
@ -227,6 +229,10 @@ void GetMqttClient(char* output, const char* input, byte size)
|
|||
|
||||
void GetTopic_P(char *stopic, byte prefix, char *topic, const char* subtopic)
|
||||
{
|
||||
/* prefix 0 = Cmnd
|
||||
prefix 1 = Stat
|
||||
prefix 2 = Tele
|
||||
*/
|
||||
char romram[CMDSZ];
|
||||
String fulltopic;
|
||||
|
||||
|
@ -306,7 +312,7 @@ void SetDevicePower(power_t rpower)
|
|||
}
|
||||
}
|
||||
|
||||
XdrvSetPower(bitRead(rpower, devices_present -1));
|
||||
XdrvSetPower(rpower);
|
||||
|
||||
if ((SONOFF_DUAL == Settings.module) || (CH4 == Settings.module)) {
|
||||
Serial.write(0xA0);
|
||||
|
@ -350,18 +356,28 @@ void MqttSubscribe(char *topic)
|
|||
|
||||
void MqttPublishDirect(const char* topic, boolean retained)
|
||||
{
|
||||
char sretained[CMDSZ];
|
||||
char slog_type[10];
|
||||
|
||||
sretained[0] = '\0';
|
||||
snprintf_P(slog_type, sizeof(slog_type), PSTR(D_LOG_RESULT));
|
||||
|
||||
if (Settings.flag.mqtt_enabled) {
|
||||
mqtt_data[MESSZ -1] = '\0';
|
||||
if (MqttClient.publish(topic, mqtt_data, retained)) {
|
||||
snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_MQTT "%s = %s%s"), topic, mqtt_data, (retained) ? " (" D_RETAINED ")" : "");
|
||||
// MqttClient.loop(); // Do not use here! Will block previous publishes
|
||||
} else {
|
||||
snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_RESULT "%s = %s"), topic, mqtt_data);
|
||||
snprintf_P(slog_type, sizeof(slog_type), PSTR(D_LOG_MQTT));
|
||||
if (retained) {
|
||||
snprintf_P(sretained, sizeof(sretained), PSTR(" (" D_RETAINED ")"));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_RESULT "%s = %s"), strrchr(topic,'/')+1, mqtt_data);
|
||||
}
|
||||
|
||||
snprintf_P(log_data, sizeof(log_data), PSTR("%s%s = %s"), slog_type, (Settings.flag.mqtt_enabled) ? topic : strrchr(topic,'/')+1, mqtt_data);
|
||||
if (strlen(log_data) >= (sizeof(log_data) - strlen(sretained) -1)) {
|
||||
log_data[sizeof(log_data) - strlen(sretained) -5] = '\0';
|
||||
snprintf_P(log_data, sizeof(log_data), PSTR("%s ..."), log_data);
|
||||
}
|
||||
snprintf_P(log_data, sizeof(log_data), PSTR("%s%s"), log_data, sretained);
|
||||
|
||||
AddLog(LOG_LEVEL_INFO);
|
||||
if (Settings.ledstate &0x04) {
|
||||
blinks++;
|
||||
|
@ -421,11 +437,11 @@ void MqttPublishPowerState(byte device)
|
|||
device = 1;
|
||||
}
|
||||
GetPowerDevice(scommand, device, sizeof(scommand));
|
||||
GetTopic_P(stopic, 1, Settings.mqtt_topic, (Settings.flag.mqtt_response) ? scommand : S_RSLT_RESULT);
|
||||
GetTopic_P(stopic, STAT, Settings.mqtt_topic, (Settings.flag.mqtt_response) ? scommand : S_RSLT_RESULT);
|
||||
snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_SVALUE, scommand, GetStateText(bitRead(power, device -1)));
|
||||
MqttPublish(stopic);
|
||||
|
||||
GetTopic_P(stopic, 1, Settings.mqtt_topic, scommand);
|
||||
GetTopic_P(stopic, STAT, Settings.mqtt_topic, scommand);
|
||||
snprintf_P(mqtt_data, sizeof(mqtt_data), GetStateText(bitRead(power, device -1)));
|
||||
MqttPublish(stopic, Settings.flag.mqtt_power_retain);
|
||||
}
|
||||
|
@ -440,7 +456,7 @@ void MqttPublishPowerBlinkState(byte device)
|
|||
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"%s\":\"" D_JSON_BLINK " %s\"}"),
|
||||
GetPowerDevice(scommand, device, sizeof(scommand)), GetStateText(bitRead(blink_mask, device -1)));
|
||||
|
||||
MqttPublishPrefixTopic_P(5, S_RSLT_POWER);
|
||||
MqttPublishPrefixTopic_P(RESULT_OR_STAT, S_RSLT_POWER);
|
||||
}
|
||||
|
||||
void MqttConnected()
|
||||
|
@ -451,15 +467,15 @@ void MqttConnected()
|
|||
|
||||
// Satisfy iobroker (#299)
|
||||
mqtt_data[0] = '\0';
|
||||
MqttPublishPrefixTopic_P(0, S_RSLT_POWER);
|
||||
MqttPublishPrefixTopic_P(CMND, S_RSLT_POWER);
|
||||
|
||||
GetTopic_P(stopic, 0, Settings.mqtt_topic, PSTR("#"));
|
||||
GetTopic_P(stopic, CMND, Settings.mqtt_topic, PSTR("#"));
|
||||
MqttSubscribe(stopic);
|
||||
if (strstr(Settings.mqtt_fulltopic, MQTT_TOKEN_TOPIC) != NULL) {
|
||||
GetTopic_P(stopic, 0, Settings.mqtt_grptopic, PSTR("#"));
|
||||
GetTopic_P(stopic, CMND, Settings.mqtt_grptopic, PSTR("#"));
|
||||
MqttSubscribe(stopic);
|
||||
fallback_topic_flag = 1;
|
||||
GetTopic_P(stopic, 0, mqtt_client, PSTR("#"));
|
||||
GetTopic_P(stopic, CMND, mqtt_client, PSTR("#"));
|
||||
fallback_topic_flag = 0;
|
||||
MqttSubscribe(stopic);
|
||||
}
|
||||
|
@ -470,24 +486,23 @@ void MqttConnected()
|
|||
if (mqtt_connection_flag) {
|
||||
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"" D_CMND_MODULE "\":\"%s\",\"" D_JSON_VERSION "\":\"%s\",\"" D_JSON_FALLBACKTOPIC "\":\"%s\",\"" D_CMND_GROUPTOPIC "\":\"%s\"}"),
|
||||
my_module.name, my_version, mqtt_client, Settings.mqtt_grptopic);
|
||||
MqttPublishPrefixTopic_P(2, PSTR(D_RSLT_INFO "1"));
|
||||
MqttPublishPrefixTopic_P(TELE, PSTR(D_RSLT_INFO "1"));
|
||||
#ifdef USE_WEBSERVER
|
||||
if (Settings.webserver) {
|
||||
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"" D_JSON_WEBSERVER_MODE "\":\"%s\",\"" D_CMND_HOSTNAME "\":\"%s\",\"" D_CMND_IPADDRESS "\":\"%s\"}"),
|
||||
(2 == Settings.webserver) ? D_ADMIN : D_USER, my_hostname, WiFi.localIP().toString().c_str());
|
||||
MqttPublishPrefixTopic_P(2, PSTR(D_RSLT_INFO "2"));
|
||||
MqttPublishPrefixTopic_P(TELE, PSTR(D_RSLT_INFO "2"));
|
||||
}
|
||||
#endif // USE_WEBSERVER
|
||||
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"" D_JSON_RESTARTREASON "\":\"%s\"}"),
|
||||
(GetResetReason() == "Exception") ? ESP.getResetInfo().c_str() : GetResetReason().c_str());
|
||||
MqttPublishPrefixTopic_P(2, PSTR(D_RSLT_INFO "3"));
|
||||
MqttPublishPrefixTopic_P(TELE, PSTR(D_RSLT_INFO "3"));
|
||||
if (Settings.tele_period) {
|
||||
tele_period = Settings.tele_period -9;
|
||||
}
|
||||
status_update_timer = 2;
|
||||
#ifdef USE_DOMOTICZ
|
||||
DomoticzSetUpdateTimer(2);
|
||||
#endif // USE_DOMOTICZ
|
||||
|
||||
XdrvCall(FUNC_MQTT_INIT);
|
||||
}
|
||||
mqtt_connection_flag = 0;
|
||||
}
|
||||
|
@ -540,7 +555,7 @@ void MqttReconnect()
|
|||
#endif // USE_MQTT_TLS
|
||||
MqttClient.setServer(Settings.mqtt_host, Settings.mqtt_port);
|
||||
|
||||
GetTopic_P(stopic, 2, Settings.mqtt_topic, S_LWT);
|
||||
GetTopic_P(stopic, TELE, Settings.mqtt_topic, S_LWT);
|
||||
snprintf_P(mqtt_data, sizeof(mqtt_data), S_OFFLINE);
|
||||
|
||||
char *mqtt_user = NULL;
|
||||
|
@ -647,7 +662,7 @@ boolean MqttCommand(boolean grpflg, char *type, uint16_t index, char *dataBuf, u
|
|||
strlcpy(stemp1, (1 == payload) ? MQTT_FULLTOPIC : dataBuf, sizeof(stemp1));
|
||||
if (strcmp(stemp1, Settings.mqtt_fulltopic)) {
|
||||
snprintf_P(mqtt_data, sizeof(mqtt_data), (Settings.flag.mqtt_offline) ? S_OFFLINE : "");
|
||||
MqttPublishPrefixTopic_P(2, PSTR(D_LWT), true); // Offline or remove previous retained topic
|
||||
MqttPublishPrefixTopic_P(TELE, PSTR(D_LWT), true); // Offline or remove previous retained topic
|
||||
strlcpy(Settings.mqtt_fulltopic, stemp1, sizeof(Settings.mqtt_fulltopic));
|
||||
restart_flag = 2;
|
||||
}
|
||||
|
@ -683,7 +698,7 @@ boolean MqttCommand(boolean grpflg, char *type, uint16_t index, char *dataBuf, u
|
|||
strlcpy(stemp1, (1 == payload) ? MQTT_TOPIC : dataBuf, sizeof(stemp1));
|
||||
if (strcmp(stemp1, Settings.mqtt_topic)) {
|
||||
snprintf_P(mqtt_data, sizeof(mqtt_data), (Settings.flag.mqtt_offline) ? S_OFFLINE : "");
|
||||
MqttPublishPrefixTopic_P(2, PSTR(D_LWT), true); // Offline or remove previous retained topic
|
||||
MqttPublishPrefixTopic_P(TELE, PSTR(D_LWT), true); // Offline or remove previous retained topic
|
||||
strlcpy(Settings.mqtt_topic, stemp1, sizeof(Settings.mqtt_topic));
|
||||
restart_flag = 2;
|
||||
}
|
||||
|
@ -738,7 +753,7 @@ boolean MqttCommand(boolean grpflg, char *type, uint16_t index, char *dataBuf, u
|
|||
if ((payload >= 0) && (payload <= 1)) {
|
||||
if (!payload) {
|
||||
for(i = 1; i <= devices_present; i++) { // Clear MQTT retain in broker
|
||||
GetTopic_P(stemp1, 1, Settings.mqtt_topic, GetPowerDevice(scommand, i, sizeof(scommand)));
|
||||
GetTopic_P(stemp1, STAT, Settings.mqtt_topic, GetPowerDevice(scommand, i, sizeof(scommand)));
|
||||
mqtt_data[0] = '\0';
|
||||
MqttPublish(stemp1, Settings.flag.mqtt_power_retain);
|
||||
}
|
||||
|
@ -751,8 +766,8 @@ boolean MqttCommand(boolean grpflg, char *type, uint16_t index, char *dataBuf, u
|
|||
if ((payload >= 0) && (payload <= 1)) {
|
||||
if (!payload) {
|
||||
mqtt_data[0] = '\0';
|
||||
MqttPublishPrefixTopic_P(2, PSTR(D_RSLT_SENSOR), Settings.flag.mqtt_sensor_retain);
|
||||
MqttPublishPrefixTopic_P(2, PSTR(D_RSLT_ENERGY), Settings.flag.mqtt_sensor_retain);
|
||||
MqttPublishPrefixTopic_P(TELE, PSTR(D_RSLT_SENSOR), Settings.flag.mqtt_sensor_retain);
|
||||
MqttPublishPrefixTopic_P(TELE, PSTR(D_RSLT_ENERGY), Settings.flag.mqtt_sensor_retain);
|
||||
}
|
||||
Settings.flag.mqtt_sensor_retain = payload;
|
||||
}
|
||||
|
@ -918,6 +933,10 @@ void MqttDataCallback(char* topic, byte* data, unsigned int data_len)
|
|||
fallback_topic_flag = 0;
|
||||
return;
|
||||
}
|
||||
else if (CMND_STATE == command_code) {
|
||||
mqtt_data[0] = '\0';
|
||||
MqttShowState();
|
||||
}
|
||||
else if ((CMND_POWERONSTATE == command_code) && (Settings.module != MOTOR)) {
|
||||
/* 0 = Keep relays off after power on
|
||||
* 1 = Turn relays on after power on, if PulseTime set wait for PulseTime seconds, and turn relays off
|
||||
|
@ -1095,9 +1114,9 @@ void MqttDataCallback(char* topic, byte* data, unsigned int data_len)
|
|||
jsflg = 1;
|
||||
snprintf_P(stemp1, sizeof(stemp1), kModules[i].name);
|
||||
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s\"%d (%s)\""), mqtt_data, i +1, stemp1);
|
||||
if ((strlen(mqtt_data) > 300) || (i == MAXMODULE -1)) {
|
||||
if ((strlen(mqtt_data) > (LOGSZ - TOPSZ)) || (i == MAXMODULE -1)) {
|
||||
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s]}"), mqtt_data);
|
||||
MqttPublishPrefixTopic_P(5, type);
|
||||
MqttPublishPrefixTopic_P(RESULT_OR_STAT, type);
|
||||
jsflg = 0;
|
||||
lines++;
|
||||
}
|
||||
|
@ -1144,9 +1163,9 @@ void MqttDataCallback(char* topic, byte* data, unsigned int data_len)
|
|||
jsflg = 1;
|
||||
snprintf_P(stemp1, sizeof(stemp1), kSensors[i]);
|
||||
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s\"%d (%s)\""), mqtt_data, i, stemp1);
|
||||
if ((strlen(mqtt_data) > 300) || (i == GPIO_SENSOR_END -1)) {
|
||||
if ((strlen(mqtt_data) > (LOGSZ - TOPSZ)) || (i == GPIO_SENSOR_END -1)) {
|
||||
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s]}"), mqtt_data);
|
||||
MqttPublishPrefixTopic_P(5, type);
|
||||
MqttPublishPrefixTopic_P(RESULT_OR_STAT, type);
|
||||
jsflg = 0;
|
||||
lines++;
|
||||
}
|
||||
|
@ -1508,7 +1527,7 @@ void MqttDataCallback(char* topic, byte* data, unsigned int data_len)
|
|||
type = (char*)topicBuf;
|
||||
}
|
||||
if (mqtt_data[0] != '\0') {
|
||||
MqttPublishPrefixTopic_P(5, type);
|
||||
MqttPublishPrefixTopic_P(RESULT_OR_STAT, type);
|
||||
}
|
||||
fallback_topic_flag = 0;
|
||||
}
|
||||
|
@ -1535,7 +1554,7 @@ boolean send_button_power(byte key, byte device, byte state)
|
|||
if (!key && (device > devices_present)) {
|
||||
device = 1;
|
||||
}
|
||||
GetTopic_P(stopic, 0, key_topic, GetPowerDevice(scommand, device, sizeof(scommand), key));
|
||||
GetTopic_P(stopic, CMND, key_topic, GetPowerDevice(scommand, device, sizeof(scommand), key));
|
||||
if (9 == state) {
|
||||
mqtt_data[0] = '\0';
|
||||
} else {
|
||||
|
@ -1776,9 +1795,15 @@ void MqttShowState()
|
|||
dtostrfd((double)ESP.getVcc()/1000, 3, stemp1);
|
||||
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"" D_JSON_VCC "\":%s"), mqtt_data, stemp1);
|
||||
#endif
|
||||
|
||||
for (byte i = 0; i < devices_present; i++) {
|
||||
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"%s\":\"%s\""), mqtt_data, GetPowerDevice(stemp1, i +1, sizeof(stemp1)), GetStateText(bitRead(power, i)));
|
||||
if (i == light_device -1) {
|
||||
LightState(1);
|
||||
} else {
|
||||
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"%s\":\"%s\""), mqtt_data, GetPowerDevice(stemp1, i +1, sizeof(stemp1)), GetStateText(bitRead(power, i)));
|
||||
}
|
||||
}
|
||||
|
||||
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"" D_JSON_WIFI "\":{\"" D_JSON_AP "\":%d,\"" D_JSON_SSID "\":\"%s\",\"" D_JSON_RSSI "\":%d,\"" D_JSON_APMAC_ADDRESS "\":\"%s\"}}"),
|
||||
mqtt_data, Settings.sta_active +1, Settings.sta_ssid[Settings.sta_active], WifiGetRssiAsQuality(WiFi.RSSI()), WiFi.BSSIDstr().c_str());
|
||||
}
|
||||
|
@ -1859,11 +1884,11 @@ void PerformEverySecond()
|
|||
|
||||
mqtt_data[0] = '\0';
|
||||
MqttShowState();
|
||||
MqttPublishPrefixTopic_P(2, PSTR(D_RSLT_STATE));
|
||||
MqttPublishPrefixTopic_P(TELE, PSTR(D_RSLT_STATE));
|
||||
|
||||
mqtt_data[0] = '\0';
|
||||
if (MqttShowSensor()) {
|
||||
MqttPublishPrefixTopic_P(2, PSTR(D_RSLT_SENSOR), Settings.flag.mqtt_sensor_retain);
|
||||
MqttPublishPrefixTopic_P(TELE, PSTR(D_RSLT_SENSOR), Settings.flag.mqtt_sensor_retain);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1876,7 +1901,7 @@ void PerformEverySecond()
|
|||
latest_uptime_flag = false;
|
||||
uptime++;
|
||||
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"" D_JSON_TIME "\":\"%s\",\"" D_JSON_UPTIME "\":%d}"), GetDateAndTime().c_str(), uptime);
|
||||
MqttPublishPrefixTopic_P(2, PSTR(D_RSLT_UPTIME));
|
||||
MqttPublishPrefixTopic_P(TELE, PSTR(D_RSLT_UPTIME));
|
||||
}
|
||||
if ((3 == RtcTime.minute) && !latest_uptime_flag) {
|
||||
latest_uptime_flag = true;
|
||||
|
@ -2287,7 +2312,7 @@ void StateLoop()
|
|||
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR(D_JSON_FAILED " %s"), ESPhttpUpdate.getLastErrorString().c_str());
|
||||
}
|
||||
restart_flag = 2; // Restart anyway to keep memory clean webserver
|
||||
MqttPublishPrefixTopic_P(1, PSTR(D_CMND_UPGRADE));
|
||||
MqttPublishPrefixTopic_P(STAT, PSTR(D_CMND_UPGRADE));
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -52,6 +52,9 @@ void WifiWpsStatusCallback(wps_cb_status status);
|
|||
#ifdef USE_DOMOTICZ
|
||||
#undef USE_DOMOTICZ // Disable Domoticz
|
||||
#endif
|
||||
#ifdef USE_HOME_ASSISTANT
|
||||
#undef USE_HOME_ASSISTANT // Disable Home Assistant
|
||||
#endif
|
||||
//#ifdef USE_WEBSERVER
|
||||
//#undef USE_WEBSERVER // Disable Webserver
|
||||
//#endif
|
||||
|
@ -100,7 +103,9 @@ void WifiWpsStatusCallback(wps_cb_status status);
|
|||
#endif
|
||||
|
||||
#ifndef MESSZ
|
||||
#define MESSZ 405 // Max number of characters in JSON message string (6 x DS18x20 sensors)
|
||||
//#define MESSZ 405 // Max number of characters in JSON message string (6 x DS18x20 sensors)
|
||||
//#define MESSZ 893 // Max number of characters in JSON message string (Hass discovery and nice MQTT_MAX_PACKET_SIZE = 1000)
|
||||
#define MESSZ (MQTT_MAX_PACKET_SIZE -TOPSZ -7) // Max number of characters in JSON message string (6 x DS18x20 sensors)
|
||||
#endif
|
||||
|
||||
#include <core_version.h> // Arduino_Esp8266 version information (ARDUINO_ESP8266_RELEASE and ARDUINO_ESP8266_RELEASE_2_3_0)
|
||||
|
|
|
@ -501,7 +501,7 @@ const mytmplt kModules[MAXMODULE] PROGMEM = {
|
|||
GPIO_REL1, // GPIO15 Relay (0 = Off, 1 = On)
|
||||
0, 0
|
||||
},
|
||||
{ "WeMos D1 mini", // WeMos and NodeMCU hardware (ESP8266)
|
||||
{ "Generic", // Any ESP8266/ESP8285 device like WeMos and NodeMCU hardware (ESP8266)
|
||||
GPIO_USER, // GPIO00 D3 Wemos Button Shield
|
||||
GPIO_USER, // GPIO01 TX Serial RXD
|
||||
GPIO_USER, // GPIO02 D4 Wemos DHT Shield
|
||||
|
@ -861,6 +861,30 @@ const mytmplt kModules[MAXMODULE] PROGMEM = {
|
|||
0, 0, 0
|
||||
}
|
||||
|
||||
{ "SMPW701E", // SM-PW701E WLAN Socket (#1190)
|
||||
0, 0, 0, 0,
|
||||
GPIO_LED1_INV, // GPIO04 Blue Led (0 = On, 1 = Off)
|
||||
0, // GPIO05 IR or RF receiver (optional)
|
||||
0, 0, 0, 0, 0, 0, // Flash connection
|
||||
GPIO_REL1, // GPIO12 Relay and Red Led (0 = Off, 1 = On)
|
||||
GPIO_KEY1, // GPIO13 Button
|
||||
0, 0, 0, 0
|
||||
}
|
||||
|
||||
{ "SWA1", // Smart Plugs (ESP8266)
|
||||
0,
|
||||
GPIO_USER, // GPIO01
|
||||
0,
|
||||
GPIO_USER, // GPIO03
|
||||
GPIO_LED1_INV, // GPIO04 Blue LED
|
||||
GPIO_REL1, // GPIO05 Red LED and relay
|
||||
0, 0, 0, 0, 0, 0, // Flash connection
|
||||
0,
|
||||
GPIO_KEY1, // GPIO13 Button (normally GPIO00)
|
||||
GPIO_USER, // GPIO14
|
||||
0, 0, 0
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
#endif // _SONOFF_TEMPLATE_H_
|
|
@ -148,83 +148,9 @@ Decoding 14 results
|
|||
* General
|
||||
\*********************************************************************************************/
|
||||
|
||||
char* _dtostrf(double number, unsigned char prec, char *s, bool i18n)
|
||||
char* dtostrfd(double number, unsigned char prec, char *s)
|
||||
{
|
||||
bool negative = false;
|
||||
|
||||
if (isnan(number)) {
|
||||
strcpy_P(s, PSTR("nan"));
|
||||
return s;
|
||||
}
|
||||
if (isinf(number)) {
|
||||
strcpy_P(s, PSTR("inf"));
|
||||
return s;
|
||||
}
|
||||
char decimal = '.';
|
||||
if (i18n) {
|
||||
decimal = D_DECIMAL_SEPARATOR[0];
|
||||
}
|
||||
|
||||
char* out = s;
|
||||
|
||||
// Handle negative numbers
|
||||
if (number < 0.0) {
|
||||
negative = true;
|
||||
number = -number;
|
||||
}
|
||||
|
||||
// Round correctly so that print(1.999, 2) prints as "2.00"
|
||||
// I optimized out most of the divisions
|
||||
double rounding = 2.0;
|
||||
for (uint8_t i = 0; i < prec; ++i) {
|
||||
rounding *= 10.0;
|
||||
}
|
||||
rounding = 1.0 / rounding;
|
||||
number += rounding;
|
||||
|
||||
// Figure out how big our number really is
|
||||
double tenpow = 1.0;
|
||||
int digitcount = 1;
|
||||
while (number >= 10.0 * tenpow) {
|
||||
tenpow *= 10.0;
|
||||
digitcount++;
|
||||
}
|
||||
number /= tenpow;
|
||||
|
||||
// Handle negative sign
|
||||
if (negative) {
|
||||
*out++ = '-';
|
||||
}
|
||||
|
||||
// Print the digits, and if necessary, the decimal point
|
||||
digitcount += prec;
|
||||
int8_t digit = 0;
|
||||
while (digitcount-- > 0) {
|
||||
digit = (int8_t)number;
|
||||
if (digit > 9) {
|
||||
digit = 9; // insurance
|
||||
}
|
||||
*out++ = (char)('0' | digit);
|
||||
if ((digitcount == prec) && (prec > 0)) {
|
||||
*out++ = decimal;
|
||||
}
|
||||
number -= digit;
|
||||
number *= 10.0;
|
||||
}
|
||||
|
||||
// make sure the string is terminated
|
||||
*out = 0;
|
||||
return s;
|
||||
}
|
||||
|
||||
char* dtostrfd(double number, unsigned char prec, char *s) // Always decimal dot
|
||||
{
|
||||
return _dtostrf(number, prec, s, 0);
|
||||
}
|
||||
|
||||
char* dtostrfi(double number, unsigned char prec, char *s) // Use localized decimal dot
|
||||
{
|
||||
return _dtostrf(number, prec, s, 1);
|
||||
return dtostrf(number, 1, prec, s);
|
||||
}
|
||||
|
||||
boolean ParseIp(uint32_t* addr, const char* str)
|
||||
|
@ -333,7 +259,6 @@ char* GetPowerDevice(char* dest, uint8_t idx, size_t size)
|
|||
\*********************************************************************************************/
|
||||
|
||||
#define WIFI_CONFIG_SEC 180 // seconds before restart
|
||||
#define WIFI_MANAGER_SEC 180 // seconds before restart
|
||||
#define WIFI_CHECK_SEC 20 // seconds
|
||||
#define WIFI_RETRY_SEC 30 // seconds
|
||||
|
||||
|
@ -361,7 +286,7 @@ int WifiGetRssiAsQuality(int rssi)
|
|||
boolean WifiConfigCounter()
|
||||
{
|
||||
if (wifi_config_counter) {
|
||||
wifi_config_counter = WIFI_MANAGER_SEC;
|
||||
wifi_config_counter = WIFI_CONFIG_SEC;
|
||||
}
|
||||
return (wifi_config_counter);
|
||||
}
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
// -- Localization --------------------------------
|
||||
//#define MY_LANGUAGE de-DE // German in Germany
|
||||
//#define MY_LANGUAGE en-GB // English in Great Britain. Enabled by Default
|
||||
//#define MY_LANGUAGE es-AR // Spanish in Argentina
|
||||
//#define MY_LANGUAGE fr-FR // French in France
|
||||
//#define MY_LANGUAGE it-IT // Italian in Italy
|
||||
//#define MY_LANGUAGE nl-NL // Dutch in the Netherlands
|
||||
|
@ -118,6 +119,10 @@
|
|||
#define DOMOTICZ_OUT_TOPIC "domoticz/out" // Domoticz Output Topic
|
||||
#define DOMOTICZ_UPDATE_TIMER 0 // [DomoticzUpdateTimer] Send relay status (0 = disable, 1 - 3600 seconds) (Optional)
|
||||
|
||||
// -- MQTT - Home Assistant Discovery -------------
|
||||
#define USE_HOME_ASSISTANT // Enable Home Assistant Discovery (+1k4 code)
|
||||
#define HOME_ASSISTANT_DISCOVERY_PREFIX "homeassistant" // Home Assistant discovery prefix
|
||||
|
||||
// -- HTTP ----------------------------------------
|
||||
#define USE_WEBSERVER // Enable web server and wifi manager (+66k code, +8k mem) - Disable by //
|
||||
#define WEB_SERVER 2 // [WebServer] Web server (0 = Off, 1 = Start as User, 2 = Start as Admin)
|
||||
|
@ -179,7 +184,7 @@
|
|||
#define USE_SHT3X // Add I2C code for SHT3x sensor (+0k6 code)
|
||||
#define USE_HTU // Add I2C code for HTU21/SI7013/SI7020/SI7021 sensor (+1k5 code)
|
||||
#define USE_BMP // Add I2C code for BMP085/BMP180/BMP280/BME280 sensor (+4k code)
|
||||
// #define USE_BME680 // Add additional support for BME680 sensor using Adafruit Sensor and BME680 libraries (+6k code)
|
||||
#define USE_BME680 // Add additional support for BME680 sensor using Adafruit Sensor and BME680 libraries (+6k code)
|
||||
#define USE_BH1750 // Add I2C code for BH1750 sensor (+0k5 code)
|
||||
// #define USE_VEML6070 // Add I2C code for VEML6070 sensor (+0k5 code)
|
||||
// #define USE_TSL2561 // Add I2C code for TSL2561 sensor using library Adafruit TSL2561 Arduino (+1k2 code)
|
||||
|
|
|
@ -37,7 +37,7 @@ const char HTTP_HEAD[] PROGMEM =
|
|||
|
||||
"<script>"
|
||||
"var cn,x,lt;"
|
||||
"cn=120;"
|
||||
"cn=180;"
|
||||
"x=null;" // Allow for abortion
|
||||
"function u(){"
|
||||
"if(cn>=0){"
|
||||
|
@ -96,7 +96,11 @@ const char HTTP_HEAD[] PROGMEM =
|
|||
#ifdef BE_MINIMAL
|
||||
"<div style='text-align:center;color:red;'><h3>" D_MINIMAL_FIRMWARE_PLEASE_UPGRADE "</h3></div>"
|
||||
#endif
|
||||
//#if (MY_LANGUAGE == es-AR) // This does not function
|
||||
// "<div style='text-align:center;'><h3>" D_MODULE " {ha</h3><h2>{h}</h2></div>";
|
||||
//#else
|
||||
"<div style='text-align:center;'><h3>{ha " D_MODULE "</h3><h2>{h}</h2></div>";
|
||||
//#endif
|
||||
const char HTTP_SCRIPT_CONSOL[] PROGMEM =
|
||||
"var sn=0;" // Scroll position
|
||||
"var id=99;" // Get most of weblog initially
|
||||
|
@ -190,6 +194,12 @@ const char HTTP_BTN_MENU4[] PROGMEM =
|
|||
"<br/><form action='rs' method='get'><button>" D_RESTORE_CONFIGURATION "</button></form>";
|
||||
const char HTTP_BTN_MAIN[] PROGMEM =
|
||||
"<br/><br/><form action='.' method='get'><button>" D_MAIN_MENU "</button></form>";
|
||||
const char HTTP_FORM_LOGIN[] PROGMEM =
|
||||
"<form method='post' action='/'>"
|
||||
"<br/><b>" D_USER "</b><br/><input name='USER1' placeholder='" D_USER "'><br/>"
|
||||
"<br/><b>" D_PASSWORD "</b><br/><input name='PASS1' type='password' placeholder='" D_PASSWORD "'><br/>"
|
||||
"<br/>"
|
||||
"<br/><button>" D_OK "</button></form>";
|
||||
const char HTTP_BTN_CONF[] PROGMEM =
|
||||
"<br/><br/><form action='cn' method='get'><button>" D_CONFIGURATION "</button></form>";
|
||||
const char HTTP_FORM_MODULE[] PROGMEM =
|
||||
|
@ -204,9 +214,9 @@ const char HTTP_FORM_WIFI[] PROGMEM =
|
|||
"<fieldset><legend><b> " D_WIFI_PARAMETERS " </b></legend><form method='get' action='sv'>"
|
||||
"<input id='w' name='w' value='1' hidden><input id='r' name='r' value='1' hidden>"
|
||||
"<br/><b>" D_AP1_SSID "</b> (" STA_SSID1 ")<br/><input id='s1' name='s1' placeholder='" STA_SSID1 "' value='{s1'><br/>"
|
||||
"<br/><b>" D_AP1_PASSWORD "</b><br/><input id='p1' name='p1' type='password' placeholder='" STA_PASS1 "' value='{p1'><br/>"
|
||||
"<br/><b>" D_AP1_PASSWORD "</b><br/><input id='p1' name='p1' type='password' placeholder='" D_AP1_PASSWORD "' value='********'><br/>"
|
||||
"<br/><b>" D_AP2_SSID "</b> (" STA_SSID2 ")<br/><input id='s2' name='s2' placeholder='" STA_SSID2 "' value='{s2'><br/>"
|
||||
"<br/><b>" D_AP2_PASSWORD "</b><br/><input id='p2' name='p2' type='password' placeholder='" STA_PASS2 "' value='{p2'><br/>"
|
||||
"<br/><b>" D_AP2_PASSWORD "</b><br/><input id='p2' name='p2' type='password' placeholder='" D_AP2_PASSWORD "' value='********'><br/>"
|
||||
"<br/><b>" D_HOSTNAME "</b> (" WIFI_HOSTNAME ")<br/><input id='h' name='h' placeholder='" WIFI_HOSTNAME" ' value='{h1'><br/>";
|
||||
const char HTTP_FORM_MQTT[] PROGMEM =
|
||||
"<fieldset><legend><b> " D_MQTT_PARAMETERS " </b></legend><form method='get' action='sv'>"
|
||||
|
@ -236,7 +246,7 @@ const char HTTP_FORM_LOG3[] PROGMEM =
|
|||
const char HTTP_FORM_OTHER[] PROGMEM =
|
||||
"<fieldset><legend><b> " D_OTHER_PARAMETERS " </b></legend><form method='get' action='sv'>"
|
||||
"<input id='w' name='w' value='5' hidden><input id='r' name='r' value='1' hidden>"
|
||||
"<br/><b>" D_WEB_ADMIN_PASSWORD "</b><br/><input id='p1' name='p1' type='password' placeholder='" WEB_PASSWORD "' value='{p1'><br/>"
|
||||
"<br/><b>" D_WEB_ADMIN_PASSWORD "</b><br/><input id='p1' name='p1' type='password' placeholder='" D_WEB_ADMIN_PASSWORD "' value='********'><br/>"
|
||||
"<br/><input style='width:10%;' id='b1' name='b1' type='checkbox'{r1><b>" D_MQTT_ENABLE "</b><br/>";
|
||||
const char HTTP_FORM_OTHER2[] PROGMEM =
|
||||
"<br/><b>" D_FRIENDLY_NAME " {1</b> ({2)<br/><input id='a{1' name='a{1' placeholder='{2' value='{3'><br/>";
|
||||
|
@ -244,8 +254,8 @@ const char HTTP_FORM_OTHER[] PROGMEM =
|
|||
const char HTTP_FORM_OTHER3a[] PROGMEM =
|
||||
"<br/><fieldset><legend><b> " D_EMULATION " </b></legend>";
|
||||
const char HTTP_FORM_OTHER3b[] PROGMEM =
|
||||
"<br/><input style='width:10%;' id='b2' name='b2' type='radio' value='{1'{2><b>{3</b>{4";
|
||||
#endif // USE_EMULATION
|
||||
"<br/><input style='width:10%;' id='r{1' name='b2' type='radio' value='{1'{2><b>{3</b>{4"; // Different id only used for labels
|
||||
#endif // USE_EMULATION
|
||||
const char HTTP_FORM_END[] PROGMEM =
|
||||
"<br/><button type='submit'>" D_SAVE "</button></form></fieldset>";
|
||||
const char HTTP_FORM_RST[] PROGMEM =
|
||||
|
@ -267,13 +277,13 @@ const char HTTP_FORM_RST_UPG[] PROGMEM =
|
|||
"</div>"
|
||||
"<div id='f2' name='f2' style='display:none;text-align:center;'><b>" D_UPLOAD_STARTED " ...</b></div>";
|
||||
const char HTTP_FORM_CMND[] PROGMEM =
|
||||
"<br/><textarea readonly id='t1' name='t1' cols='" STR(MESSZ) "' wrap='off'></textarea><br/><br/>"
|
||||
"<br/><textarea readonly id='t1' name='t1' cols='340' wrap='off'></textarea><br/><br/>"
|
||||
"<form method='get' onsubmit='return l(1);'>"
|
||||
"<input id='c1' name='c1' placeholder='" D_ENTER_COMMAND "' autofocus><br/>"
|
||||
// "<br/><button type='submit'>Send command</button>"
|
||||
"</form>";
|
||||
const char HTTP_TABLE100[] PROGMEM =
|
||||
"<table width='100%'>";
|
||||
"<table style='width:100%'>";
|
||||
const char HTTP_COUNTER[] PROGMEM =
|
||||
"<br/><div id='t' name='t' style='text-align:center;'></div>";
|
||||
const char HTTP_END[] PROGMEM =
|
||||
|
@ -412,11 +422,17 @@ void SetHeader()
|
|||
#endif
|
||||
}
|
||||
|
||||
void ShowPage(String &page)
|
||||
void ShowPage(String &page, bool auth)
|
||||
{
|
||||
if((HTTP_ADMIN == webserver_state) && (Settings.web_password[0] != 0) && !WebServer->authenticate(WEB_USERNAME, Settings.web_password)) {
|
||||
// if((HTTP_ADMIN == webserver_state) && (Settings.web_password[0] != 0) && !WebServer->authenticate(WEB_USERNAME, Settings.web_password)) {
|
||||
// return WebServer->requestAuthentication();
|
||||
// }
|
||||
|
||||
//Authentication
|
||||
if (auth && (Settings.web_password[0] != 0) && !WebServer->authenticate(WEB_USERNAME, Settings.web_password)) {
|
||||
return WebServer->requestAuthentication();
|
||||
}
|
||||
|
||||
page.replace(F("{ha"), my_module.name);
|
||||
page.replace(F("{h}"), Settings.friendlyname[0]);
|
||||
if (HTTP_MANAGER == webserver_state) {
|
||||
|
@ -429,11 +445,25 @@ void ShowPage(String &page)
|
|||
page.replace(F("{mv"), my_version);
|
||||
SetHeader();
|
||||
WebServer->send(200, FPSTR(HDR_CTYPE_HTML), page);
|
||||
// WebServer->sendContent("");
|
||||
}
|
||||
|
||||
void ShowPage(String &page)
|
||||
{
|
||||
ShowPage(page, true);
|
||||
}
|
||||
|
||||
//Authentication
|
||||
void HandleWifiLogin()
|
||||
{
|
||||
String page = FPSTR(HTTP_HEAD);
|
||||
page.replace(F("{v}"), FPSTR( D_CONFIGURE_WIFI ));
|
||||
page += FPSTR(HTTP_FORM_LOGIN);
|
||||
ShowPage(page, false); // false means show page no matter if the client has or has not credentials
|
||||
}
|
||||
|
||||
void HandleRoot()
|
||||
{
|
||||
// AddLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_HTTP D_MAIN_MENU));
|
||||
AddLog_P(LOG_LEVEL_DEBUG, S_LOG_HTTP, S_MAIN_MENU);
|
||||
|
||||
if (CaptivePortal()) { // If captive portal redirect instead of displaying the page.
|
||||
|
@ -441,7 +471,20 @@ void HandleRoot()
|
|||
}
|
||||
|
||||
if (HTTP_MANAGER == webserver_state) {
|
||||
HandleWifiConfiguration();
|
||||
// HandleWifiConfiguration();
|
||||
|
||||
//Authentication
|
||||
if ((Settings.web_password[0] != 0) && !(WebServer->hasArg("USER1")) && !(WebServer->hasArg("PASS1"))) {
|
||||
HandleWifiLogin();
|
||||
} else {
|
||||
if (!(Settings.web_password[0] != 0) || ((WebServer->arg("USER1") == WEB_USERNAME ) && (WebServer->arg("PASS1") == Settings.web_password ))) {
|
||||
HandleWifiConfiguration();
|
||||
} else {
|
||||
// wrong user and pass
|
||||
HandleWifiLogin();
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
char stemp[10];
|
||||
char line[160];
|
||||
|
@ -463,7 +506,7 @@ void HandleRoot()
|
|||
page += F("<tr>");
|
||||
for (byte idx = 1; idx <= devices_present; idx++) {
|
||||
snprintf_P(stemp, sizeof(stemp), PSTR(" %d"), idx);
|
||||
snprintf_P(line, sizeof(line), PSTR("<td width='%d%'><button onclick='la(\"?o=%d\");'>%s%s</button></td>"),
|
||||
snprintf_P(line, sizeof(line), PSTR("<td style='width:%d%'><button onclick='la(\"?o=%d\");'>%s%s</button></td>"),
|
||||
100 / devices_present, idx, (devices_present < 5) ? D_BUTTON_TOGGLE : "", (devices_present > 1) ? stemp : "");
|
||||
page += line;
|
||||
}
|
||||
|
@ -479,7 +522,7 @@ void HandleRoot()
|
|||
}
|
||||
for (byte j = 0; j < 4; j++) {
|
||||
idx++;
|
||||
snprintf_P(line, sizeof(line), PSTR("<td width='25%'><button onclick='la(\"?k=%d\");'>%d</button></td>"), idx, idx);
|
||||
snprintf_P(line, sizeof(line), PSTR("<td style='width:25%'><button onclick='la(\"?k=%d\");'>%d</button></td>"), idx, idx);
|
||||
page += line;
|
||||
}
|
||||
}
|
||||
|
@ -520,6 +563,7 @@ void HandleAjaxStatusRefresh()
|
|||
if (strlen(mqtt_data)) {
|
||||
page += FPSTR(HTTP_TABLE100);
|
||||
page += mqtt_data;
|
||||
page.replace(F("."), F(D_DECIMAL_SEPARATOR));
|
||||
page += F("</table>");
|
||||
}
|
||||
char line[80];
|
||||
|
@ -529,8 +573,7 @@ void HandleAjaxStatusRefresh()
|
|||
uint8_t fsize = (devices_present < 5) ? 70 - (devices_present * 8) : 32;
|
||||
for (byte idx = 1; idx <= devices_present; idx++) {
|
||||
snprintf_P(svalue, sizeof(svalue), PSTR("%d"), bitRead(power, idx -1));
|
||||
// snprintf_P(line, sizeof(line), PSTR("<td style='width:%d%'><div style='text-align:center;font-weight:%s;font-size:%dpx'>%s</div></td>"),
|
||||
snprintf_P(line, sizeof(line), PSTR("<td width='%d{t}%s;font-size:%dpx'>%s</div></td>"), // {t} = %'><div style='text-align:center;font-weight:
|
||||
snprintf_P(line, sizeof(line), PSTR("<td style='width:%d{t}%s;font-size:%dpx'>%s</div></td>"), // {t} = %'><div style='text-align:center;font-weight:
|
||||
100 / devices_present, (bitRead(power, idx -1)) ? "bold" : "normal", fsize, (devices_present < 5) ? GetStateText(bitRead(power, idx -1)) : svalue);
|
||||
page += line;
|
||||
}
|
||||
|
@ -545,6 +588,7 @@ void HandleAjaxStatusRefresh()
|
|||
}
|
||||
*/
|
||||
WebServer->send(200, FPSTR(HDR_CTYPE_HTML), page);
|
||||
// WebServer->sendContent("");
|
||||
}
|
||||
|
||||
boolean HttpUser()
|
||||
|
@ -673,7 +717,7 @@ void HandleModuleConfiguration()
|
|||
for (byte i = 0; i < MAX_GPIO_PIN; i++) {
|
||||
if (GPIO_USER == cmodule.gp.io[i]) {
|
||||
snprintf_P(stemp, 3, PINS_WEMOS +i*2);
|
||||
snprintf_P(line, sizeof(line), PSTR("<tr><td width='190'>%s <b>" D_GPIO "%d</b> %s</td><td width='126'><select id='g%d' name='g%d'></select></td></tr>"),
|
||||
snprintf_P(line, sizeof(line), PSTR("<tr><td style='width:190'>%s <b>" D_GPIO "%d</b> %s</td><td style='width:126'><select id='g%d' name='g%d'></select></td></tr>"),
|
||||
(WEMOS==Settings.module)?stemp:"", i, (0==i)? D_SENSOR_BUTTON "1":(1==i)? D_SERIAL_OUT :(3==i)? D_SERIAL_IN :(12==i)? D_SENSOR_RELAY "1":(13==i)? D_SENSOR_LED "1i":(14==i)? D_SENSOR :"", i, i);
|
||||
page += line;
|
||||
snprintf_P(line, sizeof(line), PSTR("sk(%d,%d);"), my_module.gp.io[i], i); // g0 - g16
|
||||
|
@ -790,16 +834,15 @@ void HandleWifi(boolean scan)
|
|||
page += FPSTR(HTTP_FORM_WIFI);
|
||||
page.replace(F("{h1"), Settings.hostname);
|
||||
page.replace(F("{s1"), Settings.sta_ssid[0]);
|
||||
page.replace(F("{p1"), Settings.sta_pwd[0]);
|
||||
page.replace(F("{s2"), Settings.sta_ssid[1]);
|
||||
page.replace(F("{p2"), Settings.sta_pwd[1]);
|
||||
page += FPSTR(HTTP_FORM_END);
|
||||
if (HTTP_MANAGER == webserver_state) {
|
||||
page += FPSTR(HTTP_BTN_RSTRT);
|
||||
} else {
|
||||
page += FPSTR(HTTP_BTN_CONF);
|
||||
}
|
||||
ShowPage(page);
|
||||
// ShowPage(page);
|
||||
ShowPage(page, !(HTTP_MANAGER == webserver_state));
|
||||
}
|
||||
|
||||
void HandleMqttConfiguration()
|
||||
|
@ -886,7 +929,6 @@ void HandleOtherConfiguration()
|
|||
String page = FPSTR(HTTP_HEAD);
|
||||
page.replace(F("{v}"), FPSTR(S_CONFIGURE_OTHER));
|
||||
page += FPSTR(HTTP_FORM_OTHER);
|
||||
page.replace(F("{p1"), Settings.web_password);
|
||||
page.replace(F("{r1"), (Settings.flag.mqtt_enabled) ? F(" checked") : F(""));
|
||||
uint8_t maxfn = (devices_present > MAX_FRIENDLYNAMES) ? MAX_FRIENDLYNAMES : devices_present;
|
||||
for (byte i = 0; i < maxfn; i++) {
|
||||
|
@ -905,7 +947,7 @@ void HandleOtherConfiguration()
|
|||
page.replace(F("{3"), (i == EMUL_NONE) ? F(D_NONE) : (i == EMUL_WEMO) ? F(D_BELKIN_WEMO) : F(D_HUE_BRIDGE));
|
||||
page.replace(F("{4"), (i == EMUL_NONE) ? F("") : (i == EMUL_WEMO) ? F(" " D_SINGLE_DEVICE) : F(" " D_MULTI_DEVICE));
|
||||
}
|
||||
// page += F("<br/>");
|
||||
page += F("<br/>");
|
||||
page += F("<br/></fieldset>");
|
||||
#endif // USE_EMULATION
|
||||
page += FPSTR(HTTP_FORM_END);
|
||||
|
@ -964,9 +1006,11 @@ void HandleSaveSettings()
|
|||
strlcpy(Settings.hostname, WIFI_HOSTNAME, sizeof(Settings.hostname));
|
||||
}
|
||||
strlcpy(Settings.sta_ssid[0], (!strlen(WebServer->arg("s1").c_str())) ? STA_SSID1 : WebServer->arg("s1").c_str(), sizeof(Settings.sta_ssid[0]));
|
||||
strlcpy(Settings.sta_pwd[0], (!strlen(WebServer->arg("p1").c_str())) ? STA_PASS1 : WebServer->arg("p1").c_str(), sizeof(Settings.sta_pwd[0]));
|
||||
strlcpy(Settings.sta_ssid[1], (!strlen(WebServer->arg("s2").c_str())) ? STA_SSID2 : WebServer->arg("s2").c_str(), sizeof(Settings.sta_ssid[1]));
|
||||
strlcpy(Settings.sta_pwd[1], (!strlen(WebServer->arg("p2").c_str())) ? STA_PASS2 : WebServer->arg("p2").c_str(), sizeof(Settings.sta_pwd[1]));
|
||||
// strlcpy(Settings.sta_ssid[0], (!strlen(WebServer->arg("s1").c_str())) ? "" : WebServer->arg("s1").c_str(), sizeof(Settings.sta_ssid[0]));
|
||||
// strlcpy(Settings.sta_ssid[1], (!strlen(WebServer->arg("s2").c_str())) ? "" : WebServer->arg("s2").c_str(), sizeof(Settings.sta_ssid[1]));
|
||||
strlcpy(Settings.sta_pwd[0], (!strlen(WebServer->arg("p1").c_str())) ? "" : (strchr(WebServer->arg("p1").c_str(),'*')) ? Settings.sta_pwd[0] : WebServer->arg("p1").c_str(), sizeof(Settings.sta_pwd[0]));
|
||||
strlcpy(Settings.sta_pwd[1], (!strlen(WebServer->arg("p2").c_str())) ? "" : (strchr(WebServer->arg("p2").c_str(),'*')) ? Settings.sta_pwd[1] : WebServer->arg("p2").c_str(), sizeof(Settings.sta_pwd[1]));
|
||||
snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_WIFI D_CMND_HOSTNAME " %s, " D_CMND_SSID "1 %s, " D_CMND_PASSWORD "1 %s, " D_CMND_SSID "2 %s, " D_CMND_PASSWORD "2 %s"),
|
||||
Settings.hostname, Settings.sta_ssid[0], Settings.sta_pwd[0], Settings.sta_ssid[1], Settings.sta_pwd[1]);
|
||||
AddLog(LOG_LEVEL_INFO);
|
||||
|
@ -979,7 +1023,7 @@ void HandleSaveSettings()
|
|||
MakeValidMqtt(1,stemp2);
|
||||
if ((strcmp(stemp, Settings.mqtt_topic)) || (strcmp(stemp2, Settings.mqtt_fulltopic))) {
|
||||
snprintf_P(mqtt_data, sizeof(mqtt_data), (Settings.flag.mqtt_offline) ? S_OFFLINE : "");
|
||||
MqttPublishPrefixTopic_P(2, S_LWT, true); // Offline or remove previous retained topic
|
||||
MqttPublishPrefixTopic_P(TELE, S_LWT, true); // Offline or remove previous retained topic
|
||||
}
|
||||
strlcpy(Settings.mqtt_topic, stemp, sizeof(Settings.mqtt_topic));
|
||||
strlcpy(Settings.mqtt_fulltopic, stemp2, sizeof(Settings.mqtt_fulltopic));
|
||||
|
@ -1014,7 +1058,7 @@ snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_LOG D_CMND_SERIALLOG " %d, " D
|
|||
break;
|
||||
#endif // USE_DOMOTICZ
|
||||
case 5:
|
||||
strlcpy(Settings.web_password, (!strlen(WebServer->arg("p1").c_str())) ? WEB_PASSWORD : (!strcmp(WebServer->arg("p1").c_str(),"0")) ? "" : WebServer->arg("p1").c_str(), sizeof(Settings.web_password));
|
||||
strlcpy(Settings.web_password, (!strlen(WebServer->arg("p1").c_str())) ? "" : (strchr(WebServer->arg("p1").c_str(),'*')) ? Settings.web_password : WebServer->arg("p1").c_str(), sizeof(Settings.web_password));
|
||||
Settings.flag.mqtt_enabled = WebServer->hasArg("b1");
|
||||
#ifdef USE_EMULATION
|
||||
Settings.flag2.emulation = (!strlen(WebServer->arg("b2").c_str())) ? 0 : atoi(WebServer->arg("b2").c_str());
|
||||
|
@ -1376,6 +1420,7 @@ void HandleHttpCommand()
|
|||
}
|
||||
SetHeader();
|
||||
WebServer->send(200, FPSTR(HDR_CTYPE_JSON), message);
|
||||
// WebServer->sendContent("");
|
||||
}
|
||||
|
||||
void HandleConsole()
|
||||
|
@ -1454,6 +1499,7 @@ void HandleAjaxConsoleRefresh()
|
|||
}
|
||||
message += F("</l></r>");
|
||||
WebServer->send(200, FPSTR(HDR_CTYPE_XML), message);
|
||||
// WebServer->sendContent("");
|
||||
}
|
||||
|
||||
void HandleInformation()
|
||||
|
@ -1478,7 +1524,7 @@ void HandleInformation()
|
|||
// }1 = </td></tr><tr><th>
|
||||
// }2 = </th><td>
|
||||
String func = FPSTR(HTTP_SCRIPT_INFO_BEGIN);
|
||||
func += F("<table width='100%'><tr><th>");
|
||||
func += F("<table style='width:100%'><tr><th>");
|
||||
func += F(D_PROGRAM_VERSION "}2"); func += my_version;
|
||||
func += F("}1" D_BUILD_DATE_AND_TIME "}2"); func += GetBuildDateAndTime();
|
||||
func += F("}1" D_CORE_AND_SDK_VERSION "}2" ARDUINO_ESP8266_RELEASE "/"); func += String(ESP.getSdkVersion());
|
||||
|
@ -1517,7 +1563,7 @@ void HandleInformation()
|
|||
func += F("}1" D_MQTT_USER "}2"); func += Settings.mqtt_user;
|
||||
func += F("}1" D_MQTT_TOPIC "}2"); func += Settings.mqtt_topic;
|
||||
func += F("}1" D_MQTT_GROUP_TOPIC "}2"); func += Settings.mqtt_grptopic;
|
||||
GetTopic_P(stopic, 0, Settings.mqtt_topic, "");
|
||||
GetTopic_P(stopic, CMND, Settings.mqtt_topic, "");
|
||||
func += F("}1" D_MQTT_FULL_TOPIC "}2"); func += stopic;
|
||||
|
||||
} else {
|
||||
|
|
|
@ -99,6 +99,7 @@ uint8_t light_signal_color[5];
|
|||
|
||||
uint8_t light_wheel = 0;
|
||||
uint8_t light_subtype = 0;
|
||||
uint8_t light_device = 0;
|
||||
uint8_t light_power = 0;
|
||||
uint8_t light_update = 1;
|
||||
uint8_t light_wakeup_active = 0;
|
||||
|
@ -248,8 +249,8 @@ void AriluxRfInit()
|
|||
void AriluxRfDisable()
|
||||
{
|
||||
if ((pin[GPIO_ARIRFRCV] < 99) && (pin[GPIO_LED2] < 99)) {
|
||||
digitalWrite(pin[GPIO_LED2], bitRead(led_inverted, 1)); // Turn off RF
|
||||
detachInterrupt(pin[GPIO_ARIRFRCV]);
|
||||
digitalWrite(pin[GPIO_LED2], bitRead(led_inverted, 1)); // Turn off RF
|
||||
}
|
||||
}
|
||||
#endif // USE_ARILUX_RF
|
||||
|
@ -337,6 +338,7 @@ void LightInit()
|
|||
{
|
||||
uint8_t max_scheme = LS_MAX -1;
|
||||
|
||||
light_device = devices_present;
|
||||
light_subtype = light_type &7;
|
||||
|
||||
if (light_type < LT_PWM6) { // PWM
|
||||
|
@ -526,33 +528,56 @@ char* LightGetColor(uint8_t type, char* scolor)
|
|||
void LightPowerOn()
|
||||
{
|
||||
if (Settings.light_dimmer && !(light_power)) {
|
||||
ExecuteCommandPower(devices_present, 1);
|
||||
ExecuteCommandPower(light_device, 1);
|
||||
}
|
||||
}
|
||||
|
||||
void LightState(uint8_t append)
|
||||
{
|
||||
char scolor[25];
|
||||
char scommand[33];
|
||||
|
||||
if (append) {
|
||||
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,"), mqtt_data);
|
||||
} else {
|
||||
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{"));
|
||||
}
|
||||
GetPowerDevice(scommand, light_device, sizeof(scommand));
|
||||
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s\"%s\":\"%s\",\"" D_CMND_DIMMER "\":%d"),
|
||||
mqtt_data, scommand, GetStateText(light_power), Settings.light_dimmer);
|
||||
if (light_subtype > LST_SINGLE) {
|
||||
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"" D_CMND_COLOR "\":\"%s\""), mqtt_data, LightGetColor(0, scolor));
|
||||
}
|
||||
if ((LST_COLDWARM == light_subtype) || (LST_RGBWC == light_subtype)) {
|
||||
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"" D_CMND_COLORTEMPERATURE "\":%d"), mqtt_data, LightGetColorTemp());
|
||||
}
|
||||
if (append) {
|
||||
if (light_subtype >= LST_RGB) {
|
||||
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"" D_CMND_SCHEME "\":%d"), mqtt_data, Settings.light_scheme);
|
||||
}
|
||||
if (LT_WS2812 == light_type) {
|
||||
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"" D_CMND_WIDTH "\":%d"), mqtt_data, Settings.light_width);
|
||||
}
|
||||
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"" D_CMND_FADE "\":\"%s\",\"" D_CMND_SPEED "\":%d,\"" D_CMND_LEDTABLE "\":\"%s\""),
|
||||
mqtt_data, GetStateText(Settings.light_fade), Settings.light_speed, GetStateText(Settings.light_correction));
|
||||
} else {
|
||||
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s}"), mqtt_data);
|
||||
}
|
||||
}
|
||||
|
||||
void LightPreparePower()
|
||||
{
|
||||
char scolor[25];
|
||||
char scommand[33];
|
||||
|
||||
if (Settings.light_dimmer && !(light_power)) {
|
||||
ExecuteCommandPower(devices_present, 7); // No publishPowerState
|
||||
ExecuteCommandPower(light_device, 7); // No publishPowerState
|
||||
}
|
||||
else if (!Settings.light_dimmer && light_power) {
|
||||
ExecuteCommandPower(devices_present, 6); // No publishPowerState
|
||||
ExecuteCommandPower(light_device, 6); // No publishPowerState
|
||||
}
|
||||
#ifdef USE_DOMOTICZ
|
||||
DomoticzUpdatePowerState(devices_present);
|
||||
DomoticzUpdatePowerState(light_device);
|
||||
#endif // USE_DOMOTICZ
|
||||
|
||||
GetPowerDevice(scommand, devices_present, sizeof(scommand));
|
||||
if (light_subtype > LST_SINGLE) {
|
||||
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"%s\":\"%s\",\"" D_CMND_DIMMER "\":%d,\"" D_CMND_COLOR "\":\"%s\"}"),
|
||||
scommand, GetStateText(light_power), Settings.light_dimmer, LightGetColor(0, scolor));
|
||||
} else {
|
||||
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"%s\":\"%s\",\"" D_CMND_DIMMER "\":%d}"),
|
||||
scommand, GetStateText(light_power), Settings.light_dimmer);
|
||||
}
|
||||
LightState(0);
|
||||
}
|
||||
|
||||
void LightFade()
|
||||
|
@ -636,7 +661,8 @@ void LightRandomColor()
|
|||
|
||||
void LightSetPower()
|
||||
{
|
||||
light_power = XdrvMailbox.index;
|
||||
// light_power = XdrvMailbox.index;
|
||||
light_power = bitRead(XdrvMailbox.index, light_device -1);
|
||||
if (light_wakeup_active) {
|
||||
light_wakeup_active--;
|
||||
}
|
||||
|
@ -701,7 +727,7 @@ void LightAnimate()
|
|||
}
|
||||
} else {
|
||||
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"" D_CMND_WAKEUP "\":\"" D_JSON_DONE "\"}"));
|
||||
MqttPublishPrefixTopic_P(2, PSTR(D_CMND_WAKEUP));
|
||||
MqttPublishPrefixTopic_P(TELE, PSTR(D_CMND_WAKEUP));
|
||||
light_wakeup_active = 0;
|
||||
Settings.light_scheme = LS_POWER;
|
||||
}
|
||||
|
@ -908,7 +934,7 @@ void LightSetHsb(float hue, float sat, float bri, uint16_t ct)
|
|||
LightSetColor();
|
||||
}
|
||||
LightPreparePower();
|
||||
MqttPublishPrefixTopic_P(5, PSTR(D_CMND_COLOR));
|
||||
MqttPublishPrefixTopic_P(RESULT_OR_STAT, PSTR(D_CMND_COLOR));
|
||||
} else {
|
||||
uint8_t tmp = (uint8_t)(bri * 100);
|
||||
Settings.light_dimmer = tmp;
|
||||
|
@ -917,10 +943,10 @@ void LightSetHsb(float hue, float sat, float bri, uint16_t ct)
|
|||
LightSetColorTemp(ct);
|
||||
}
|
||||
LightPreparePower();
|
||||
MqttPublishPrefixTopic_P(5, PSTR(D_CMND_COLOR));
|
||||
MqttPublishPrefixTopic_P(RESULT_OR_STAT, PSTR(D_CMND_COLOR));
|
||||
} else {
|
||||
LightPreparePower();
|
||||
MqttPublishPrefixTopic_P(5, PSTR(D_CMND_DIMMER));
|
||||
MqttPublishPrefixTopic_P(RESULT_OR_STAT, PSTR(D_CMND_DIMMER));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -962,7 +988,8 @@ boolean LightColorEntry(char *buffer, uint8_t buffer_length)
|
|||
light_entry_color[i++] = atoi(str);
|
||||
}
|
||||
}
|
||||
entry_type = (light_subtype == i) ? 2 : 0; // Decimal
|
||||
// entry_type = (light_subtype == i) ? 2 : 0; // Decimal
|
||||
entry_type = 2; // Decimal
|
||||
}
|
||||
else if ((2 * light_subtype) == buffer_length) { // Hexadecimal entry
|
||||
for (byte i = 0; i < light_subtype; i++) {
|
||||
|
@ -1181,7 +1208,7 @@ boolean LightCommand()
|
|||
scolor[6] = '\0'; // RGB only
|
||||
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,%d,%d,%d,%d,%d"),
|
||||
scolor, Settings.light_fade, Settings.light_correction, Settings.light_scheme, Settings.light_speed, Settings.light_width);
|
||||
MqttPublishPrefixTopic_P(1, XdrvMailbox.topic);
|
||||
MqttPublishPrefixTopic_P(STAT, XdrvMailbox.topic);
|
||||
mqtt_data[0] = '\0';
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -109,7 +109,7 @@ void IrReceiveCheck()
|
|||
}
|
||||
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"" D_JSON_IRRECEIVED "\":{\"" D_JSON_IR_PROTOCOL "\":\"%s\",\"" D_JSON_IR_BITS "\":%d,\"" D_JSON_IR_DATA "\":\"%X\"}}"),
|
||||
GetTextIndexed(sirtype, sizeof(sirtype), iridx, kIrRemoteProtocols), results.bits, results.value);
|
||||
MqttPublishPrefixTopic_P(6, PSTR(D_JSON_IRRECEIVED));
|
||||
MqttPublishPrefixTopic_P(RESULT_OR_TELE, PSTR(D_JSON_IRRECEIVED));
|
||||
#ifdef USE_DOMOTICZ
|
||||
unsigned long value = results.value | (iridx << 28); // [Protocol:4, Data:28]
|
||||
DomoticzSensor(DZ_COUNT, value); // Send data as Domoticz Counter value
|
||||
|
@ -309,21 +309,26 @@ boolean IrSendCommand()
|
|||
data = ir_json[D_JSON_IR_DATA];
|
||||
if (protocol && bits && data) {
|
||||
int protocol_code = GetCommandCode(protocol_text, sizeof(protocol_text), protocol, kIrRemoteProtocols);
|
||||
|
||||
snprintf_P(log_data, sizeof(log_data), PSTR("IRS: protocol_text %s, protocol %s, bits %d, data %d, protocol_code %d"),
|
||||
protocol_text, protocol, bits, data, protocol_code);
|
||||
AddLog(LOG_LEVEL_DEBUG);
|
||||
|
||||
switch (protocol_code) {
|
||||
case NEC:
|
||||
irsend->sendNEC(data, bits); break;
|
||||
irsend->sendNEC(data, (bits > NEC_BITS) ? NEC_BITS : bits); break;
|
||||
case SONY:
|
||||
irsend->sendSony(data, bits); break;
|
||||
irsend->sendSony(data, (bits > SONY_20_BITS) ? SONY_20_BITS : bits, 2); break;
|
||||
case RC5:
|
||||
irsend->sendRC5(data, bits); break;
|
||||
case RC6:
|
||||
irsend->sendRC6(data, bits); break;
|
||||
case DISH:
|
||||
irsend->sendDISH(data, bits); break;
|
||||
irsend->sendDISH(data, (bits > DISH_BITS) ? DISH_BITS : bits); break;
|
||||
case JVC:
|
||||
irsend->sendJVC(data, bits, 1); break;
|
||||
irsend->sendJVC(data, (bits > JVC_BITS) ? JVC_BITS : bits, 1); break;
|
||||
case SAMSUNG:
|
||||
irsend->sendSAMSUNG(data, bits); break;
|
||||
irsend->sendSAMSUNG(data, (bits > SAMSUNG_BITS) ? SAMSUNG_BITS : bits); break;
|
||||
case PANASONIC:
|
||||
irsend->sendPanasonic(bits, data); break;
|
||||
default:
|
||||
|
|
|
@ -556,7 +556,7 @@ void EnergyMarginCheck()
|
|||
}
|
||||
if (jsonflg) {
|
||||
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s}"), mqtt_data);
|
||||
MqttPublishPrefixTopic_P(2, PSTR(D_RSLT_MARGINS));
|
||||
MqttPublishPrefixTopic_P(TELE, PSTR(D_RSLT_MARGINS));
|
||||
EnergyMqttShow();
|
||||
}
|
||||
}
|
||||
|
@ -571,7 +571,7 @@ void EnergyMarginCheck()
|
|||
energy_mplh_counter--;
|
||||
if (!energy_mplh_counter) {
|
||||
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"" D_JSON_MAXPOWERREACHED "\":\"%d%s\"}"), energy_power_u, (Settings.flag.value_units) ? " " D_UNIT_WATT : "");
|
||||
MqttPublishPrefixTopic_P(1, S_RSLT_WARNING);
|
||||
MqttPublishPrefixTopic_P(STAT, S_RSLT_WARNING);
|
||||
EnergyMqttShow();
|
||||
ExecuteCommandPower(1, 0);
|
||||
if (!energy_mplr_counter) {
|
||||
|
@ -594,11 +594,11 @@ void EnergyMarginCheck()
|
|||
energy_mplr_counter--;
|
||||
if (energy_mplr_counter) {
|
||||
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"" D_JSON_POWERMONITOR "\":\"%s\"}"), GetStateText(1));
|
||||
MqttPublishPrefixTopic_P(5, PSTR(D_JSON_POWERMONITOR));
|
||||
MqttPublishPrefixTopic_P(RESULT_OR_STAT, PSTR(D_JSON_POWERMONITOR));
|
||||
ExecuteCommandPower(1, 1);
|
||||
} else {
|
||||
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"" D_JSON_MAXPOWERREACHEDRETRY "\":\"%s\"}"), GetStateText(0));
|
||||
MqttPublishPrefixTopic_P(1, S_RSLT_WARNING);
|
||||
MqttPublishPrefixTopic_P(STAT, S_RSLT_WARNING);
|
||||
EnergyMqttShow();
|
||||
}
|
||||
}
|
||||
|
@ -612,14 +612,14 @@ void EnergyMarginCheck()
|
|||
if (!energy_max_energy_state && (RtcTime.hour == Settings.energy_max_energy_start)) {
|
||||
energy_max_energy_state = 1;
|
||||
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"" D_JSON_ENERGYMONITOR "\":\"%s\"}"), GetStateText(1));
|
||||
MqttPublishPrefixTopic_P(5, PSTR(D_JSON_ENERGYMONITOR));
|
||||
MqttPublishPrefixTopic_P(RESULT_OR_STAT, PSTR(D_JSON_ENERGYMONITOR));
|
||||
ExecuteCommandPower(1, 1);
|
||||
}
|
||||
else if ((1 == energy_max_energy_state) && (energy_daily_u >= Settings.energy_max_energy)) {
|
||||
energy_max_energy_state = 2;
|
||||
dtostrfd(energy_daily, 3, mqtt_data);
|
||||
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"" D_JSON_MAXENERGYREACHED "\":\"%s%s\"}"), mqtt_data, (Settings.flag.value_units) ? " " D_UNIT_KILOWATTHOUR : "");
|
||||
MqttPublishPrefixTopic_P(1, S_RSLT_WARNING);
|
||||
MqttPublishPrefixTopic_P(STAT, S_RSLT_WARNING);
|
||||
EnergyMqttShow();
|
||||
ExecuteCommandPower(1, 0);
|
||||
}
|
||||
|
@ -632,7 +632,8 @@ void EnergyMqttShow()
|
|||
// {"Time":"2017-12-16T11:48:55","ENERGY":{"Total":0.212,"Yesterday":0.000,"Today":0.014,"Period":2.0,"Power":22.0,"Factor":1.00,"Voltage":213.6,"Current":0.100}}
|
||||
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"" D_JSON_TIME "\":\"%s\""), GetDateAndTime().c_str());
|
||||
EnergyShow(1);
|
||||
MqttPublishPrefixTopic_P(2, PSTR(D_RSLT_ENERGY), Settings.flag.mqtt_sensor_retain);
|
||||
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s}"), mqtt_data);
|
||||
MqttPublishPrefixTopic_P(TELE, PSTR(D_RSLT_ENERGY), Settings.flag.mqtt_sensor_retain);
|
||||
}
|
||||
|
||||
/*********************************************************************************************\
|
||||
|
|
|
@ -41,7 +41,7 @@ void SonoffBridgeLearnFailed()
|
|||
{
|
||||
sonoff_bridge_learn_active = 0;
|
||||
snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_INDEX_SVALUE, D_CMND_RFKEY, sonoff_bridge_learn_key, D_JSON_LEARN_FAILED);
|
||||
MqttPublishPrefixTopic_P(5, PSTR(D_CMND_RFKEY));
|
||||
MqttPublishPrefixTopic_P(RESULT_OR_STAT, PSTR(D_CMND_RFKEY));
|
||||
}
|
||||
|
||||
void SonoffBridgeReceived()
|
||||
|
@ -72,7 +72,7 @@ void SonoffBridgeReceived()
|
|||
Settings.rf_code[sonoff_bridge_learn_key][i] = serial_in_buffer[i +1];
|
||||
}
|
||||
snprintf_P(mqtt_data, sizeof(mqtt_data), S_JSON_COMMAND_INDEX_SVALUE, D_CMND_RFKEY, sonoff_bridge_learn_key, D_JSON_LEARNED);
|
||||
MqttPublishPrefixTopic_P(5, PSTR(D_CMND_RFKEY));
|
||||
MqttPublishPrefixTopic_P(RESULT_OR_STAT, PSTR(D_CMND_RFKEY));
|
||||
} else {
|
||||
SonoffBridgeLearnFailed();
|
||||
}
|
||||
|
@ -102,7 +102,7 @@ void SonoffBridgeReceived()
|
|||
}
|
||||
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("{\"" D_JSON_RFRECEIVED "\":{\"" D_JSON_SYNC "\":%d,\"" D_JSON_LOW "\":%d,\"" D_JSON_HIGH "\":%d,\"" D_JSON_DATA "\":\"%06X\",\"" D_CMND_RFKEY "\":%s}}"),
|
||||
sync_time, low_time, high_time, received_id, rfkey);
|
||||
MqttPublishPrefixTopic_P(6, PSTR(D_JSON_RFRECEIVED));
|
||||
MqttPublishPrefixTopic_P(RESULT_OR_TELE, PSTR(D_JSON_RFRECEIVED));
|
||||
#ifdef USE_DOMOTICZ
|
||||
DomoticzSensor(DZ_COUNT, received_id); // Send rid as Domoticz Counter value
|
||||
#endif // USE_DOMOTICZ
|
||||
|
|
|
@ -94,11 +94,6 @@ void DomoticzMqttUpdate()
|
|||
}
|
||||
}
|
||||
|
||||
void DomoticzSetUpdateTimer(uint16_t value)
|
||||
{
|
||||
domoticz_update_timer = value;
|
||||
}
|
||||
|
||||
void DomoticzMqttSubscribe()
|
||||
{
|
||||
uint8_t maxdev = (devices_present > MAX_DOMOTICZ_IDX) ? MAX_DOMOTICZ_IDX : devices_present;
|
||||
|
@ -418,6 +413,9 @@ boolean Xdrv05(byte function)
|
|||
case FUNC_MQTT_SUBSCRIBE:
|
||||
DomoticzMqttSubscribe();
|
||||
break;
|
||||
case FUNC_MQTT_INIT:
|
||||
domoticz_update_timer = 2;
|
||||
break;
|
||||
case FUNC_MQTT_DATA:
|
||||
result = DomoticzMqttData();
|
||||
break;
|
||||
|
|
|
@ -0,0 +1,148 @@
|
|||
/*
|
||||
xdrv_07_home_assistant.ino - home assistant support for Sonoff-Tasmota
|
||||
|
||||
Copyright (C) 2018 Theo Arends
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifdef USE_HOME_ASSISTANT
|
||||
|
||||
const char HASS_DISCOVER_SWITCH[] PROGMEM =
|
||||
"{\"name\":\"%s\"," // dualr2 1
|
||||
"\"command_topic\":\"%s\"," // cmnd/dualr2/POWER2
|
||||
"\"state_topic\":\"%s\"," // stat/dualr2/RESULT (implies "\"optimistic\":\"false\",")
|
||||
"\"value_template\":\"{{value_json.%s}}\"," // POWER2
|
||||
"\"payload_off\":\"%s\"," // OFF
|
||||
"\"payload_on\":\"%s\"," // ON
|
||||
// "\"optimistic\":\"false\"," // false is Hass default when state_topic is set
|
||||
"\"availability_topic\":\"%s\"," // tele/dualr2/LWT
|
||||
"\"payload_available\":\"" D_ONLINE "\"," // Online
|
||||
"\"payload_not_available\":\"" D_OFFLINE "\""; // Offline
|
||||
|
||||
const char HASS_DISCOVER_LIGHT_DIMMER[] PROGMEM =
|
||||
"%s,\"brightness_command_topic\":\"%s\"," // cmnd/led2/Dimmer
|
||||
"\"brightness_state_topic\":\"%s\"," // stat/led2/RESULT
|
||||
"\"brightness_scale\":100," // 100%
|
||||
"\"on_command_type\":\"brightness\"," // power on (first), power on (last), no power on (brightness)
|
||||
"\"brightness_value_template\":\"{{value_json." D_CMND_DIMMER "}}\"";
|
||||
|
||||
const char HASS_DISCOVER_LIGHT_COLOR[] PROGMEM =
|
||||
"%s,\"rgb_command_topic\":\"%s\"," // cmnd/led2/Color
|
||||
"\"rgb_state_topic\":\"%s\"," // stat/led2/RESULT
|
||||
"\"rgb_value_template\":\"{{value_json." D_CMND_COLOR "}}\"";
|
||||
// "\"rgb_value_template\":\"{{value_json." D_CMND_COLOR " | join(',')}}\"";
|
||||
|
||||
const char HASS_DISCOVER_LIGHT_CT[] PROGMEM =
|
||||
"%s,\"color_temp_command_topic\":\"%s\"," // cmnd/led2/CT
|
||||
"\"color_temp_state_topic\":\"%s\"," // stat/led2/RESULT
|
||||
"\"color_temp_value_template\":\"{{value_json." D_CMND_COLORTEMPERATURE "}}\"";
|
||||
/*
|
||||
const char HASS_DISCOVER_LIGHT_SCHEME[] PROGMEM =
|
||||
"%s,\"effect_command_topic\":\"%s\"," // cmnd/led2/Scheme
|
||||
"\"effect_state_topic\":\"%s\"," // stat/led2/RESULT
|
||||
"\"effect_value_template\":\"{{value_json." D_CMND_SCHEME "}}\","
|
||||
"\"effect_list\":\"[0, 1, 2, 3, 4]\""; // Needs to be a Python string list providing Scheme parameter values (Unable to get this functional)
|
||||
*/
|
||||
void HAssDiscovery()
|
||||
{
|
||||
char sidx[8];
|
||||
char stopic[TOPSZ];
|
||||
bool is_light = false;
|
||||
|
||||
// Configure Tasmota for default Home Assistant parameters to keep discovery message as short as possible
|
||||
if (Settings.flag.hass_discovery) {
|
||||
Settings.flag.mqtt_response = 0; // Response always as RESULT and not as uppercase command
|
||||
Settings.flag.decimal_text = 1; // Respond with decimal color values
|
||||
// Settings.light_scheme = 0; // To just control color it needs to be Scheme 0
|
||||
// strncpy_P(Settings.mqtt_fulltopic, PSTR("%prefix%/%topic%/"), sizeof(Settings.mqtt_fulltopic)); // Make MQTT topic as short as possible to make this process posible within MQTT_MAX_PACKET_SIZE
|
||||
}
|
||||
|
||||
for (int i = 1; i <= devices_present; i++) {
|
||||
is_light = ((i == devices_present) && (light_type));
|
||||
|
||||
snprintf_P(sidx, sizeof(sidx), PSTR("_%d"), i);
|
||||
snprintf_P(stopic, sizeof(stopic), PSTR(HOME_ASSISTANT_DISCOVERY_PREFIX "/%s/%s%s/config"), (is_light) ? "light" : "switch", Settings.mqtt_topic, (1 == devices_present) ? "" : sidx);
|
||||
|
||||
mqtt_data[0] = '\0';
|
||||
if (Settings.flag.hass_discovery) {
|
||||
char name[33];
|
||||
char value_template[33];
|
||||
char command_topic[TOPSZ];
|
||||
char state_topic[TOPSZ];
|
||||
char availability_topic[TOPSZ];
|
||||
|
||||
if (i > MAX_FRIENDLYNAMES) {
|
||||
snprintf_P(name, sizeof(name), PSTR("%s %d"), Settings.friendlyname[0], i);
|
||||
} else {
|
||||
snprintf_P(name, sizeof(name), Settings.friendlyname[i -1]);
|
||||
}
|
||||
GetPowerDevice(value_template, i, sizeof(value_template));
|
||||
GetTopic_P(command_topic, CMND, Settings.mqtt_topic, value_template);
|
||||
GetTopic_P(state_topic, STAT, Settings.mqtt_topic, S_RSLT_RESULT);
|
||||
GetTopic_P(availability_topic, TELE, Settings.mqtt_topic, S_LWT);
|
||||
snprintf_P(mqtt_data, sizeof(mqtt_data), HASS_DISCOVER_SWITCH, name, command_topic, state_topic, value_template, Settings.state_text[0], Settings.state_text[1], availability_topic);
|
||||
|
||||
if (is_light) {
|
||||
char brightness_command_topic[TOPSZ];
|
||||
|
||||
GetTopic_P(brightness_command_topic, CMND, Settings.mqtt_topic, D_CMND_DIMMER);
|
||||
snprintf_P(mqtt_data, sizeof(mqtt_data), HASS_DISCOVER_LIGHT_DIMMER, mqtt_data, brightness_command_topic, state_topic);
|
||||
|
||||
if (light_subtype >= LST_RGB) {
|
||||
char rgb_command_topic[TOPSZ];
|
||||
|
||||
GetTopic_P(rgb_command_topic, CMND, Settings.mqtt_topic, D_CMND_COLOR);
|
||||
snprintf_P(mqtt_data, sizeof(mqtt_data), HASS_DISCOVER_LIGHT_COLOR, mqtt_data, rgb_command_topic, state_topic);
|
||||
/*
|
||||
char effect_command_topic[TOPSZ];
|
||||
|
||||
GetTopic_P(effect_command_topic, CMND, Settings.mqtt_topic, D_CMND_SCHEME);
|
||||
snprintf_P(mqtt_data, sizeof(mqtt_data), HASS_DISCOVER_LIGHT_SCHEME, mqtt_data, effect_command_topic, state_topic);
|
||||
*/
|
||||
}
|
||||
if ((LST_COLDWARM == light_subtype) || (LST_RGBWC == light_subtype)) {
|
||||
char color_temp_command_topic[TOPSZ];
|
||||
|
||||
GetTopic_P(color_temp_command_topic, CMND, Settings.mqtt_topic, D_CMND_COLORTEMPERATURE);
|
||||
snprintf_P(mqtt_data, sizeof(mqtt_data), HASS_DISCOVER_LIGHT_CT, mqtt_data, color_temp_command_topic, state_topic);
|
||||
}
|
||||
}
|
||||
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s}"), mqtt_data);
|
||||
}
|
||||
MqttPublish(stopic, true);
|
||||
}
|
||||
}
|
||||
|
||||
/*********************************************************************************************\
|
||||
* Interface
|
||||
\*********************************************************************************************/
|
||||
|
||||
#define XDRV_07
|
||||
|
||||
boolean Xdrv07(byte function)
|
||||
{
|
||||
boolean result = false;
|
||||
|
||||
if (Settings.flag.mqtt_enabled) {
|
||||
switch (function) {
|
||||
case FUNC_MQTT_INIT:
|
||||
HAssDiscovery();
|
||||
break;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
#endif // USE_HOME_ASSISTANT
|
|
@ -82,7 +82,7 @@ boolean XdrvCommand(char *type, uint16_t index, char *dataBuf, uint16_t data_len
|
|||
return XdrvCall(FUNC_COMMAND);
|
||||
}
|
||||
|
||||
void XdrvSetPower(uint8_t mpower)
|
||||
void XdrvSetPower(power_t mpower)
|
||||
{
|
||||
// XdrvMailbox.valid = 1;
|
||||
XdrvMailbox.index = mpower;
|
||||
|
@ -102,6 +102,16 @@ boolean XdrvMqttData(char *topicBuf, uint16_t stopicBuf, char *dataBuf, uint16_t
|
|||
|
||||
/*********************************************************************************************\
|
||||
* Function call to all xdrv
|
||||
*
|
||||
* FUNC_INIT
|
||||
* FUNC_MQTT_SUBSCRIBE
|
||||
* FUNC_MQTT_INIT
|
||||
* return FUNC_MQTT_DATA
|
||||
* return FUNC_COMMAND
|
||||
* FUNC_SET_POWER
|
||||
* FUNC_SHOW_SENSOR
|
||||
* FUNC_EVERY_SECOND
|
||||
* FUNC_EVERY_50_MSECOND
|
||||
\*********************************************************************************************/
|
||||
|
||||
boolean XdrvCall(byte Function)
|
||||
|
|
|
@ -192,7 +192,7 @@ void Ds18b20Show(boolean json)
|
|||
if (Ds18b20Read(t)) { // Check if read failed
|
||||
char temperature[10];
|
||||
|
||||
dtostrfi(t, Settings.flag2.temperature_resolution, temperature);
|
||||
dtostrfd(t, Settings.flag2.temperature_resolution, temperature);
|
||||
|
||||
if(json) {
|
||||
snprintf_P(mqtt_data, sizeof(mqtt_data), PSTR("%s,\"DS18B20\":{\"" D_JSON_TEMPERATURE "\":%s}"), mqtt_data, temperature);
|
||||
|
|
|
@ -504,8 +504,12 @@ boolean Xsns09(byte function)
|
|||
switch (function) {
|
||||
case FUNC_PREP_BEFORE_TELEPERIOD:
|
||||
BmpDetect();
|
||||
break;
|
||||
case FUNC_EVERY_SECOND:
|
||||
#ifdef USE_BME680
|
||||
Bme680PerformReading();
|
||||
if (tele_period == Settings.tele_period -3) {
|
||||
Bme680PerformReading();
|
||||
}
|
||||
#endif // USE_BME680
|
||||
break;
|
||||
case FUNC_JSON_APPEND:
|
||||
|
|
|
@ -71,6 +71,7 @@ const char kMhzTypes[] PROGMEM = "MHZ19|MHZ19B";
|
|||
const uint8_t mhz_cmnd_read_ppm[9] = {0xFF, 0x01, 0x86, 0x00, 0x00, 0x00, 0x00, 0x00, 0x79};
|
||||
const uint8_t mhz_cmnd_abc_enable[9] = {0xFF, 0x01, 0x79, 0xA0, 0x00, 0x00, 0x00, 0x00, 0xE6};
|
||||
const uint8_t mhz_cmnd_abc_disable[9] = {0xFF, 0x01, 0x79, 0x00, 0x00, 0x00, 0x00, 0x00, 0x86};
|
||||
//const uint8_t mhz_cmnd_zeropoint[9] = {0xff, 0x01, 0x87, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78};
|
||||
|
||||
uint8_t mhz_type = 1;
|
||||
uint16_t mhz_last_ppm = 0;
|
||||
|
|
|
@ -112,6 +112,14 @@ void XSnsInit()
|
|||
|
||||
/*********************************************************************************************\
|
||||
* Function call to all xsns
|
||||
*
|
||||
* FUNC_INIT
|
||||
* FUNC_PREP_BEFORE_TELEPERIOD
|
||||
* FUNC_SAVE_BEFORE_RESTART
|
||||
* FUNC_JSON_APPEND
|
||||
* FUNC_WEB_APPEND
|
||||
* FUNC_EVERY_SECOND
|
||||
* FUNC_EVERY_50_MSECOND
|
||||
\*********************************************************************************************/
|
||||
|
||||
boolean XsnsCall(byte Function)
|
||||
|
|
Loading…
Reference in New Issue