mirror of https://github.com/arendst/Tasmota.git
Add I18n and fix invalid JSON
5.6.1i * Add basic internationalization and localization (#763) * Fix invalid JSON (#822)
This commit is contained in:
parent
740a0c6283
commit
0fbbc23b2c
|
@ -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.6.1h** - See [sonoff/_releasenotes.ino](https://github.com/arendst/Sonoff-Tasmota/blob/development/sonoff/_releasenotes.ino) for change information.
|
||||
Current version is **5.6.1i** - See [sonoff/_releasenotes.ino](https://github.com/arendst/Sonoff-Tasmota/blob/development/sonoff/_releasenotes.ino) for change information.
|
||||
|
||||
### ATTENTION All versions
|
||||
|
||||
|
@ -55,5 +55,5 @@ The following devices are supported:
|
|||
- [iTead Motor Clockwise/Anticlockwise](https://www.itead.cc/smart-home/motor-reversing-wifi-wireless-switch.html)
|
||||
- [Electrodragon IoT Relay Board](http://www.electrodragon.com/product/wifi-iot-relay-board-based-esp8266/)
|
||||
|
||||
<img src="https://github.com/arendst/arendst.github.io/blob/master/media/sonofftoucheu.jpg" height="280" align="left" />
|
||||
<img src="https://github.com/arendst/arendst.github.io/blob/master/media/sonoff4ch.jpg" height="250" align="right" />
|
||||
<img src="https://github.com/arendst/arendst.github.io/blob/master/media/sonofftoucheu.jpg" height="280" align="left" />
|
||||
<img src="https://github.com/arendst/arendst.github.io/blob/master/media/sonoff4ch.jpg" height="250" align="right" />
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
/* 5.6.1h
|
||||
/* 5.6.1i
|
||||
* Add basic internationalization and localization (#763)
|
||||
* Fix invalid JSON (#822)
|
||||
*
|
||||
* 5.6.1h
|
||||
* Add PulseTime to power check at startup (#526)
|
||||
*
|
||||
* 5.6.1g
|
||||
|
@ -80,7 +84,7 @@
|
|||
* Fix button 1 double press behaviour on multi relay devices
|
||||
* Add support for Hua Fan Smart Socket (#479)
|
||||
* Add support for Sonoff 4ch Pro (#565)
|
||||
* Add command SetOption13 1 to allow immediate action on single button press
|
||||
* Add command SetOption13 1 to allow immediate action on single button press
|
||||
* (disables multipress, hold and unrestricted commands) (#587)
|
||||
*
|
||||
* 5.3.0 20170715
|
||||
|
@ -111,7 +115,7 @@
|
|||
*
|
||||
* 5.2.1 20170622
|
||||
* Fix Restore Configuration in case of lower version
|
||||
* Revert auto configuration upgrade allowing easy upgrade which was removed in version 5.2.0
|
||||
* Revert auto configuration upgrade allowing easy upgrade which was removed in version 5.2.0
|
||||
* Fix config auto upgrade from versions below version 4.1.1 (#530)
|
||||
*
|
||||
* 5.2.0 20170619
|
||||
|
@ -180,7 +184,7 @@
|
|||
* Add command MqttRetry <seconds> to change default MQTT reconnect retry timer from minimal 10 seconds (#429)
|
||||
*
|
||||
* 5.0.5 20170508
|
||||
* Add command FullTopic with tokens %topic% (replaced by command Topic value) and
|
||||
* Add command FullTopic with tokens %topic% (replaced by command Topic value) and
|
||||
* %prefix% (replaced by command Prefix<x> values) for more flexible topic definitions (#244)
|
||||
* See wiki > MQTT Features https://github.com/arendst/Sonoff-Tasmota/wiki/MQTT-Features for more information
|
||||
*
|
||||
|
@ -255,7 +259,7 @@
|
|||
* Remove restart after IPAddress changes (#292)
|
||||
* Add support for MAX31850 in xsns_ds18x20.ino (#295)
|
||||
* Fix possible uptime update misses (#302)
|
||||
*
|
||||
*
|
||||
* 4.1.0 20170325
|
||||
* Change static IP addresses in user_config.h from list (using commas) to string (using dots)
|
||||
* Unify display result of commands Modules, Module and Gpios
|
||||
|
@ -354,7 +358,7 @@
|
|||
* 3.9.20 20170221
|
||||
* Add minimal basic authentication to Web Admin mode (#87)
|
||||
* Fix Hue and add HSB support (#89)
|
||||
*
|
||||
*
|
||||
* 3.9.19 20170219
|
||||
* Sonoff Led: Made GPIO04, 05 and 15 available for user
|
||||
* Sonoff Led: Add commands Fade, Speed, WakupDuration, Wakeup and LedTable
|
||||
|
@ -364,7 +368,7 @@
|
|||
* Fix Sonoff Led dimmer range (#16)
|
||||
* Change Sonoff Led command Dimmer to act on both cold and warm color
|
||||
* Add Sonoff Led command Color CCWW where CCWW are hexadecimal values fro 00 - FF
|
||||
* Reduce Sonoff Led flickering by disabling interrupts during flash save and disabling
|
||||
* Reduce Sonoff Led flickering by disabling interrupts during flash save and disabling
|
||||
* Led during OTA upgrade and Web upload (#16)
|
||||
*
|
||||
* 3.9.17 20170217
|
||||
|
@ -435,7 +439,7 @@
|
|||
*
|
||||
* 3.9.3 20170127
|
||||
* Add confirmation before Restart via webpage
|
||||
* Expand Domoticz Configuration webpage with Key, Switch and Sensor Index and
|
||||
* Expand Domoticz Configuration webpage with Key, Switch and Sensor Index and
|
||||
* add commands DomoticzSwitchIdx and DomoticzSensorIdx (#86) (#174) (#219)
|
||||
* Fix default DHT11 sensor driver selection
|
||||
* Fix LedPower status after button press (#279)
|
||||
|
@ -498,7 +502,7 @@
|
|||
* Add friendlyname to webpage replacing former hostname
|
||||
*
|
||||
* 3.1.15 20170108
|
||||
* Fix Domoticz send key regression with Toggle command
|
||||
* Fix Domoticz send key regression with Toggle command
|
||||
*
|
||||
* 3.1.14 20170107
|
||||
* Add support for command TOGGLE (define MQTT_CMND_TOGGLE) when ButtonTopic is in use and not equal to Topic (#207)
|
||||
|
|
|
@ -0,0 +1,80 @@
|
|||
/*
|
||||
i18n.h - internationalization for Sonoff-Tasmota
|
||||
|
||||
Copyright (C) 2017 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/>.
|
||||
*/
|
||||
|
||||
#ifndef LANGUAGE
|
||||
#define LANGUAGE "language\en-GB.h"
|
||||
#endif
|
||||
#include LANGUAGE
|
||||
|
||||
// Common
|
||||
|
||||
const char S_LOG_HTTP[] PROGMEM = D_LOG_HTTP;
|
||||
const char S_LOG_WIFI[] PROGMEM = D_LOG_WIFI;
|
||||
const char S_LOG_MQTT[] PROGMEM = D_LOG_MQTT;
|
||||
|
||||
const char S_RSLT_POWER[] PROGMEM = D_RSLT_POWER;
|
||||
const char S_RSLT_RESULT[] PROGMEM = D_RSLT_RESULT;
|
||||
const char S_RSLT_WARNING[] PROGMEM = D_RSLT_WARNING;
|
||||
|
||||
const char S_LWT[] PROGMEM = D_LWT;
|
||||
const char S_OFFLINE[] PROGMEM = D_OFFLINE;
|
||||
|
||||
// sonoff.ino
|
||||
|
||||
#define MAX_BUTTON_COMMANDS 5 // Max number of button commands supported
|
||||
const char commands[MAX_BUTTON_COMMANDS][14] PROGMEM = {
|
||||
D_CMND_WIFICONFIG " 1", // Press button three times
|
||||
D_CMND_WIFICONFIG " 2", // Press button four times
|
||||
D_CMND_WIFICONFIG " 3", // Press button five times
|
||||
D_CMND_RESTART " 1", // Press button six times
|
||||
D_CMND_UPGRADE " 1" }; // Press button seven times
|
||||
const char wificfg[5][WCFG_MAX_STRING_LENGTH] PROGMEM = {
|
||||
D_WCFG_0_RESTART,
|
||||
D_WCFG_1_SMARTCONFIG,
|
||||
D_WCFG_2_WIFIMANAGER,
|
||||
D_WCFG_3_WPSCONFIG,
|
||||
D_WCFG_4_RETRY };
|
||||
const char PREFIXES[3][PRFX_MAX_STRING_LENGTH] PROGMEM = {
|
||||
D_CMND,
|
||||
D_STAT,
|
||||
D_TELE };
|
||||
|
||||
const char JSON_SNS_TEMPHUM[] PROGMEM =
|
||||
"%s, \"%s\":{\"" D_TEMPERATURE "\":%s, \"" D_HUMIDITY "\":%s}";
|
||||
|
||||
// support.ino
|
||||
|
||||
static const char monthNames[] = D_MONTH3LIST;
|
||||
|
||||
// webserver.ino
|
||||
const char S_MAIN_MENU[] PROGMEM = D_MAIN_MENU;
|
||||
const char S_CONFIGURATION[] PROGMEM = D_CONFIGURATION;
|
||||
const char S_CONFIGURE_MODULE[] PROGMEM = D_CONFIGURE_MODULE;
|
||||
const char S_CONFIGURE_WIFI[] PROGMEM = D_CONFIGURE_WIFI;
|
||||
const char S_NO_NETWORKS_FOUND[] PROGMEM = D_NO_NETWORKS_FOUND;
|
||||
const char S_CONFIGURE_MQTT[] PROGMEM = D_CONFIGURE_MQTT;
|
||||
const char S_CONFIGURE_LOGGING[] PROGMEM = D_CONFIGURE_LOGGING;
|
||||
const char S_CONFIGURE_OTHER[] PROGMEM = D_CONFIGURE_OTHER;
|
||||
const char S_SAVE_CONFIGURATION[] PROGMEM = D_SAVE_CONFIGURATION;
|
||||
const char S_RESET_CONFIGURATION[] PROGMEM = D_RESET_CONFIGURATION;
|
||||
const char S_RESTORE_CONFIGURATION[] PROGMEM = D_RESTORE_CONFIGURATION;
|
||||
const char S_FIRMWARE_UPGRADE[] PROGMEM = D_FIRMWARE_UPGRADE;
|
||||
const char S_CONSOLE[] PROGMEM = D_CONSOLE;
|
||||
const char S_INFORMATION[] PROGMEM = D_INFORMATION;
|
||||
const char S_RESTART[] PROGMEM = D_RESTART;
|
|
@ -0,0 +1,665 @@
|
|||
/*
|
||||
en-GB.h - localization for English - United Kingdom for Sonoff-Tasmota
|
||||
|
||||
Copyright (C) 2017 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/>.
|
||||
*/
|
||||
|
||||
/*************************** ATTENTION *******************************\
|
||||
*
|
||||
* Due to memory constraints only UTF-8 is supported.
|
||||
* 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 "SunMonTueWedThuFriSat"
|
||||
#define D_MONTH3LIST "JanFebMarAprMayJunJulAugSepOctNovDec"
|
||||
|
||||
// Non JSON decimal separator
|
||||
#define D_DECIMAL_SEPARATOR "."
|
||||
|
||||
// Common
|
||||
#define D_ABORTED "Aborted"
|
||||
#define D_ACTIVE "Active"
|
||||
#define D_ADDRESS "Address"
|
||||
#define D_ADMIN "Admin"
|
||||
#define D_AIR_QUALITY "Air quality"
|
||||
#define D_AIRQUALITY "AirQuality"
|
||||
#define D_AP "AP" // Access Point
|
||||
#define D_APMAC_ADDRESS "APMac"
|
||||
#define D_APPENDED "Appended"
|
||||
#define D_AS "as"
|
||||
#define D_AUTO "AUTO"
|
||||
#define D_BAUDRATE "Baudrate"
|
||||
#define D_BLINK "Blink"
|
||||
#define D_BLINKOFF "BlinkOff"
|
||||
#define D_BOOTVERSION "Boot"
|
||||
#define D_BOOT_COUNT "Boot Count"
|
||||
#define D_BOOTCOUNT "BootCount"
|
||||
#define D_BRIGHTLIGHT "Bright"
|
||||
#define D_BUILDDATETIME "BuildDateTime"
|
||||
#define D_BUTTON "Button"
|
||||
#define D_CELSIUS "Celsius"
|
||||
#define D_CODE "code" // Button code
|
||||
#define D_COLDLIGHT "Cold"
|
||||
#define D_COMMAND "Command"
|
||||
#define D_CONNECTED "Connected"
|
||||
#define D_COREVERSION "Core"
|
||||
#define D_COUNT "Count"
|
||||
#define D_COUNTER "Counter"
|
||||
#define D_CURRENT "Current" // As in Voltage and Current
|
||||
#define D_DATA "Data"
|
||||
#define D_DARKLIGHT "Dark"
|
||||
#define D_DEBUG "Debug"
|
||||
#define D_DISABLED "Disabled"
|
||||
#define D_DNS_SERVER "DNS Server"
|
||||
#define D_DNSSERVER "DNSServer"
|
||||
#define D_DONE "Done"
|
||||
#define D_DST_TIME "DST"
|
||||
#define D_EMPTY "Empty"
|
||||
#define D_EMULATION "Emulation"
|
||||
#define D_ENABLED "Enabled"
|
||||
#define D_ENDDST "EndDST" // End Daylight Savings Time
|
||||
#define D_ERASE "Erase"
|
||||
#define D_ERROR "Error"
|
||||
#define D_EVERY "Every"
|
||||
#define D_FAHRENHEIT "Fahrenheit"
|
||||
#define D_FAILED "Failed"
|
||||
#define D_FALLBACK "Fallback"
|
||||
#define D_FALLBACK_TOPIC "Fallback Topic"
|
||||
#define D_FALLBACKTOPIC "FallbackTopic"
|
||||
#define D_FALSE "False"
|
||||
#define D_FILE "File"
|
||||
#define D_FLASHMODE "FlashMode"
|
||||
#define D_FLASHSIZE "FlashSize"
|
||||
#define D_FREE_MEMORY "Free Memory"
|
||||
#define D_FREEMEMORY "Free"
|
||||
#define D_FROM "from"
|
||||
#define D_GATEWAY "Gateway"
|
||||
#define D_GROUP "Group"
|
||||
#define D_HEAPSIZE "Heap"
|
||||
#define D_HIGH "High"
|
||||
#define D_HOST "Host"
|
||||
#define D_HOSTNAME "Hostname"
|
||||
#define D_HUMIDITY "Humidity"
|
||||
#define D_ILLUMINANCE "Illuminance"
|
||||
#define D_IMMEDIATE "immediate" // Button immediate
|
||||
#define D_INDEX "Index"
|
||||
#define D_INFO "Info"
|
||||
#define D_INITIALIZED "Initialized"
|
||||
#define D_IP_ADDRESS "IP Address"
|
||||
#define D_LIGHT "Light"
|
||||
#define D_LOCAL_TIME "Local"
|
||||
#define D_LOW "Low"
|
||||
#define D_LWT "LWT"
|
||||
#define D_MAC "Mac"
|
||||
#define D_MASK "Mask"
|
||||
#define D_MODULE "Module"
|
||||
#define D_MQTT "MQTT"
|
||||
#define D_MULTI_PRESS "multi-press"
|
||||
#define D_NO "No"
|
||||
#define D_NOISE "Noise"
|
||||
#define D_NONE "None"
|
||||
#define D_OFF "Off"
|
||||
#define D_OFFLINE "Offline"
|
||||
#define D_OK "Ok"
|
||||
#define D_ON "On"
|
||||
#define D_ONLINE "Online"
|
||||
#define D_OR "or"
|
||||
#define D_PASSWORD "Password"
|
||||
#define D_PERIOD "Period"
|
||||
#define D_PORT "Port"
|
||||
#define D_POWER_FACTOR "Power Factor"
|
||||
#define D_POWERFACTOR "Factor"
|
||||
#define D_POWERUSAGE "Power"
|
||||
#define D_PRESSURE "Pressure"
|
||||
#define D_PROGRAM_FLASH_SIZE "Program Flash Size"
|
||||
#define D_PROGRAMFLASHSIZE "ProgramFlashSize"
|
||||
#define D_PROGRAM_SIZE "Program Size"
|
||||
#define D_PROGRAMSIZE "ProgramSize"
|
||||
#define D_PROJECT "Project"
|
||||
#define D_RECEIVED "Received"
|
||||
#define D_RESTART "Restart"
|
||||
#define D_RESTARTING "Restarting"
|
||||
#define D_RESTART_REASON "Restart Reason"
|
||||
#define D_RESTARTREASON "RestartReason"
|
||||
#define D_RESTORE "restore"
|
||||
#define D_RETAINED "retained"
|
||||
#define D_SAVE "Save"
|
||||
#define D_SAVEADDRESS "SaveAddress"
|
||||
#define D_SAVECOUNT "SaveCount"
|
||||
#define D_SAVESTATE "SaveState"
|
||||
#define D_SDKVERSION "SDK"
|
||||
#define D_SELECTED "selected"
|
||||
#define D_SENSOR "Sensor"
|
||||
#define D_SERIAL "Serial"
|
||||
#define D_BYTES "Bytes"
|
||||
#define D_SSID "SSId"
|
||||
#define D_START "Start"
|
||||
#define D_STARTED "Started"
|
||||
#define D_STARTDST "StartDST" // Start Daylight Savings Time
|
||||
#define D_STD_TIME "STD"
|
||||
#define D_STOP "Stop"
|
||||
#define D_SUBNET_MASK "Subnet Mask"
|
||||
#define D_SUBNETMASK "Subnetmask"
|
||||
#define D_SUCCESSFUL "Successful"
|
||||
#define D_SWITCH "Switch"
|
||||
#define D_SYNC "Sync"
|
||||
#define D_SYS "Sys" // Sys log
|
||||
#define D_TEMPERATURE "Temperature"
|
||||
#define D_TEMPERATURE_UNIT "TempUnit"
|
||||
#define D_TIME "Time"
|
||||
#define D_TO "to"
|
||||
#define D_TODAY "Today"
|
||||
#define D_TOGGLE "Toggle"
|
||||
#define D_TOPIC "Topic"
|
||||
#define D_TOTAL "Total"
|
||||
#define D_TRUE "True"
|
||||
#define D_TYPE "Type"
|
||||
#define D_UNKNOWN "Unknown"
|
||||
#define D_UPGRADE "upgrade"
|
||||
#define D_UPLOAD "Upload"
|
||||
#define D_UPTIME "Uptime"
|
||||
#define D_UTC_TIME "UTC"
|
||||
#define D_USER "User"
|
||||
#define D_VCC "Vcc"
|
||||
#define D_VERSION "Version"
|
||||
#define D_VOLTAGE "Voltage"
|
||||
#define D_WARMLIGHT "Warm"
|
||||
#define D_WEB "Web" // Web log
|
||||
#define D_WEB_SERVER "Web Server"
|
||||
#define D_WIFI "Wifi"
|
||||
#define D_WRONG "Wrong"
|
||||
#define D_YESTERDAY "Yesterday"
|
||||
|
||||
// settings.ino
|
||||
#define D_SAVED_TO_FLASH_AT "Saved to flash at"
|
||||
#define D_LOADED_FROM_FLASH_AT "Loaded from flash at"
|
||||
#define D_USE_DEFAULTS "Use defaults"
|
||||
#define D_ERASED_SECTOR "Erased sector"
|
||||
|
||||
// sonoff.ino
|
||||
#define D_LEVEL_10 "level 1-0"
|
||||
#define D_LEVEL_01 "level 0-1"
|
||||
#define D_SERIAL_LOGGING_DISABLED "Serial logging disabled"
|
||||
#define D_SYSLOG_LOGGING_REENABLED "Syslog logging re-enabled"
|
||||
|
||||
#define D_SET_BAUDRATE_TO "Set Baudrate to"
|
||||
#define D_RECEIVED_TOPIC "Received Topic"
|
||||
#define D_DATA_SIZE "Data Size"
|
||||
#define D_ANALOG_INPUT0 "Analog0"
|
||||
|
||||
#define D_FINGERPRINT "Verify TLS fingerprint..."
|
||||
#define D_TLS_CONNECT_FAILED_TO "TLS Connect failed to"
|
||||
#define D_RETRY_IN "Retry in"
|
||||
#define D_VERIFIED "Verified"
|
||||
#define D_INSECURE "Insecure connection due to invalid Fingerprint"
|
||||
#define D_CONNECT_FAILED_TO "Connect failed to"
|
||||
|
||||
// support.ino
|
||||
#define D_OSWATCH "osWatch"
|
||||
#define D_BLOCKED_LOOP "Blocked Loop"
|
||||
#define D_WPS_FAILED_WITH_STATUS "WPSconfig FAILED with status"
|
||||
#define D_ACTIVE_FOR_1_MINUTE "active for 1 minute"
|
||||
#define D_FAILED_TO_START "failed to start"
|
||||
#define D_PATCH_ISSUE_2186 "Patch issue 2186"
|
||||
#define D_CONNECTING_TO_AP "Connecting to AP"
|
||||
#define D_IN_MODE "in mode"
|
||||
#define D_CONNECT_FAILED_NO_IP_ADDRESS "Connect failed as no IP address received"
|
||||
#define D_CONNECT_FAILED_AP_NOT_REACHED "Connect failed as AP cannot be reached"
|
||||
#define D_CONNECT_FAILED_WRONG_PASSWORD "Connect failed with AP incorrect password"
|
||||
#define D_CONNECT_FAILED_AP_TIMEOUT "Connect failed with AP timeout"
|
||||
#define D_ATTEMPTING_CONNECTION "Attempting connection..."
|
||||
#define D_CHECKING_CONNECTION "Checking connection..."
|
||||
#define D_QUERY_DONE "Query done. MQTT services found"
|
||||
#define D_MQTT_SERVICE_FOUND "MQTT service found on"
|
||||
#define D_I2CSCAN_DEVICES_FOUND_AT "Device(s) found at"
|
||||
#define D_FOUND_AT "found at"
|
||||
#define D_I2CSCAN_UNKNOWN_ERROR_AT "Unknown error at"
|
||||
#define D_I2CSCAN_NO_DEVICES_FOUND "No devices found"
|
||||
#define D_SYSLOG_HOST_NOT_FOUND "Syslog Host not found"
|
||||
|
||||
// webserver.ino
|
||||
#define D_WEBSERVER_ACTIVE_ON "Web server active on"
|
||||
#define D_WITH_IP_ADDRESS "with IP address"
|
||||
#define D_WEBSERVER_STOPPED "Web server stopped"
|
||||
#define D_FILE_NOT_FOUND "File Not Found"
|
||||
#define D_REDIRECTED "Redirected to captive portal"
|
||||
#define D_WIFIMANAGER_SET_ACCESSPOINT_AND_STATION "Wifimanager set AccessPoint and keep Station"
|
||||
#define D_WIFIMANAGER_SET_ACCESSPOINT "Wifimanager set AccessPoint"
|
||||
#define D_TRYING_TO_CONNECT "Trying to connect device to network"
|
||||
|
||||
#define D_RESTART_IN "Restart in"
|
||||
#define D_SECONDS "seconds"
|
||||
#define D_DEVICE_WILL_RESTART "Device will restart in a few seconds"
|
||||
#define D_BUTTON_TOGGLE "Toggle"
|
||||
#define D_CONFIGURATION "Configuration"
|
||||
#define D_INFORMATION "Information"
|
||||
#define D_FIRMWARE_UPGRADE "Firmware Upgrade"
|
||||
#define D_CONSOLE "Console"
|
||||
#define D_CONFIRM_RESTART "Confirm Restart"
|
||||
|
||||
#define D_CONFIGURE_MODULE "Configure Module"
|
||||
#define D_CONFIGURE_WIFI "Configure WiFi"
|
||||
#define D_CONFIGURE_MQTT "Configure MQTT"
|
||||
#define D_CONFIGURE_DOMOTICZ "Configure Domoticz"
|
||||
#define D_CONFIGURE_LOGGING "Configure Logging"
|
||||
#define D_CONFIGURE_OTHER "Configure Other"
|
||||
#define D_CONFIRM_RESET_CONFIGURATION "Confirm Reset Configuration"
|
||||
#define D_RESET_CONFIGURATION "Reset Configuration"
|
||||
#define D_BACKUP_CONFIGURATION "Backup Configuration"
|
||||
#define D_RESTORE_CONFIGURATION "Restore Configuration"
|
||||
#define D_MAIN_MENU "Main Menu"
|
||||
|
||||
#define D_MODULE_PARAMETERS "Module parameters"
|
||||
#define D_MODULE_TYPE "Module type"
|
||||
#define D_GPIO "GPIO"
|
||||
#define D_SERIAL_IN "Serial In"
|
||||
#define D_SERIAL_OUT "Serial Out"
|
||||
|
||||
#define D_WIFI_PARAMETERS "Wifi parameters"
|
||||
#define D_SCAN_FOR_WIFI_NETWORKS "Scan for wifi networks"
|
||||
#define D_SCAN_DONE "Scan done"
|
||||
#define D_NO_NETWORKS_FOUND "No networks found"
|
||||
#define D_REFRESH_TO_SCAN_AGAIN "Refresh to scan again"
|
||||
#define D_DUPLICATE_ACCESSPOINT "Duplicate AccessPoint"
|
||||
#define D_SKIPPING_LOW_QUALITY "Skipping due to low quality"
|
||||
#define D_RSSI "RSSI"
|
||||
#define D_WEP "WEP"
|
||||
#define D_WPA_PSK "WPA PSK"
|
||||
#define D_WPA2_PSK "WPA2 PSK"
|
||||
#define D_AP1_SSID "AP1 SSId"
|
||||
#define D_AP1_PASSWORD "AP1 Password"
|
||||
#define D_AP2_SSID "AP2 SSId"
|
||||
#define D_AP2_PASSWORD "AP2 Password"
|
||||
|
||||
#define D_MQTT_PARAMETERS "MQTT parameters"
|
||||
#define D_CLIENT "Client"
|
||||
#define D_FULL_TOPIC "Full Topic"
|
||||
|
||||
#define D_LOGGING_PARAMETERS "Logging parameters"
|
||||
#define D_LOG_LEVEL "log level"
|
||||
#define D_MORE_DEBUG "More debug"
|
||||
#define D_SYSLOG_HOST "Syslog host"
|
||||
#define D_SYSLOG_PORT "Syslog port"
|
||||
#define D_TELEMETRY_PERIOD "Telemetry period"
|
||||
|
||||
#define D_OTHER_PARAMETERS "Other parameters"
|
||||
#define D_WEB_ADMIN_PASSWORD "Web Admin Password"
|
||||
#define D_MQTT_ENABLE "MQTT enable"
|
||||
#define D_FRIENDLY_NAME "Friendly Name"
|
||||
#define D_BELKIN_WEMO "Belkin WeMo"
|
||||
#define D_HUE_BRIDGE "Hue Bridge"
|
||||
#define D_SINGLE_DEVICE "single device"
|
||||
#define D_MULTI_DEVICE "multi device"
|
||||
|
||||
#define D_SAVE_CONFIGURATION "Save configuration"
|
||||
#define D_CONFIGURATION_SAVED "Configuration saved"
|
||||
#define D_CONFIGURATION_RESET "Configuration reset"
|
||||
|
||||
#define D_PROGRAM_VERSION "Program Version"
|
||||
#define D_BUILD_DATE_AND_TIME "Build Date & Time"
|
||||
#define D_CORE_AND_SDK_VERSION "Core/SDK Version"
|
||||
#define D_FLASH_WRITE_COUNT "Flash write Count"
|
||||
#define D_MAC_ADDRESS "MAC Address"
|
||||
#define D_MQTT_HOST "MQTT Host"
|
||||
#define D_MQTT_PORT "MQTT Port"
|
||||
#define D_MQTT_CLIENT "MQTT Client"
|
||||
#define D_MQTT_USER "MQTT User"
|
||||
#define D_MQTT_TOPIC "MQTT Topic"
|
||||
#define D_MQTT_GROUP_TOPIC "MQTT Group Topic"
|
||||
#define D_MQTT_FULL_TOPIC "MQTT Full Topic"
|
||||
#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 "Flash Size"
|
||||
#define D_FREE_PROGRAM_SPACE "Free Program Space"
|
||||
|
||||
#define D_UPGRADE_BY_WEBSERVER "Upgrade by web server"
|
||||
#define D_OTA_URL "OTA Url"
|
||||
#define D_START_UPGRADE "Start upgrade"
|
||||
#define D_UPGRADE_BY_FILE_UPLOAD "Upgrade by file upload"
|
||||
#define D_UPLOAD_STARTED "Upload started"
|
||||
#define D_UPGRADE_STARTED "Upgrade started"
|
||||
#define D_UPLOAD_DONE "Upload done"
|
||||
#define D_UPLOAD_ERR_1 "No file selected"
|
||||
#define D_UPLOAD_ERR_2 "Not enough space"
|
||||
#define D_UPLOAD_ERR_3 "Magic byte is not 0xE9"
|
||||
#define D_UPLOAD_ERR_4 "Program flash size is larger than real flash size"
|
||||
#define D_UPLOAD_ERR_5 "Upload buffer miscompare"
|
||||
#define D_UPLOAD_ERR_6 "Upload failed. Enable logging 3"
|
||||
#define D_UPLOAD_ERR_7 "Upload aborted"
|
||||
#define D_UPLOAD_ERR_8 "File invalid"
|
||||
#define D_UPLOAD_ERR_9 "File too large"
|
||||
#define D_UPLOAD_ERROR_CODE "Upload error code"
|
||||
|
||||
#define D_ENTER_COMMAND "Enter command"
|
||||
#define D_ENABLE_WEBLOG_FOR_RESPONSE "Enable weblog 2 if response expected"
|
||||
#define D_NEED_USER_AND_PASSWORD "Need user=<username>&password=<password>"
|
||||
|
||||
// xdrv_domoticz.ino
|
||||
#define D_DOMOTICZ_PARAMETERS "Domoticz parameters"
|
||||
#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 DOMOTICZ_SENSORS_MAX_STRING_LENGTH 14
|
||||
#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 "Power,Energy"
|
||||
#define D_DOMOTICZ_ILLUMINANCE "Illuminance"
|
||||
#define D_DOMOTICZ_COUNT "Count"
|
||||
#define D_DOMOTICZ_UPDATE_TIMER "Update timer"
|
||||
#define D_CONFIGURE_DOMOTICZ "Configure Domoticz"
|
||||
|
||||
// xdrv_ir-send.ino
|
||||
#define D_INVALID_JSON "Invalid JSON"
|
||||
#define D_PROTOCOL_NOT_SUPPORTED "Protocol not supported"
|
||||
#define D_IRSEND_PROTOCOL "PROTOCOL"
|
||||
#define D_IRSEND_BITS "BITS"
|
||||
#define D_IRSEND_DATA "DATA"
|
||||
#define D_IRHVAC_VENDOR "VENDOR"
|
||||
#define D_IRHVAC_POWER "POWER"
|
||||
#define D_IRHVAC_MODE "MODE"
|
||||
#define D_IRHVAC_FANSPEED "FANSPEED"
|
||||
#define D_IRHVAC_TEMP "TEMP"
|
||||
|
||||
// xdrv_snfbridge.ino
|
||||
#define D_RFRECEIVED "RfReceived"
|
||||
#define D_START_LEARNING "Start learning"
|
||||
#define D_SET_TO_DEFAULT "Set to default"
|
||||
#define D_DEFAULT_SENT "Default sent"
|
||||
#define D_LEARNED_SENT "Learned sent"
|
||||
#define D_LEARNING_ACTIVE "Learning active"
|
||||
#define D_LEARN_FAILED "Learn failed"
|
||||
#define D_LEARNED "Learned"
|
||||
|
||||
// xdrv_wemohue.ino
|
||||
#define D_MULTICAST_DISABLED "Multicast disabled"
|
||||
#define D_MULTICAST_REJOINED "Multicast (re)joined"
|
||||
#define D_MULTICAST_JOIN_FAILED "Multicast join failed"
|
||||
#define D_FAILED_TO_SEND_RESPONSE "Failed to send response"
|
||||
|
||||
#define D_WEMO "WeMo"
|
||||
#define D_WEMO_BASIC_EVENT "WeMo basic event"
|
||||
#define D_WEMO_EVENT_SERVICE "WeMo event service"
|
||||
#define D_WEMO_SETUP "WeMo setup"
|
||||
#define D_RESPONSE_SENT "Response sent"
|
||||
|
||||
#define D_HUE "Hue"
|
||||
#define D_HUE_BRIDGE_SETUP "Hue setup"
|
||||
#define D_HUE_API_NOT_IMPLEMENTED "Hue API not implemented"
|
||||
#define D_HUE_API "Hue API"
|
||||
#define D_HUE_POST_ARGS "Hue POST args"
|
||||
#define D_3_RESPONSE_PACKETS_SENT "3 response packets sent"
|
||||
|
||||
// xsns_dht.ino
|
||||
#define D_TIMEOUT_WAITING_FOR "Timeout waiting for"
|
||||
#define D_START_SIGNAL_LOW "start signal low"
|
||||
#define D_START_SIGNAL_HIGH "start signal high"
|
||||
#define D_PULSE "pulse"
|
||||
#define D_CHECKSUM_FAILURE "Checksum failure"
|
||||
|
||||
// xsns_ds18b20.ino
|
||||
#define D_SENSOR_BUSY "Sensor busy"
|
||||
#define D_SENSOR_CRC_ERROR "Sensor CRC error"
|
||||
|
||||
// xsns_hlw8012.ino
|
||||
#define D_MAXPOWERREACHED "MaxPowerReached"
|
||||
#define D_MAXPOWERREACHEDRETRY "MaxPowerReachedRetry"
|
||||
#define D_POWERMONITOR "PowerMonitor"
|
||||
#define D_ENERGYMONITOR "EnergyMonitor"
|
||||
#define D_MAXENERGYREACHED "MaxEnergyReached"
|
||||
#define D_ENERGY_TODAY "Energy Today"
|
||||
#define D_ENERGY_YESTERDAY "Energy Yesterday"
|
||||
#define D_ENERGY_TOTAL "Energy Total"
|
||||
|
||||
// xsns_sht1x.ino
|
||||
#define D_SENSOR_DID_NOT_ACK_COMMAND "Sensor did not ACK command"
|
||||
#define D_SHT1X_FOUND "SHT1X found"
|
||||
|
||||
// sonoff_template.h
|
||||
// Max string length is 8 characters including suffixes
|
||||
#define D_SENSOR_NONE "None"
|
||||
#define D_SENSOR_DHT11 "DHT11"
|
||||
#define D_SENSOR_AM2301 "AM2301"
|
||||
#define D_SENSOR_DHT22 "DHT22"
|
||||
#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_IRREMOTE "IRremote"
|
||||
#define D_SENSOR_SWITCH "Switch" // Suffix "1"
|
||||
#define D_SENSOR_BUTTON "Button" // Suffix "1"
|
||||
#define D_SENSOR_RELAY "Relay" // Suffix "1I"
|
||||
#define D_SENSOR_LED "Led" // Suffix "1I"
|
||||
#define D_SENSOR_PWM "PWM" // Suffix "1"
|
||||
#define D_SENSOR_COUNTER "Counter" // Suffix "1"
|
||||
|
||||
// Units
|
||||
#define D_UNIT_AMPERE "A"
|
||||
#define D_UNIT_HOUR "Hr"
|
||||
#define D_UNIT_KILOWATTHOUR "kWh"
|
||||
#define D_UNIT_MICROSECOND "us"
|
||||
#define D_UNIT_MILLIAMPERE "mA"
|
||||
#define D_UNIT_MILLISECOND "ms"
|
||||
#define D_UNIT_MINUTE "Min"
|
||||
#define D_UNIT_PRESSURE "hPa"
|
||||
#define D_UNIT_SECOND "sec"
|
||||
#define D_UNIT_SECTORS "sectors"
|
||||
#define D_UNIT_VOLT "V"
|
||||
#define D_UNIT_WATT "W"
|
||||
#define D_UNIT_WATTHOUR "Wh"
|
||||
|
||||
// Log message prefix
|
||||
#define D_LOG_APPLICATION "APP: "
|
||||
#define D_LOG_BRIDGE "BRG: "
|
||||
#define D_LOG_CONFIG "CFG: "
|
||||
#define D_LOG_COMMAND "CND: "
|
||||
#define D_LOG_DHT "DHT: "
|
||||
#define D_LOG_DOMOTICZ "DOM: "
|
||||
#define D_LOG_DSB "DSB: "
|
||||
#define D_LOG_HTTP "HTP: "
|
||||
#define D_LOG_I2C "I2C: "
|
||||
#define D_LOG_LOG "LOG: "
|
||||
#define D_LOG_MODULE "MOD: "
|
||||
#define D_LOG_MDNS "DNS: "
|
||||
#define D_LOG_MQTT "MQT: "
|
||||
#define D_LOG_OTHER "OTH: "
|
||||
#define D_LOG_RESULT "RSL: "
|
||||
#define D_LOG_SHT1 "SHT: "
|
||||
#define D_LOG_UPLOAD "UPL: "
|
||||
#define D_LOG_UPNP "UPP: "
|
||||
#define D_LOG_WIFI "WIF: "
|
||||
|
||||
// Result
|
||||
#define D_RSLT_RESULT "RESULT"
|
||||
#define D_RSLT_INFO "INFO"
|
||||
#define D_RSLT_STATE "STATE"
|
||||
#define D_RSLT_SENSOR "SENSOR"
|
||||
#define D_RSLT_UPTIME "UPTIME"
|
||||
#define D_RSLT_MARGINS "MARGINS"
|
||||
#define D_RSLT_WARNING "WARNING"
|
||||
#define D_RSLT_ENERGY "ENERGY"
|
||||
|
||||
// Commands
|
||||
#define D_CMND_MQTTHOST "MqttHost"
|
||||
#define D_CMND_MQTTPORT "MqttPort"
|
||||
#define D_CMND_MQTTRETRY "MqttRetry"
|
||||
#define D_CMND_STATETEXT "StateText"
|
||||
#define D_CMND_MQTTFINGERPRINT "MqttFingerprint"
|
||||
#define D_CMND_MQTTCLIENT "MqttClient"
|
||||
#define D_CMND_MQTTUSER "MqttUser"
|
||||
#define D_CMND_MQTTPASSWORD "MqttPassword"
|
||||
#define D_CMND_FULLTOPIC "FullTopic"
|
||||
#define D_CMND_PREFIX "Prefix"
|
||||
#define PRFX_MAX_STRING_LENGTH 5
|
||||
#define D_CMND "cmnd"
|
||||
#define D_STAT "stat"
|
||||
#define D_TELE "tele"
|
||||
#define D_CMND_GROUPTOPIC "GroupTopic"
|
||||
#define D_CMND_TOPIC "Topic"
|
||||
#define D_CMND_BUTTONTOPIC "ButtonTopic"
|
||||
#define D_CMND_SWITCHTOPIC "SwitchTopic"
|
||||
#define D_CMND_BUTTONRETAIN "ButtonRetain"
|
||||
#define D_CMND_SWITCHRETAIN "SwitchRetain"
|
||||
#define D_CMND_POWERRETAIN "PowerRetain"
|
||||
#define D_CMND_SENSORRETAIN "SensorRetain"
|
||||
#define D_CMND_BACKLOG "Backlog"
|
||||
#define D_CMND_DELAY "Delay"
|
||||
#define D_CMND_STATUS "Status"
|
||||
#define D_STATUS1_PARAMETER "PRM"
|
||||
#define D_STATUS2_FIRMWARE "FWR"
|
||||
#define D_STATUS3_LOGGING "LOG"
|
||||
#define D_STATUS4_MEMORY "MEM"
|
||||
#define D_STATUS5_NETWORK "NET"
|
||||
#define D_STATUS6_MQTT "MQT"
|
||||
#define D_STATUS7_TIME "TIM"
|
||||
#define D_STATUS8_POWER "PWR"
|
||||
#define D_STATUS9_MARGIN "PTH"
|
||||
#define D_STATUS10_SENSOR "SNS"
|
||||
#define D_STATUS11_STATUS "STS"
|
||||
#define D_CMND_POWER "Power"
|
||||
#define D_RSLT_POWER "POWER"
|
||||
#define D_CMND_POWERONSTATE "PowerOnState"
|
||||
#define D_CMND_PULSETIME "PulseTime"
|
||||
#define D_CMND_BLINKTIME "BlinkTime"
|
||||
#define D_CMND_BLINKCOUNT "BlinkCount"
|
||||
#define D_CMND_SAVEDATA "SaveData"
|
||||
#define D_CMND_SETOPTION "SetOption"
|
||||
#define D_CMND_TEMPERATURE_RESOLUTION "TempRes"
|
||||
#define D_CMND_HUMIDITY_RESOLUTION "HumRes"
|
||||
#define D_CMND_PRESSURE_RESOLUTION "PressRes"
|
||||
#define D_CMND_POWER_RESOLUTION "WattRes"
|
||||
#define D_CMND_VOLTAGE_RESOLUTION "VoltRes"
|
||||
#define D_CMND_ENERGY_RESOLUTION "EnergyRes"
|
||||
#define D_CMND_MODULE "Module"
|
||||
#define D_CMND_MODULES "Modules"
|
||||
#define D_CMND_GPIO "GPIO"
|
||||
#define D_NOT_SUPPORTED "Not supported"
|
||||
#define D_CMND_GPIOS "GPIOs"
|
||||
#define D_CMND_PWM "PWM"
|
||||
#define D_CMND_COUNTER "Counter"
|
||||
#define D_CMND_COUNTERTYPE "CounterType"
|
||||
#define D_CMND_COUNTERDEBOUNCE "CounterDebounce"
|
||||
#define D_CMND_SLEEP "Sleep"
|
||||
#define D_CMND_UPLOAD "Upload"
|
||||
#define D_CMND_UPGRADE "Upgrade"
|
||||
#define D_ONE_OR_GT "1 or >%s to upgrade"
|
||||
#define D_CMND_OTAURL "OtaUrl"
|
||||
#define D_CMND_SERIALLOG "SerialLog"
|
||||
#define D_CMND_SYSLOG "SysLog"
|
||||
#define D_CMND_LOGHOST "LogHost"
|
||||
#define D_CMND_LOGPORT "LogPort"
|
||||
#define D_CMND_IPADDRESS "IPAddress"
|
||||
#define D_CMND_NTPSERVER "NtpServer"
|
||||
#define D_CMND_AP "Ap"
|
||||
#define D_CMND_SSID "SSId"
|
||||
#define D_CMND_PASSWORD "Password"
|
||||
#define D_CMND_HOSTNAME "Hostname"
|
||||
#define D_CMND_WIFICONFIG "WifiConfig"
|
||||
#define WCFG_MAX_STRING_LENGTH 12
|
||||
#define D_WCFG_0_RESTART "Restart"
|
||||
#define D_WCFG_1_SMARTCONFIG "SmartConfig"
|
||||
#define D_WCFG_2_WIFIMANAGER "WifiManager"
|
||||
#define D_WCFG_3_WPSCONFIG "WPSConfig"
|
||||
#define D_WCFG_4_RETRY "Retry"
|
||||
#define D_CMND_FRIENDLYNAME "FriendlyName"
|
||||
#define D_CMND_SWITCHMODE "SwitchMode"
|
||||
#define D_CMND_WEBSERVER "Webserver"
|
||||
#define D_WEBSERVER_MODE "WebServerMode"
|
||||
#define D_ACTIVE_FOR "Active for"
|
||||
#define D_ON_DEVICE "on"
|
||||
#define D_CMND_WEBPASSWORD "WebPassword"
|
||||
#define D_CMND_WEBLOG "WebLog"
|
||||
#define D_CMND_EMULATION "Emulation"
|
||||
#define D_CMND_TELEPERIOD "TelePeriod"
|
||||
#define D_CMND_RESTART "Restart"
|
||||
#define D_ONE_TO_RESTART "1 to restart"
|
||||
#define D_CMND_RESET "Reset"
|
||||
#define D_RESET_AND_RESTARTING "Reset and Restarting"
|
||||
#define D_ONE_TO_RESET "1 to reset"
|
||||
#define D_CMND_TIMEZONE "Timezone"
|
||||
#define D_CMND_LEDPOWER "LedPower"
|
||||
#define D_CMND_LEDSTATE "LedState"
|
||||
#define D_CMND_CFGDUMP "CfgDump"
|
||||
#define D_CMND_I2CSCAN "I2CScan"
|
||||
#define D_CMND_EXCEPTION "Exception"
|
||||
|
||||
// Commands xdrv_domoticz.ino
|
||||
#define D_CMND_DOMOTICZ "Domoticz"
|
||||
#define D_CMND_IDX "Idx"
|
||||
#define D_CMND_KEYIDX "KeyIdx"
|
||||
#define D_CMND_SWITCHIDX "SwitchIdx"
|
||||
#define D_CMND_SENSORIDX "SensorIdx"
|
||||
#define D_CMND_UPDATETIMER "UpdateTimer"
|
||||
|
||||
// Commands xdrv_ir_send.ino
|
||||
#define D_CMND_IRSEND "IRSend"
|
||||
#define D_CMND_IRHVAC "IRHVAC"
|
||||
|
||||
// Commands xdrv_snfbridge.ino
|
||||
#define D_CMND_RFKEY "RfKey"
|
||||
#define D_CMND_RFDEFAULT "RfDefault"
|
||||
|
||||
// Commands xdrv_snfled.ino
|
||||
#define D_CMND_COLOR "Color"
|
||||
#define D_CMND_COLORTEMPERATURE "CT"
|
||||
#define D_CMND_DIMMER "Dimmer"
|
||||
#define D_CMND_LEDTABLE "LedTable"
|
||||
#define D_CMND_FADE "Fade"
|
||||
#define D_CMND_SPEED "Speed"
|
||||
#define D_CMND_WAKEUPDURATION "WakeUpDuration"
|
||||
#define D_CMND_WAKEUP "Wakeup"
|
||||
|
||||
// Commands xdrv_ws2812.ino
|
||||
#define D_CMND_PIXELS "Pixels"
|
||||
#define D_CMND_LED "Led"
|
||||
#define D_CMND_WIDTH "Width"
|
||||
#define D_CMND_SCHEME "Scheme"
|
||||
|
||||
// Commands xsns_hlw8012.ino
|
||||
#define D_CMND_POWERLOW "PowerLow"
|
||||
#define D_CMND_POWERHIGH "PowerHigh"
|
||||
#define D_CMND_VOLTAGELOW "VoltageLow"
|
||||
#define D_CMND_VOLTAGEHIGH "VoltageHigh"
|
||||
#define D_CMND_CURRENTLOW "CurrentLow"
|
||||
#define D_CMND_CURRENTHIGH "CurrentHigh"
|
||||
#define D_CMND_ENERGYRESET "EnergyReset"
|
||||
#define D_CMND_HLWPCAL "HlwPcal"
|
||||
#define D_CMND_HLWPSET "HlwPset"
|
||||
#define D_CMND_HLWUCAL "HlwUcal"
|
||||
#define D_CMND_HLWUSET "HlwUset"
|
||||
#define D_CMND_HLWICAL "HlwIcal"
|
||||
#define D_CMND_HLWISET "HlwIset"
|
||||
#define D_CMND_MAXPOWER "MaxPower"
|
||||
#define D_CMND_MAXPOWERHOLD "MaxPowerHold"
|
||||
#define D_CMND_MAXPOWERWINDOW "MaxPowerWindow"
|
||||
#define D_CMND_SAFEPOWER "SafePower"
|
||||
#define D_CMND_SAFEPOWERHOLD "SafePowerHold"
|
||||
#define D_CMND_SAFEPOWERWINDOW "SafePowerWindow"
|
||||
#define D_CMND_MAXENERGY "MaxEnergy"
|
||||
#define D_CMND_MAXENERGYSTART "MaxEnergyStart"
|
|
@ -0,0 +1,666 @@
|
|||
/*
|
||||
i18n_nl-NL.h - localization for Dutch - Nederland for Sonoff-Tasmota
|
||||
|
||||
Copyright (C) 2017 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/>.
|
||||
*/
|
||||
|
||||
/*************************** ATTENTION *******************************\
|
||||
*
|
||||
* Due to memory constraints only UTF-8 is supported.
|
||||
* 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.
|
||||
*
|
||||
\*********************************************************************/
|
||||
|
||||
// Time and Date managed by SDK will not be localized (yet)
|
||||
// "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 "Zo Ma Di Wo Do Vr Za "
|
||||
#define D_MONTH3LIST "JanFebMarAprMeiJunJulAugSepOktNovDec"
|
||||
|
||||
// Non JSON decimal separator
|
||||
#define D_DECIMAL_SEPARATOR ","
|
||||
|
||||
// Common
|
||||
#define D_ABORTED "Afgebroken"
|
||||
#define D_ACTIVE "Actief"
|
||||
#define D_ADDRESS "Adres"
|
||||
#define D_ADMIN "Admin"
|
||||
#define D_AIR_QUALITY "Lucht kwalitiet"
|
||||
#define D_AIRQUALITY "LuchtKwaliteit"
|
||||
#define D_AP "AP" // Access Point
|
||||
#define D_APMAC_ADDRESS "APMac"
|
||||
#define D_APPENDED "Aangevuld"
|
||||
#define D_AS "als"
|
||||
#define D_AUTO "AUTO"
|
||||
#define D_BAUDRATE "Baudrate"
|
||||
#define D_BLINK "Knipper"
|
||||
#define D_BLINKOFF "KnipperUit"
|
||||
#define D_BOOTVERSION "Boot"
|
||||
#define D_BOOT_COUNT "Herstarts"
|
||||
#define D_BOOTCOUNT "Herstarts"
|
||||
#define D_BRIGHTLIGHT "Fel"
|
||||
#define D_BUILDDATETIME "BuildDateTime"
|
||||
#define D_BUTTON "DrukKnop"
|
||||
#define D_CELSIUS "Celsius"
|
||||
#define D_CODE "code" // Button code
|
||||
#define D_COLDLIGHT "Koud"
|
||||
#define D_COMMAND "Opdracht"
|
||||
#define D_CONNECTED "Verbonden"
|
||||
#define D_COREVERSION "Core"
|
||||
#define D_COUNT "Aantal"
|
||||
#define D_COUNTER "Teller"
|
||||
#define D_CURRENT "Stroom" // As in Voltage and Current
|
||||
#define D_DATA "Data"
|
||||
#define D_DARKLIGHT "Donker"
|
||||
#define D_DEBUG "Debug"
|
||||
#define D_DISABLED "Uitgeschakeld"
|
||||
#define D_DNS_SERVER "DNS Server"
|
||||
#define D_DNSSERVER "DNSServer"
|
||||
#define D_DONE "Klaar"
|
||||
#define D_DST_TIME "ZT"
|
||||
#define D_EMPTY "Leeg"
|
||||
#define D_EMULATION "Emulatie"
|
||||
#define D_ENABLED "Geactiveerd"
|
||||
#define D_ENDDST "WinterTijd" // End Daylight Savings Time
|
||||
#define D_ERASE "Wissen"
|
||||
#define D_ERROR "Fout"
|
||||
#define D_EVERY "Iedere"
|
||||
#define D_FAHRENHEIT "Fahrenheit"
|
||||
#define D_FAILED "Mislukt"
|
||||
#define D_FALLBACK "Fallback"
|
||||
#define D_FALLBACK_TOPIC "Fallback Topic"
|
||||
#define D_FALLBACKTOPIC "FallbackTopic"
|
||||
#define D_FALSE "Onwaar"
|
||||
#define D_FILE "Bestand"
|
||||
#define D_FLASHMODE "FlashStand"
|
||||
#define D_FLASHSIZE "FlashGrootte"
|
||||
#define D_FREE_MEMORY "Vrij geheugen"
|
||||
#define D_FREEMEMORY "Vrij"
|
||||
#define D_FROM "van"
|
||||
#define D_GATEWAY "Gateway"
|
||||
#define D_GROUP "Groep"
|
||||
#define D_HEAPSIZE "Heap"
|
||||
#define D_HIGH "Hoog"
|
||||
#define D_HOST "Host"
|
||||
#define D_HOSTNAME "Hostnaam"
|
||||
#define D_HUMIDITY "Luchtvochtigheid"
|
||||
#define D_ILLUMINANCE "Verlichtingssterkte"
|
||||
#define D_IMMEDIATE "onmiddelijk" // Button immediate
|
||||
#define D_INDEX "Index"
|
||||
#define D_INFO "Info"
|
||||
#define D_INITIALIZED "Geinitialiseerd"
|
||||
#define D_IP_ADDRESS "IP Adres"
|
||||
#define D_LIGHT "Ligt"
|
||||
#define D_LOCAL_TIME "Plaatselijk"
|
||||
#define D_LOW "Laag"
|
||||
#define D_LWT "LWT"
|
||||
#define D_MAC "Mac"
|
||||
#define D_MASK "Masker"
|
||||
#define D_MODULE "Module"
|
||||
#define D_MQTT "MQTT"
|
||||
#define D_MULTI_PRESS "meervoudig"
|
||||
#define D_NO "Nee"
|
||||
#define D_NOISE "Lawaai"
|
||||
#define D_NONE "Geen"
|
||||
#define D_OFF "Uit"
|
||||
#define D_OFFLINE "Offline"
|
||||
#define D_OK "Ok"
|
||||
#define D_ON "Ann"
|
||||
#define D_ONLINE "Online"
|
||||
#define D_OR "of"
|
||||
#define D_PASSWORD "Wachtwoord"
|
||||
#define D_PERIOD "Periode"
|
||||
#define D_PORT "Poort"
|
||||
#define D_POWER_FACTOR "Arbeidsfactor"
|
||||
#define D_POWERFACTOR "Factor"
|
||||
#define D_POWERUSAGE "Vermogen"
|
||||
#define D_PRESSURE "Luchtdruk"
|
||||
#define D_PROGRAM_FLASH_SIZE "Programma Flash Grootte"
|
||||
#define D_PROGRAMFLASHSIZE "ProgrammaFlashGrootte"
|
||||
#define D_PROGRAM_SIZE "Programma Grootte"
|
||||
#define D_PROGRAMSIZE "ProgrammaGrootte"
|
||||
#define D_PROJECT "Project"
|
||||
#define D_RECEIVED "Ontvangen"
|
||||
#define D_RESTART "Herstart"
|
||||
#define D_RESTARTING "Herstarten"
|
||||
#define D_RESTART_REASON "Reden herstart"
|
||||
#define D_RESTARTREASON "RedenHerstart"
|
||||
#define D_RESTORE "herstellen"
|
||||
#define D_RETAINED "retained"
|
||||
#define D_SAVE "Opslaan"
|
||||
#define D_SAVEADDRESS "OpslagAdres"
|
||||
#define D_SAVECOUNT "AantalOpslagen"
|
||||
#define D_SAVESTATE "OpslagToestand"
|
||||
#define D_SDKVERSION "SDK"
|
||||
#define D_SELECTED "gekozen"
|
||||
#define D_SENSOR "Sensor"
|
||||
#define D_SERIAL "Serieel"
|
||||
#define D_BYTES "Bytes"
|
||||
#define D_SSID "SSId"
|
||||
#define D_START "Start"
|
||||
#define D_STARTED "Gestart"
|
||||
#define D_STARTDST "Zomertijd" // Start Daylight Savings Time
|
||||
#define D_STD_TIME "WT"
|
||||
#define D_STOP "Stop"
|
||||
#define D_SUBNET_MASK "Subnet Masker"
|
||||
#define D_SUBNETMASK "Subnetmasker"
|
||||
#define D_SUCCESSFUL "Gelukt"
|
||||
#define D_SWITCH "Schakelaar"
|
||||
#define D_SYNC "Sync"
|
||||
#define D_SYS "Sys" // Sys log
|
||||
#define D_TEMPERATURE "Temperatuur"
|
||||
#define D_TEMPERATURE_UNIT "TempEenheid"
|
||||
#define D_TIME "Tijd"
|
||||
#define D_TO "naar"
|
||||
#define D_TODAY "Vandaag"
|
||||
#define D_TOGGLE "Toggle" // Wissel, Tuimel
|
||||
#define D_TOPIC "Topic" // Onderwerp
|
||||
#define D_TOTAL "Totaal"
|
||||
#define D_TRUE "Waar"
|
||||
#define D_TYPE "Soort"
|
||||
#define D_UNKNOWN "Onbekend"
|
||||
#define D_UPGRADE "opwaarderen"
|
||||
#define D_UPLOAD "Verzenden"
|
||||
#define D_UPTIME "Bedrijfstijd"
|
||||
#define D_UTC_TIME "UTC"
|
||||
#define D_USER "Gebruiker"
|
||||
#define D_VCC "Vcc"
|
||||
#define D_VERSION "Versie"
|
||||
#define D_VOLTAGE "Spanning"
|
||||
#define D_WARMLIGHT "Warm"
|
||||
#define D_WEB "Web" // Web log
|
||||
#define D_WEB_SERVER "Webserver"
|
||||
#define D_WIFI "Wifi"
|
||||
#define D_WRONG "Fout"
|
||||
#define D_YESTERDAY "Gisteren"
|
||||
|
||||
// settings.ino
|
||||
#define D_SAVED_TO_FLASH_AT "Opgeslagen in flash op"
|
||||
#define D_LOADED_FROM_FLASH_AT "Geladen vanuit flash op"
|
||||
#define D_USE_DEFAULTS "Gebruik standaardwaarden"
|
||||
#define D_ERASED_SECTOR "Wis sector"
|
||||
|
||||
// sonoff.ino
|
||||
#define D_LEVEL_10 "niveau 1-0"
|
||||
#define D_LEVEL_01 "niveau 0-1"
|
||||
#define D_SERIAL_LOGGING_DISABLED "Serieel logging uitgeschakeld"
|
||||
#define D_SYSLOG_LOGGING_REENABLED "Syslog logging weer ingeschakeld"
|
||||
|
||||
#define D_SET_BAUDRATE_TO "Zet baudrate op"
|
||||
#define D_RECEIVED_TOPIC "Ontvangen topic"
|
||||
#define D_DATA_SIZE "Data lengte"
|
||||
#define D_ANALOG_INPUT0 "Analoog0"
|
||||
|
||||
#define D_FINGERPRINT "Controleer TLS vingerafdruk..."
|
||||
#define D_TLS_CONNECT_FAILED_TO "TLS Verbinding mislukt naar"
|
||||
#define D_RETRY_IN "Opnieuw proberen over"
|
||||
#define D_VERIFIED "Gecontroleerd"
|
||||
#define D_INSECURE "Door ongeldige vingerafdruk een onveilige verbinding"
|
||||
#define D_CONNECT_FAILED_TO "Verbinding mislukt naar"
|
||||
|
||||
// support.ino
|
||||
#define D_OSWATCH "osWatch"
|
||||
#define D_BLOCKED_LOOP "Blocked Loop"
|
||||
#define D_WPS_FAILED_WITH_STATUS "WPSconfig mislukt met status"
|
||||
#define D_ACTIVE_FOR_1_MINUTE "1 minuut actief"
|
||||
#define D_FAILED_TO_START "mislukt"
|
||||
#define D_PATCH_ISSUE_2186 "Patch issue 2186"
|
||||
#define D_CONNECTING_TO_AP "Verbinden met AP"
|
||||
#define D_IN_MODE "in stand"
|
||||
#define D_CONNECT_FAILED_NO_IP_ADDRESS "Verbinding mislukt omdat geen IP adres werd ontvangen"
|
||||
#define D_CONNECT_FAILED_AP_NOT_REACHED "Verbinding mislukt omdat AP onbereikbaar is"
|
||||
#define D_CONNECT_FAILED_WRONG_PASSWORD "Verbinding mislukt door fout wachtwoord"
|
||||
#define D_CONNECT_FAILED_AP_TIMEOUT "Verbinding mislukt door AP time-out"
|
||||
#define D_ATTEMPTING_CONNECTION "Verbinden..."
|
||||
#define D_CHECKING_CONNECTION "Controleer verbinding..."
|
||||
#define D_QUERY_DONE "Aanvraag klaar. Aantal MQTT diensten gevonden"
|
||||
#define D_MQTT_SERVICE_FOUND "MQTT dienst gevonden op"
|
||||
#define D_I2CSCAN_DEVICES_FOUND_AT "Apparaten gevonden op"
|
||||
#define D_FOUND_AT "gevonden op"
|
||||
#define D_I2CSCAN_UNKNOWN_ERROR_AT "Onbekende fout op"
|
||||
#define D_I2CSCAN_NO_DEVICES_FOUND "Geen apparaten gevonden"
|
||||
#define D_SYSLOG_HOST_NOT_FOUND "Syslog Host niet gevonden"
|
||||
|
||||
// webserver.ino
|
||||
#define D_WEBSERVER_ACTIVE_ON "Webserver actief op"
|
||||
#define D_WITH_IP_ADDRESS "met IP adres"
|
||||
#define D_WEBSERVER_STOPPED "Webserver gestopt"
|
||||
#define D_FILE_NOT_FOUND "Bestand niet gevonden"
|
||||
#define D_REDIRECTED "Redirected to captive portal"
|
||||
#define D_WIFIMANAGER_SET_ACCESSPOINT_AND_STATION "Wifimanager start AccessPoint en hou Station"
|
||||
#define D_WIFIMANAGER_SET_ACCESSPOINT "Wifimanager start AccessPoint"
|
||||
#define D_TRYING_TO_CONNECT "Apparaat probeert te verbinden met netwerk"
|
||||
|
||||
#define D_RESTART_IN "Herstart over"
|
||||
#define D_SECONDS "seconden"
|
||||
#define D_DEVICE_WILL_RESTART "Herstart over enkele seconden"
|
||||
#define D_BUTTON_TOGGLE "Toggle" // Wissel, Tuimel
|
||||
#define D_CONFIGURATION "Configuratie"
|
||||
#define D_INFORMATION "Informatie"
|
||||
#define D_FIRMWARE_UPGRADE "Opwaarderen"
|
||||
#define D_CONSOLE "Console"
|
||||
#define D_CONFIRM_RESTART "Bevestig herstart"
|
||||
|
||||
#define D_CONFIGURE_MODULE "Configureer Module"
|
||||
#define D_CONFIGURE_WIFI "Configureer WiFi"
|
||||
#define D_CONFIGURE_MQTT "Configureer MQTT"
|
||||
#define D_CONFIGURE_DOMOTICZ "Configureer Domoticz"
|
||||
#define D_CONFIGURE_LOGGING "Configureer Logging"
|
||||
#define D_CONFIGURE_OTHER "Configureer Overige"
|
||||
#define D_CONFIRM_RESET_CONFIGURATION "Bevestig reset configuratie"
|
||||
#define D_RESET_CONFIGURATION "Reset Configuratie"
|
||||
#define D_BACKUP_CONFIGURATION "Bewaar Configuratie"
|
||||
#define D_RESTORE_CONFIGURATION "Herstel Configuration"
|
||||
#define D_MAIN_MENU "Hoofdmenu"
|
||||
|
||||
#define D_MODULE_PARAMETERS "Module parameters"
|
||||
#define D_MODULE_TYPE "Module soort"
|
||||
#define D_GPIO "GPIO"
|
||||
#define D_SERIAL_IN "Serieel In"
|
||||
#define D_SERIAL_OUT "Serieel Uit"
|
||||
|
||||
#define D_WIFI_PARAMETERS "Wifi parameters"
|
||||
#define D_SCAN_FOR_WIFI_NETWORKS "Zoek wifi netwerken"
|
||||
#define D_SCAN_DONE "Scan klaar"
|
||||
#define D_NO_NETWORKS_FOUND "Geen netwerken gevonden"
|
||||
#define D_REFRESH_TO_SCAN_AGAIN "Vernieuw om opnieuw te zoeken"
|
||||
#define D_DUPLICATE_ACCESSPOINT "Dubbel AccessPoint"
|
||||
#define D_SKIPPING_LOW_QUALITY "Overslaan agv lage ontvangskwaliteit"
|
||||
#define D_RSSI "RSSI"
|
||||
#define D_WEP "WEP"
|
||||
#define D_WPA_PSK "WPA PSK"
|
||||
#define D_WPA2_PSK "WPA2 PSK"
|
||||
#define D_AP1_SSID "AP1 SSId"
|
||||
#define D_AP1_PASSWORD "AP1 Wachtwoord"
|
||||
#define D_AP2_SSID "AP2 SSId"
|
||||
#define D_AP2_PASSWORD "AP2 Wachtwoord"
|
||||
|
||||
#define D_MQTT_PARAMETERS "MQTT parameters"
|
||||
#define D_CLIENT "Client"
|
||||
#define D_FULL_TOPIC "Volledig Topic"
|
||||
|
||||
#define D_LOGGING_PARAMETERS "Logging parameters"
|
||||
#define D_LOG_LEVEL "log niveau"
|
||||
#define D_MORE_DEBUG "Meer debug"
|
||||
#define D_SYSLOG_HOST "Syslog host"
|
||||
#define D_SYSLOG_PORT "Syslog poort"
|
||||
#define D_TELEMETRY_PERIOD "Telemetry periode"
|
||||
|
||||
#define D_OTHER_PARAMETERS "Overige parameters"
|
||||
#define D_WEB_ADMIN_PASSWORD "Web Admin Wachtwoord"
|
||||
#define D_MQTT_ENABLE "MQTT ingeschakeld"
|
||||
#define D_FRIENDLY_NAME "Beschrijvende naam"
|
||||
#define D_BELKIN_WEMO "Belkin WeMo"
|
||||
#define D_HUE_BRIDGE "Hue Bridge"
|
||||
#define D_SINGLE_DEVICE "een apparaat"
|
||||
#define D_MULTI_DEVICE "meer apparaten"
|
||||
|
||||
#define D_SAVE_CONFIGURATION "Bewaar configuratie"
|
||||
#define D_CONFIGURATION_SAVED "Configuratie opgeslagen"
|
||||
#define D_CONFIGURATION_RESET "Configuratie ge-reset"
|
||||
|
||||
#define D_PROGRAM_VERSION "Programma Versie"
|
||||
#define D_BUILD_DATE_AND_TIME "Compileer Datum & Tijd"
|
||||
#define D_CORE_AND_SDK_VERSION "Core/SDK Versie"
|
||||
#define D_FLASH_WRITE_COUNT "Aantal Flash opslagen"
|
||||
#define D_MAC_ADDRESS "MAC Adres"
|
||||
#define D_MQTT_HOST "MQTT Host"
|
||||
#define D_MQTT_PORT "MQTT Poort"
|
||||
#define D_MQTT_CLIENT "MQTT Client"
|
||||
#define D_MQTT_USER "MQTT Gebruiker"
|
||||
#define D_MQTT_TOPIC "MQTT Topic"
|
||||
#define D_MQTT_GROUP_TOPIC "MQTT Groep Topic"
|
||||
#define D_MQTT_FULL_TOPIC "MQTT Volledig Topic"
|
||||
#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 "Flash Grootte"
|
||||
#define D_FREE_PROGRAM_SPACE "Vrij programma ruimte"
|
||||
|
||||
#define D_UPGRADE_BY_WEBSERVER "Opwaarderen dmv webserver"
|
||||
#define D_OTA_URL "OTA Url"
|
||||
#define D_START_UPGRADE "Start opwaarderen"
|
||||
#define D_UPGRADE_BY_FILE_UPLOAD "Opwaarderen dmv verzenden bestand"
|
||||
#define D_UPLOAD_STARTED "Verzending gestart"
|
||||
#define D_UPGRADE_STARTED "Opwaarderen gestart"
|
||||
#define D_UPLOAD_DONE "Opwaarderen klaar"
|
||||
#define D_UPLOAD_ERR_1 "Geen bestand gekozen"
|
||||
#define D_UPLOAD_ERR_2 "Onvoldoende geheugen ruimte"
|
||||
#define D_UPLOAD_ERR_3 "Magische byte is niet 0xE9"
|
||||
#define D_UPLOAD_ERR_4 "Programma flash grootte is groter dan werkelijke flash grootte"
|
||||
#define D_UPLOAD_ERR_5 "Opwaardeer buffer verschil"
|
||||
#define D_UPLOAD_ERR_6 "Opwaarderen mislukt. Schakel logging 3 in"
|
||||
#define D_UPLOAD_ERR_7 "Opwaarderen afgebroken"
|
||||
#define D_UPLOAD_ERR_8 "Ongeldig bestand"
|
||||
#define D_UPLOAD_ERR_9 "Bestand is te groot"
|
||||
#define D_UPLOAD_ERROR_CODE "Opwaardeer foutcode"
|
||||
|
||||
#define D_ENTER_COMMAND "Geef opdracht"
|
||||
#define D_ENABLE_WEBLOG_FOR_RESPONSE "Schakel weblog 2 in indien antwoord verwacht"
|
||||
#define D_NEED_USER_AND_PASSWORD "Benodig user=<gebruiker>&password=<webwachtwoord>"
|
||||
|
||||
// xdrv_domoticz.ino
|
||||
#define D_DOMOTICZ_PARAMETERS "Domoticz parameters"
|
||||
#define D_DOMOTICZ_IDX "Idx"
|
||||
#define D_DOMOTICZ_KEY_IDX "Toets idx"
|
||||
#define D_DOMOTICZ_SWITCH_IDX "Schakelaar idx"
|
||||
#define D_DOMOTICZ_SENSOR_IDX "Sensor idx"
|
||||
#define DOMOTICZ_SENSORS_MAX_STRING_LENGTH 14
|
||||
#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 "Power,Energy"
|
||||
#define D_DOMOTICZ_ILLUMINANCE "Illuminance"
|
||||
#define D_DOMOTICZ_COUNT "Count"
|
||||
#define D_DOMOTICZ_UPDATE_TIMER "Bijwerk timer"
|
||||
#define D_CONFIGURE_DOMOTICZ "Configureer Domoticz"
|
||||
|
||||
// xdrv_ir-send.ino
|
||||
#define D_INVALID_JSON "Ongeldig JSON"
|
||||
#define D_PROTOCOL_NOT_SUPPORTED "Protocol wordt niet ondersteund"
|
||||
#define D_IRSEND_PROTOCOL "PROTOCOL"
|
||||
#define D_IRSEND_BITS "BITS"
|
||||
#define D_IRSEND_DATA "DATA"
|
||||
#define D_IRHVAC_VENDOR "VENDOR"
|
||||
#define D_IRHVAC_POWER "POWER"
|
||||
#define D_IRHVAC_MODE "MODE"
|
||||
#define D_IRHVAC_FANSPEED "FANSPEED"
|
||||
#define D_IRHVAC_TEMP "TEMP"
|
||||
|
||||
// xdrv_snfbridge.ino
|
||||
#define D_RFRECEIVED "RfReceived"
|
||||
#define D_START_LEARNING "Start leren"
|
||||
#define D_SET_TO_DEFAULT "Zet standaard waarden"
|
||||
#define D_DEFAULT_SENT "Standaard verzonden"
|
||||
#define D_LEARNED_SENT "Geleerde verzonden"
|
||||
#define D_LEARNING_ACTIVE "Leren actief"
|
||||
#define D_LEARN_FAILED "Leren mislukt"
|
||||
#define D_LEARNED "Geleerd"
|
||||
|
||||
// xdrv_wemohue.ino
|
||||
#define D_MULTICAST_DISABLED "Multicast uitgeschakeld"
|
||||
#define D_MULTICAST_REJOINED "Multicast verbonden"
|
||||
#define D_MULTICAST_JOIN_FAILED "Multicast verbinding mislukt"
|
||||
#define D_FAILED_TO_SEND_RESPONSE "Antwoord versturen mislukt"
|
||||
|
||||
#define D_WEMO "WeMo"
|
||||
#define D_WEMO_BASIC_EVENT "WeMo basis gebeurtenis"
|
||||
#define D_WEMO_EVENT_SERVICE "WeMo gebeurtenis dienst"
|
||||
#define D_WEMO_SETUP "WeMo installatie"
|
||||
#define D_RESPONSE_SENT "Antwoord verstuurd"
|
||||
|
||||
#define D_HUE "Hue"
|
||||
#define D_HUE_BRIDGE_SETUP "Hue installatie"
|
||||
#define D_HUE_API_NOT_IMPLEMENTED "Hue API niet beschikbaar"
|
||||
#define D_HUE_API "Hue API"
|
||||
#define D_HUE_POST_ARGS "Hue POST argumenten"
|
||||
#define D_3_RESPONSE_PACKETS_SENT "3 antwoord paketten verstuurd"
|
||||
|
||||
// xsns_dht.ino
|
||||
#define D_TIMEOUT_WAITING_FOR "Te lang wachten op"
|
||||
#define D_START_SIGNAL_LOW "laag start signaal"
|
||||
#define D_START_SIGNAL_HIGH "hoog start signaal"
|
||||
#define D_PULSE "signaal"
|
||||
#define D_CHECKSUM_FAILURE "Controle mislukt"
|
||||
|
||||
// xsns_ds18b20.ino
|
||||
#define D_SENSOR_BUSY "Sensor bezet"
|
||||
#define D_SENSOR_CRC_ERROR "Sensor CRC fout"
|
||||
|
||||
// xsns_hlw8012.ino
|
||||
#define D_MAXPOWERREACHED "MaxPowerReached"
|
||||
#define D_MAXPOWERREACHEDRETRY "MaxPowerReachedRetry"
|
||||
#define D_POWERMONITOR "PowerMonitor"
|
||||
#define D_ENERGYMONITOR "EnergyMonitor"
|
||||
#define D_MAXENERGYREACHED "MaxEnergyReached"
|
||||
#define D_ENERGY_TODAY "Verbruik vandaag"
|
||||
#define D_ENERGY_YESTERDAY "Verbruik gisteren"
|
||||
#define D_ENERGY_TOTAL "Verbruik totaal"
|
||||
|
||||
// xsns_sht1x.ino
|
||||
#define D_SENSOR_DID_NOT_ACK_COMMAND "Geen opdracht ACK van sensor"
|
||||
#define D_SHT1X_FOUND "SHT1X gevonden"
|
||||
|
||||
// sonoff_template.h
|
||||
// Max string length is 8 characters including suffixes
|
||||
#define D_SENSOR_NONE "Geen"
|
||||
#define D_SENSOR_DHT11 "DHT11"
|
||||
#define D_SENSOR_AM2301 "AM2301"
|
||||
#define D_SENSOR_DHT22 "DHT22"
|
||||
#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_IRREMOTE "IRremote"
|
||||
#define D_SENSOR_SWITCH "Switch" // Suffix "1"
|
||||
#define D_SENSOR_BUTTON "Button" // Suffix "1"
|
||||
#define D_SENSOR_RELAY "Relais" // Suffix "1I"
|
||||
#define D_SENSOR_LED "Led" // Suffix "1I"
|
||||
#define D_SENSOR_PWM "PWM" // Suffix "1"
|
||||
#define D_SENSOR_COUNTER "Teller" // Suffix "1"
|
||||
|
||||
// Units
|
||||
#define D_UNIT_AMPERE "A"
|
||||
#define D_UNIT_HOUR "Hr"
|
||||
#define D_UNIT_KILOWATTHOUR "kWh"
|
||||
#define D_UNIT_MICROSECOND "us"
|
||||
#define D_UNIT_MILLIAMPERE "mA"
|
||||
#define D_UNIT_MILLISECOND "ms"
|
||||
#define D_UNIT_MINUTE "Min"
|
||||
#define D_UNIT_PRESSURE "hPa"
|
||||
#define D_UNIT_SECOND "sec"
|
||||
#define D_UNIT_SECTORS "sectoren"
|
||||
#define D_UNIT_VOLT "V"
|
||||
#define D_UNIT_WATT "W"
|
||||
#define D_UNIT_WATTHOUR "Wh"
|
||||
|
||||
// Log message prefix
|
||||
#define D_LOG_APPLICATION "APP: "
|
||||
#define D_LOG_BRIDGE "BRG: "
|
||||
#define D_LOG_CONFIG "CFG: "
|
||||
#define D_LOG_COMMAND "CND: "
|
||||
#define D_LOG_DHT "DHT: "
|
||||
#define D_LOG_DOMOTICZ "DOM: "
|
||||
#define D_LOG_DSB "DSB: "
|
||||
#define D_LOG_HTTP "HTP: "
|
||||
#define D_LOG_I2C "I2C: "
|
||||
#define D_LOG_LOG "LOG: "
|
||||
#define D_LOG_MODULE "MOD: "
|
||||
#define D_LOG_MDNS "DNS: "
|
||||
#define D_LOG_MQTT "MQT: "
|
||||
#define D_LOG_OTHER "OTH: "
|
||||
#define D_LOG_RESULT "RSL: "
|
||||
#define D_LOG_SHT1 "SHT: "
|
||||
#define D_LOG_UPLOAD "UPL: "
|
||||
#define D_LOG_UPNP "UPP: "
|
||||
#define D_LOG_WIFI "WIF: "
|
||||
|
||||
// Result
|
||||
#define D_RSLT_RESULT "RESULTAAT"
|
||||
#define D_RSLT_INFO "INFO"
|
||||
#define D_RSLT_STATE "TOESTAND"
|
||||
#define D_RSLT_SENSOR "SENSOR"
|
||||
#define D_RSLT_UPTIME "BEDRIJFSTIJD"
|
||||
#define D_RSLT_MARGINS "GRENSWAARDEN"
|
||||
#define D_RSLT_WARNING "WAARSCHUWING"
|
||||
#define D_RSLT_ENERGY "ENERGIE"
|
||||
|
||||
// Commands
|
||||
#define D_CMND_MQTTHOST "MqttHost"
|
||||
#define D_CMND_MQTTPORT "MqttPort"
|
||||
#define D_CMND_MQTTRETRY "MqttRetry"
|
||||
#define D_CMND_STATETEXT "StateText"
|
||||
#define D_CMND_MQTTFINGERPRINT "MqttFingerprint"
|
||||
#define D_CMND_MQTTCLIENT "MqttClient"
|
||||
#define D_CMND_MQTTUSER "MqttUser"
|
||||
#define D_CMND_MQTTPASSWORD "MqttPassword"
|
||||
#define D_CMND_FULLTOPIC "FullTopic"
|
||||
#define D_CMND_PREFIX "Prefix"
|
||||
#define PRFX_MAX_STRING_LENGTH 5
|
||||
#define D_CMND "cmnd"
|
||||
#define D_STAT "stat"
|
||||
#define D_TELE "tele"
|
||||
#define D_CMND_GROUPTOPIC "GroupTopic"
|
||||
#define D_CMND_TOPIC "Topic"
|
||||
#define D_CMND_BUTTONTOPIC "ButtonTopic"
|
||||
#define D_CMND_SWITCHTOPIC "SwitchTopic"
|
||||
#define D_CMND_BUTTONRETAIN "ButtonRetain"
|
||||
#define D_CMND_SWITCHRETAIN "SwitchRetain"
|
||||
#define D_CMND_POWERRETAIN "PowerRetain"
|
||||
#define D_CMND_SENSORRETAIN "SensorRetain"
|
||||
#define D_CMND_BACKLOG "Backlog"
|
||||
#define D_CMND_DELAY "Delay"
|
||||
#define D_CMND_STATUS "Status"
|
||||
#define D_STATUS1_PARAMETER "PRM"
|
||||
#define D_STATUS2_FIRMWARE "FWR"
|
||||
#define D_STATUS3_LOGGING "LOG"
|
||||
#define D_STATUS4_MEMORY "MEM"
|
||||
#define D_STATUS5_NETWORK "NET"
|
||||
#define D_STATUS6_MQTT "MQT"
|
||||
#define D_STATUS7_TIME "TIM"
|
||||
#define D_STATUS8_POWER "PWR"
|
||||
#define D_STATUS9_MARGIN "PTH"
|
||||
#define D_STATUS10_SENSOR "SNS"
|
||||
#define D_STATUS11_STATUS "STS"
|
||||
#define D_CMND_POWER "Power"
|
||||
#define D_RSLT_POWER "POWER"
|
||||
#define D_CMND_POWERONSTATE "PowerOnState"
|
||||
#define D_CMND_PULSETIME "PulseTime"
|
||||
#define D_CMND_BLINKTIME "BlinkTime"
|
||||
#define D_CMND_BLINKCOUNT "BlinkCount"
|
||||
#define D_CMND_SAVEDATA "SaveData"
|
||||
#define D_CMND_SETOPTION "SetOption"
|
||||
#define D_CMND_TEMPERATURE_RESOLUTION "TempRes"
|
||||
#define D_CMND_HUMIDITY_RESOLUTION "HumRes"
|
||||
#define D_CMND_PRESSURE_RESOLUTION "PressRes"
|
||||
#define D_CMND_POWER_RESOLUTION "WattRes"
|
||||
#define D_CMND_VOLTAGE_RESOLUTION "VoltRes"
|
||||
#define D_CMND_ENERGY_RESOLUTION "EnergyRes"
|
||||
#define D_CMND_MODULE "Module"
|
||||
#define D_CMND_MODULES "Modules"
|
||||
#define D_CMND_GPIO "GPIO"
|
||||
#define D_NOT_SUPPORTED "Not supported"
|
||||
#define D_CMND_GPIOS "GPIOs"
|
||||
#define D_CMND_PWM "PWM"
|
||||
#define D_CMND_COUNTER "Counter"
|
||||
#define D_CMND_COUNTERTYPE "CounterType"
|
||||
#define D_CMND_COUNTERDEBOUNCE "CounterDebounce"
|
||||
#define D_CMND_SLEEP "Sleep"
|
||||
#define D_CMND_UPLOAD "Upload"
|
||||
#define D_CMND_UPGRADE "Upgrade"
|
||||
#define D_ONE_OR_GT "1 or >%s to upgrade"
|
||||
#define D_CMND_OTAURL "OtaUrl"
|
||||
#define D_CMND_SERIALLOG "SerialLog"
|
||||
#define D_CMND_SYSLOG "SysLog"
|
||||
#define D_CMND_LOGHOST "LogHost"
|
||||
#define D_CMND_LOGPORT "LogPort"
|
||||
#define D_CMND_IPADDRESS "IPAddress"
|
||||
#define D_CMND_NTPSERVER "NtpServer"
|
||||
#define D_CMND_AP "Ap"
|
||||
#define D_CMND_SSID "SSId"
|
||||
#define D_CMND_PASSWORD "Password"
|
||||
#define D_CMND_HOSTNAME "Hostname"
|
||||
#define D_CMND_WIFICONFIG "WifiConfig"
|
||||
#define WCFG_MAX_STRING_LENGTH 12
|
||||
#define D_WCFG_0_RESTART "Restart"
|
||||
#define D_WCFG_1_SMARTCONFIG "SmartConfig"
|
||||
#define D_WCFG_2_WIFIMANAGER "WifiManager"
|
||||
#define D_WCFG_3_WPSCONFIG "WPSConfig"
|
||||
#define D_WCFG_4_RETRY "Opnieuw"
|
||||
#define D_CMND_FRIENDLYNAME "FriendlyName"
|
||||
#define D_CMND_SWITCHMODE "SwitchMode"
|
||||
#define D_CMND_WEBSERVER "Webserver"
|
||||
#define D_WEBSERVER_MODE "WebServerSoort"
|
||||
#define D_ACTIVE_FOR "Aktief als"
|
||||
#define D_ON_DEVICE "op"
|
||||
#define D_CMND_WEBPASSWORD "WebPassword"
|
||||
#define D_CMND_WEBLOG "WebLog"
|
||||
#define D_CMND_EMULATION "Emulation"
|
||||
#define D_CMND_TELEPERIOD "TelePeriod"
|
||||
#define D_CMND_RESTART "Restart"
|
||||
#define D_ONE_TO_RESTART "1 voor herstart"
|
||||
#define D_CMND_RESET "Reset"
|
||||
#define D_RESET_AND_RESTARTING "Reset en herstarten"
|
||||
#define D_ONE_TO_RESET "1 voor reset"
|
||||
#define D_CMND_TIMEZONE "Timezone"
|
||||
#define D_CMND_LEDPOWER "LedPower"
|
||||
#define D_CMND_LEDSTATE "LedState"
|
||||
#define D_CMND_CFGDUMP "CfgDump"
|
||||
#define D_CMND_I2CSCAN "I2CScan"
|
||||
#define D_CMND_EXCEPTION "Exception"
|
||||
|
||||
// Commands xdrv_domoticz.ino
|
||||
#define D_CMND_DOMOTICZ "Domoticz"
|
||||
#define D_CMND_IDX "Idx"
|
||||
#define D_CMND_KEYIDX "KeyIdx"
|
||||
#define D_CMND_SWITCHIDX "SwitchIdx"
|
||||
#define D_CMND_SENSORIDX "SensorIdx"
|
||||
#define D_CMND_UPDATETIMER "UpdateTimer"
|
||||
|
||||
// Commands xdrv_ir_send.ino
|
||||
#define D_CMND_IRSEND "IRSend"
|
||||
#define D_CMND_IRHVAC "IRHVAC"
|
||||
|
||||
// Commands xdrv_snfbridge.ino
|
||||
#define D_CMND_RFKEY "RfKey"
|
||||
#define D_CMND_RFDEFAULT "RfDefault"
|
||||
|
||||
// Commands xdrv_snfled.ino
|
||||
#define D_CMND_COLOR "Color"
|
||||
#define D_CMND_COLORTEMPERATURE "CT"
|
||||
#define D_CMND_DIMMER "Dimmer"
|
||||
#define D_CMND_LEDTABLE "LedTable"
|
||||
#define D_CMND_FADE "Fade"
|
||||
#define D_CMND_SPEED "Speed"
|
||||
#define D_CMND_WAKEUPDURATION "WakeUpDuration"
|
||||
#define D_CMND_WAKEUP "Wakeup"
|
||||
|
||||
// Commands xdrv_ws2812.ino
|
||||
#define D_CMND_PIXELS "Pixels"
|
||||
#define D_CMND_LED "Led"
|
||||
#define D_CMND_WIDTH "Width"
|
||||
#define D_CMND_SCHEME "Scheme"
|
||||
|
||||
// Commands xsns_hlw8012.ino
|
||||
#define D_CMND_POWERLOW "PowerLow"
|
||||
#define D_CMND_POWERHIGH "PowerHigh"
|
||||
#define D_CMND_VOLTAGELOW "VoltageLow"
|
||||
#define D_CMND_VOLTAGEHIGH "VoltageHigh"
|
||||
#define D_CMND_CURRENTLOW "CurrentLow"
|
||||
#define D_CMND_CURRENTHIGH "CurrentHigh"
|
||||
#define D_CMND_ENERGYRESET "EnergyReset"
|
||||
#define D_CMND_HLWPCAL "HlwPcal"
|
||||
#define D_CMND_HLWPSET "HlwPset"
|
||||
#define D_CMND_HLWUCAL "HlwUcal"
|
||||
#define D_CMND_HLWUSET "HlwUset"
|
||||
#define D_CMND_HLWICAL "HlwIcal"
|
||||
#define D_CMND_HLWISET "HlwIset"
|
||||
#define D_CMND_MAXPOWER "MaxPower"
|
||||
#define D_CMND_MAXPOWERHOLD "MaxPowerHold"
|
||||
#define D_CMND_MAXPOWERWINDOW "MaxPowerWindow"
|
||||
#define D_CMND_SAFEPOWER "SafePower"
|
||||
#define D_CMND_SAFEPOWERHOLD "SafePowerHold"
|
||||
#define D_CMND_SAFEPOWERWINDOW "SafePowerWindow"
|
||||
#define D_CMND_MAXENERGY "MaxEnergy"
|
||||
#define D_CMND_MAXENERGYSTART "MaxEnergyStart"
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
#define PARAM8_SIZE 23 // Number of param bytes
|
||||
|
||||
typedef union { // Restricted by MISRA-C Rule 18.4 but so usefull...
|
||||
typedef union { // Restricted by MISRA-C Rule 18.4 but so usefull...
|
||||
uint32_t data; // Allow bit manipulation using SetOption
|
||||
struct {
|
||||
uint32_t savestate : 1; // bit 0
|
||||
|
@ -58,7 +58,7 @@ struct SYSCFG {
|
|||
unsigned long bootcount;
|
||||
sysBitfield flag; // Add flag since 5.0.2
|
||||
int16_t savedata;
|
||||
|
||||
|
||||
int8_t timezone;
|
||||
char otaUrl[101];
|
||||
|
||||
|
@ -98,7 +98,7 @@ struct SYSCFG {
|
|||
|
||||
uint8_t param[PARAM8_SIZE]; // was domoticz_in_topic until 5.1.6
|
||||
char state_text[4][11]; // was domoticz_out_topic until 5.1.6
|
||||
|
||||
|
||||
uint16_t domoticz_update_timer;
|
||||
unsigned long domoticz_relay_idx[4];
|
||||
unsigned long domoticz_key_idx[4];
|
||||
|
@ -115,14 +115,14 @@ struct SYSCFG {
|
|||
uint16_t hlw_umax;
|
||||
uint16_t hlw_imin;
|
||||
uint16_t hlw_imax;
|
||||
uint16_t hlw_mpl; // MaxPowerLimit
|
||||
uint16_t hlw_mplh; // MaxPowerLimitHold
|
||||
uint16_t hlw_mplw; // MaxPowerLimitWindow
|
||||
uint16_t hlw_mspl; // MaxSafePowerLimit
|
||||
uint16_t hlw_msplh; // MaxSafePowerLimitHold
|
||||
uint16_t hlw_msplw; // MaxSafePowerLimitWindow
|
||||
uint16_t hlw_mkwh; // MaxEnergy
|
||||
uint16_t hlw_mkwhs; // MaxEnergyStart
|
||||
uint16_t hlw_mpl; // MaxPowerLimit
|
||||
uint16_t hlw_mplh; // MaxPowerLimitHold
|
||||
uint16_t hlw_mplw; // MaxPowerLimitWindow
|
||||
uint16_t hlw_mspl; // MaxSafePowerLimit
|
||||
uint16_t hlw_msplh; // MaxSafePowerLimitHold
|
||||
uint16_t hlw_msplw; // MaxSafePowerLimitWindow
|
||||
uint16_t hlw_mkwh; // MaxEnergy
|
||||
uint16_t hlw_mkwhs; // MaxEnergyStart
|
||||
|
||||
// 3.0.6
|
||||
uint16_t mqtt_retry; // was ex_pulsetime until 4.0.4
|
||||
|
@ -217,8 +217,7 @@ struct RTCMEM {
|
|||
unsigned long pCounter[MAX_COUNTERS];
|
||||
} rtcMem;
|
||||
|
||||
// See issue https://github.com/esp8266/Arduino/issues/2913
|
||||
// See issue https://github.com/esp8266/Arduino/issues/2913
|
||||
#ifdef USE_ADC_VCC
|
||||
ADC_MODE(ADC_VCC); // Set ADC input for Power Supply Voltage usage
|
||||
ADC_MODE(ADC_VCC); // Set ADC input for Power Supply Voltage usage
|
||||
#endif
|
||||
|
||||
|
|
|
@ -81,7 +81,7 @@ boolean RTC_Valid()
|
|||
void RTC_Dump()
|
||||
{
|
||||
#define CFG_COLS 16
|
||||
|
||||
|
||||
char log[LOGSZ];
|
||||
uint16_t idx;
|
||||
uint16_t maxrow;
|
||||
|
@ -186,7 +186,7 @@ uint32_t CFG_Address()
|
|||
void CFG_Save(byte rotate)
|
||||
{
|
||||
/* Save configuration in eeprom or one of 7 slots below
|
||||
*
|
||||
*
|
||||
* rotate 0 = Save in next flash slot
|
||||
* rotate 1 = Save only in eeprom flash slot until SetOption12 0 or restart
|
||||
* rotate 2 = Save in eeprom flash slot, erase next flash slots and continue depending on stop_flash_rotate
|
||||
|
@ -224,7 +224,8 @@ void CFG_Save(byte rotate)
|
|||
delay(1);
|
||||
}
|
||||
}
|
||||
snprintf_P(log, sizeof(log), PSTR("Cnfg: Save (%d bytes) to flash at %X and count %d"), sizeof(SYSCFG), _cfgLocation, sysCfg.saveFlag);
|
||||
snprintf_P(log, sizeof(log), PSTR(D_LOG_CONFIG D_SAVED_TO_FLASH_AT " %X, " D_COUNT " %d, " D_BYTES " %d"),
|
||||
_cfgLocation, sysCfg.saveFlag, sizeof(SYSCFG));
|
||||
addLog(LOG_LEVEL_DEBUG, log);
|
||||
_cfgHash = getHash();
|
||||
}
|
||||
|
@ -259,7 +260,8 @@ void CFG_Load()
|
|||
}
|
||||
delay(1);
|
||||
}
|
||||
snprintf_P(log, sizeof(log), PSTR("Cnfg: Load from flash at %X and count %d"), _cfgLocation, sysCfg.saveFlag);
|
||||
snprintf_P(log, sizeof(log), PSTR(D_LOG_CONFIG D_LOADED_FROM_FLASH_AT " %X, " D_COUNT " %d"),
|
||||
_cfgLocation, sysCfg.saveFlag);
|
||||
addLog(LOG_LEVEL_DEBUG, log);
|
||||
if (sysCfg.cfg_holder != CFG_HOLDER) {
|
||||
// Auto upgrade
|
||||
|
@ -273,7 +275,7 @@ void CFG_Load()
|
|||
CFG_Default();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
_cfgHash = getHash();
|
||||
|
||||
RTC_Load();
|
||||
|
@ -288,7 +290,7 @@ void CFG_Erase()
|
|||
uint32_t _sectorEnd = ESP.getFlashChipRealSize() / SPI_FLASH_SEC_SIZE;
|
||||
boolean _serialoutput = (LOG_LEVEL_DEBUG_MORE <= seriallog_level);
|
||||
|
||||
snprintf_P(log, sizeof(log), PSTR("Cnfg: Erase %d flash sectors"), _sectorEnd - _sectorStart);
|
||||
snprintf_P(log, sizeof(log), PSTR(D_LOG_APPLICATION D_ERASE " %d " D_UNIT_SECTORS), _sectorEnd - _sectorStart);
|
||||
addLog(LOG_LEVEL_DEBUG, log);
|
||||
|
||||
for (uint32_t _sector = _sectorStart; _sector < _sectorEnd; _sector++) {
|
||||
|
@ -296,12 +298,12 @@ void CFG_Erase()
|
|||
result = spi_flash_erase_sector(_sector);
|
||||
interrupts();
|
||||
if (_serialoutput) {
|
||||
Serial.print(F("Flash: Erased sector "));
|
||||
Serial.print(F(D_LOG_APPLICATION D_ERASED_SECTOR " "));
|
||||
Serial.print(_sector);
|
||||
if (SPI_FLASH_RESULT_OK == result) {
|
||||
Serial.println(F(" OK"));
|
||||
Serial.println(F(" " D_OK));
|
||||
} else {
|
||||
Serial.println(F(" Error"));
|
||||
Serial.println(F(" " D_ERROR));
|
||||
}
|
||||
delay(10);
|
||||
}
|
||||
|
@ -311,7 +313,7 @@ void CFG_Erase()
|
|||
void CFG_Dump(char* parms)
|
||||
{
|
||||
#define CFG_COLS 16
|
||||
|
||||
|
||||
char log[LOGSZ];
|
||||
uint16_t idx;
|
||||
uint16_t maxrow;
|
||||
|
@ -364,7 +366,7 @@ void CFG_Dump(char* parms)
|
|||
|
||||
void CFG_Default()
|
||||
{
|
||||
addLog_P(LOG_LEVEL_NONE, PSTR("Cnfg: Use defaults"));
|
||||
addLog_P(LOG_LEVEL_NONE, PSTR(D_LOG_CONFIG D_USE_DEFAULTS));
|
||||
CFG_DefaultSet1();
|
||||
CFG_DefaultSet2();
|
||||
CFG_Save(2);
|
||||
|
@ -379,11 +381,11 @@ void CFG_DefaultSet1()
|
|||
sysCfg.version = VERSION;
|
||||
// sysCfg.bootcount = 0;
|
||||
}
|
||||
|
||||
|
||||
void CFG_DefaultSet2()
|
||||
{
|
||||
memset((char*)&sysCfg +16, 0x00, sizeof(SYSCFG) -16);
|
||||
|
||||
|
||||
sysCfg.flag.savestate = SAVE_STATE;
|
||||
sysCfg.savedata = SAVE_DATA;
|
||||
sysCfg.timezone = APP_TIMEZONE;
|
||||
|
@ -504,7 +506,7 @@ void CFG_DefaultSet2()
|
|||
|
||||
// 5.4.1
|
||||
memcpy_P(sysCfg.sfb_code[0], sfb_codeDefault, 9);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/********************************************************************************************/
|
||||
|
@ -619,7 +621,7 @@ void CFG_Delta()
|
|||
strlcpy(sysCfg.friendlyname[1], FRIENDLY_NAME"2", sizeof(sysCfg.friendlyname[1]));
|
||||
strlcpy(sysCfg.friendlyname[2], FRIENDLY_NAME"3", sizeof(sysCfg.friendlyname[2]));
|
||||
strlcpy(sysCfg.friendlyname[3], FRIENDLY_NAME"4", sizeof(sysCfg.friendlyname[3]));
|
||||
}
|
||||
}
|
||||
if (sysCfg.version < 0x03020800) { // 3.2.8 - Add parameter
|
||||
strlcpy(sysCfg.switch_topic, sysCfg.button_topic, sizeof(sysCfg.switch_topic));
|
||||
sysCfg.ex_mqtt_switch_retain = MQTT_SWITCH_RETAIN;
|
||||
|
@ -713,7 +715,7 @@ void CFG_Delta()
|
|||
}
|
||||
memcpy_P(sysCfg.sfb_code[0], sfb_codeDefault, 9);
|
||||
}
|
||||
|
||||
|
||||
sysCfg.version = VERSION;
|
||||
CFG_Save(1);
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -65,50 +65,50 @@ enum upins_t {
|
|||
|
||||
// Text in webpage Module Parameters and commands GPIOS and GPIO
|
||||
const char sensors[GPIO_SENSOR_END][9] PROGMEM = {
|
||||
"None",
|
||||
"DHT11",
|
||||
"AM2301",
|
||||
"DHT22",
|
||||
"DS18x20",
|
||||
"I2C SCL",
|
||||
"I2C SDA",
|
||||
"WS2812",
|
||||
"IRremote",
|
||||
"Switch1",
|
||||
"Switch2",
|
||||
"Switch3",
|
||||
"Switch4",
|
||||
"Button1",
|
||||
"Button2",
|
||||
"Button3",
|
||||
"Button4",
|
||||
"Relay1",
|
||||
"Relay2",
|
||||
"Relay3",
|
||||
"Relay4",
|
||||
"Relay1I",
|
||||
"Relay2I",
|
||||
"Relay3I",
|
||||
"Relay4I",
|
||||
"Led1",
|
||||
"Led2",
|
||||
"Led3",
|
||||
"Led4",
|
||||
"Led1I",
|
||||
"Led2I",
|
||||
"Led3I",
|
||||
"Led4I",
|
||||
"PWM1",
|
||||
"PWM2",
|
||||
"PWM3",
|
||||
"PWM4",
|
||||
"PWM5",
|
||||
"Counter1",
|
||||
"Counter2",
|
||||
"Counter3",
|
||||
"Counter4"
|
||||
D_SENSOR_NONE,
|
||||
D_SENSOR_DHT11,
|
||||
D_SENSOR_AM2301,
|
||||
D_SENSOR_DHT22,
|
||||
D_SENSOR_DS18X20,
|
||||
D_SENSOR_I2C_SCL,
|
||||
D_SENSOR_I2C_SDA,
|
||||
D_SENSOR_WS2812,
|
||||
D_SENSOR_IRREMOTE,
|
||||
D_SENSOR_SWITCH "1",
|
||||
D_SENSOR_SWITCH "2",
|
||||
D_SENSOR_SWITCH "3",
|
||||
D_SENSOR_SWITCH "4",
|
||||
D_SENSOR_BUTTON "1",
|
||||
D_SENSOR_BUTTON "2",
|
||||
D_SENSOR_BUTTON "3",
|
||||
D_SENSOR_BUTTON "4",
|
||||
D_SENSOR_RELAY "1",
|
||||
D_SENSOR_RELAY "2",
|
||||
D_SENSOR_RELAY "3",
|
||||
D_SENSOR_RELAY "4",
|
||||
D_SENSOR_RELAY "1I",
|
||||
D_SENSOR_RELAY "2I",
|
||||
D_SENSOR_RELAY "3I",
|
||||
D_SENSOR_RELAY "4I",
|
||||
D_SENSOR_LED "1",
|
||||
D_SENSOR_LED "2",
|
||||
D_SENSOR_LED "3",
|
||||
D_SENSOR_LED "4",
|
||||
D_SENSOR_LED "1I",
|
||||
D_SENSOR_LED "2I",
|
||||
D_SENSOR_LED "3I",
|
||||
D_SENSOR_LED "4I",
|
||||
D_SENSOR_PWM "1",
|
||||
D_SENSOR_PWM "2",
|
||||
D_SENSOR_PWM "3",
|
||||
D_SENSOR_PWM "4",
|
||||
D_SENSOR_PWM "5",
|
||||
D_SENSOR_COUNTER "1",
|
||||
D_SENSOR_COUNTER "2",
|
||||
D_SENSOR_COUNTER "3",
|
||||
D_SENSOR_COUNTER "4"
|
||||
};
|
||||
|
||||
|
||||
// Programmer selectable GPIO functionality offset by user selectable GPIOs
|
||||
enum fpins_t {
|
||||
GPIO_RXD = GPIO_SENSOR_END, // Serial interface
|
||||
|
@ -169,7 +169,7 @@ typedef struct MYIO {
|
|||
|
||||
typedef struct MYTMPLT {
|
||||
char name[15];
|
||||
myio gp;
|
||||
myio gp;
|
||||
} mytmplt;
|
||||
|
||||
const uint8_t nicelist[MAXMODULE] PROGMEM = {
|
||||
|
@ -211,7 +211,7 @@ const mytmplt modules[MAXMODULE] PROGMEM = {
|
|||
{ "Sonoff Basic", // Sonoff Basic (ESP8266)
|
||||
GPIO_KEY1, // GPIO00 Button
|
||||
GPIO_USER, // GPIO01 Serial RXD and Optional sensor
|
||||
0, // GPIO02
|
||||
0, // GPIO02
|
||||
GPIO_USER, // GPIO03 Serial TXD and Optional sensor
|
||||
GPIO_USER, // GPIO04 Optional sensor
|
||||
0, // GPIO05
|
||||
|
@ -460,13 +460,13 @@ const mytmplt modules[MAXMODULE] PROGMEM = {
|
|||
GPIO_LED1, // GPIO01 Green LED
|
||||
GPIO_TXD, // GPIO02 RX - Pin next to TX on the PCB
|
||||
GPIO_RXD, // GPIO03 TX - Pin next to GND on the PCB
|
||||
GPIO_PWM2, // GPIO04 W2
|
||||
GPIO_PWM2, // GPIO04 W2
|
||||
GPIO_LED2_INV, // GPIO05 Red LED
|
||||
0, 0, 0, 0, 0, 0, // Flash connection
|
||||
GPIO_PWM3, // GPIO12 Blue
|
||||
GPIO_PWM4, // GPIO13 Green
|
||||
GPIO_PWM1, // GPIO14 W1
|
||||
GPIO_PWM5, // GPIO15 Red
|
||||
GPIO_PWM3, // GPIO12 Blue
|
||||
GPIO_PWM4, // GPIO13 Green
|
||||
GPIO_PWM1, // GPIO14 W1
|
||||
GPIO_PWM5, // GPIO15 Red
|
||||
0, 0
|
||||
},
|
||||
{ "Sonoff SC", // Sonoff SC (ESP8266)
|
||||
|
|
|
@ -17,9 +17,6 @@
|
|||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
const char JSON_SNS_TEMPHUM[] PROGMEM =
|
||||
"%s, \"%s\":{\"Temperature\":%s, \"Humidity\":%s}";
|
||||
|
||||
/*********************************************************************************************\
|
||||
* Watchdog extension (https://github.com/esp8266/Arduino/issues/1532)
|
||||
\*********************************************************************************************/
|
||||
|
@ -42,14 +39,14 @@ void osw_osWatch()
|
|||
|
||||
#ifdef DEBUG_THEO
|
||||
char log[LOGSZ];
|
||||
snprintf_P(log, sizeof(log), PSTR("osWatch: FreeRam %d, rssi %d, last_run %d"), ESP.getFreeHeap(), WIFI_getRSSIasQuality(WiFi.RSSI()), last_run);
|
||||
snprintf_P(log, sizeof(log), PSTR(D_LOG_APPLICATION D_OSWATCH " FreeRam %d, rssi %d, last_run %d"), ESP.getFreeHeap(), WIFI_getRSSIasQuality(WiFi.RSSI()), last_run);
|
||||
addLog(LOG_LEVEL_DEBUG, log);
|
||||
#endif // DEBUG_THEO
|
||||
if (last_run >= (OSWATCH_RESET_TIME * 1000)) {
|
||||
addLog_P(LOG_LEVEL_INFO, PSTR("osWatch: Warning, loop blocked. Restart now"));
|
||||
addLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_APPLICATION D_OSWATCH " " D_BLOCKED_LOOP ". " D_RESTARTING));
|
||||
rtcMem.osw_flag = 1;
|
||||
RTC_Save();
|
||||
// ESP.restart(); // normal reboot
|
||||
// ESP.restart(); // normal reboot
|
||||
ESP.reset(); // hard reset
|
||||
}
|
||||
}
|
||||
|
@ -72,7 +69,7 @@ String getResetReason()
|
|||
{
|
||||
char buff[32];
|
||||
if (osw_flag) {
|
||||
strcpy_P(buff, PSTR("Blocked Loop"));
|
||||
strcpy_P(buff, PSTR(D_BLOCKED_LOOP));
|
||||
return String(buff);
|
||||
} else {
|
||||
return ESP.getResetReason();
|
||||
|
@ -82,11 +79,11 @@ String getResetReason()
|
|||
#ifdef DEBUG_THEO
|
||||
void exception_tst(byte type)
|
||||
{
|
||||
/*
|
||||
/*
|
||||
Exception (28):
|
||||
epc1=0x4000bf64 epc2=0x00000000 epc3=0x00000000 excvaddr=0x00000007 depc=0x00000000
|
||||
|
||||
ctx: cont
|
||||
ctx: cont
|
||||
sp: 3fff1f30 end: 3fff2840 offset: 01a0
|
||||
|
||||
>>>stack>>>
|
||||
|
@ -149,6 +146,85 @@ Decoding 14 results
|
|||
* General
|
||||
\*********************************************************************************************/
|
||||
|
||||
char* _dtostrf(double number, unsigned char prec, char *s, bool i18n)
|
||||
{
|
||||
bool negative = false;
|
||||
|
||||
if (isnan(number)) {
|
||||
strcpy(s, "nan");
|
||||
return s;
|
||||
}
|
||||
if (isinf(number)) {
|
||||
strcpy(s, "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);
|
||||
}
|
||||
|
||||
boolean parseIP(uint32_t* addr, const char* str)
|
||||
{
|
||||
uint8_t *part = (uint8_t*)addr;
|
||||
|
@ -169,7 +245,7 @@ boolean parseIP(uint32_t* addr, const char* str)
|
|||
void mqttfy(byte option, char* str)
|
||||
{
|
||||
// option 0 = replace by underscore
|
||||
// option 1 = delete character
|
||||
// option 1 = delete character
|
||||
uint16_t i = 0;
|
||||
while (str[i] > 0) {
|
||||
// if ((str[i] == '/') || (str[i] == '+') || (str[i] == '#') || (str[i] == ' ')) {
|
||||
|
@ -233,6 +309,23 @@ bool newerVersion(char* version_str)
|
|||
return (version > VERSION);
|
||||
}
|
||||
|
||||
char* getPowerDevice(char* dest, uint8_t idx, size_t size, uint8_t option)
|
||||
{
|
||||
char sidx[8];
|
||||
|
||||
strncpy_P(dest, S_RSLT_POWER, size);
|
||||
if ((Maxdevice + option) > 1) {
|
||||
snprintf_P(sidx, sizeof(sidx), PSTR("%d"), idx);
|
||||
strncat(dest, sidx, size);
|
||||
}
|
||||
return dest;
|
||||
}
|
||||
|
||||
char* getPowerDevice(char* dest, uint8_t idx, size_t size)
|
||||
{
|
||||
return getPowerDevice(dest, idx, size, 0);
|
||||
}
|
||||
|
||||
/*********************************************************************************************\
|
||||
* Wifi
|
||||
\*********************************************************************************************/
|
||||
|
@ -295,7 +388,7 @@ void WIFI_wps_status_cb(wps_cb_status status)
|
|||
if (WPS_CB_ST_SUCCESS == _wpsresult) {
|
||||
wifi_wps_disable();
|
||||
} else {
|
||||
snprintf_P(log, sizeof(log), PSTR("WPSconfig: FAILED with status %d"), _wpsresult);
|
||||
snprintf_P(log, sizeof(log), PSTR(D_LOG_WIFI D_WPS_FAILED_WITH_STATUS " %d"), _wpsresult);
|
||||
addLog(LOG_LEVEL_DEBUG, log);
|
||||
_wifiConfigCounter = 2;
|
||||
}
|
||||
|
@ -342,20 +435,20 @@ void WIFI_config(uint8_t type)
|
|||
restartflag = 2;
|
||||
}
|
||||
else if (WIFI_SMARTCONFIG == _wificonfigflag) {
|
||||
addLog_P(LOG_LEVEL_INFO, PSTR("Smartconfig: Active for 1 minute"));
|
||||
addLog_P(LOG_LEVEL_INFO, S_LOG_WIFI, PSTR(D_WCFG_1_SMARTCONFIG D_ACTIVE_FOR_1_MINUTE));
|
||||
WiFi.beginSmartConfig();
|
||||
}
|
||||
else if (WIFI_WPSCONFIG == _wificonfigflag) {
|
||||
if (WIFI_beginWPSConfig()) {
|
||||
addLog_P(LOG_LEVEL_INFO, PSTR("WPSconfig: Active for 1 minute"));
|
||||
addLog_P(LOG_LEVEL_INFO, S_LOG_WIFI, PSTR(D_WCFG_3_WPSCONFIG D_ACTIVE_FOR_1_MINUTE));
|
||||
} else {
|
||||
addLog_P(LOG_LEVEL_INFO, PSTR("WPSconfig: Failed to start"));
|
||||
addLog_P(LOG_LEVEL_INFO, S_LOG_WIFI, PSTR(D_WCFG_3_WPSCONFIG D_FAILED_TO_START));
|
||||
_wifiConfigCounter = 3;
|
||||
}
|
||||
}
|
||||
#ifdef USE_WEBSERVER
|
||||
else if (WIFI_MANAGER == _wificonfigflag) {
|
||||
addLog_P(LOG_LEVEL_INFO, PSTR("Wifimanager: Active for 1 minute"));
|
||||
addLog_P(LOG_LEVEL_INFO, S_LOG_WIFI, PSTR(D_WCFG_2_WIFIMANAGER D_ACTIVE_FOR_1_MINUTE));
|
||||
beginWifiManager();
|
||||
}
|
||||
#endif // USE_WEBSERVER
|
||||
|
@ -371,7 +464,7 @@ void WIFI_begin(uint8_t flag)
|
|||
UDP_Disconnect();
|
||||
#endif // USE_EMULATION
|
||||
if (!strncmp_P(ESP.getSdkVersion(),PSTR("1.5.3"),5)) {
|
||||
addLog_P(LOG_LEVEL_DEBUG, PSTR("Wifi: Patch issue 2186"));
|
||||
addLog_P(LOG_LEVEL_DEBUG, S_LOG_WIFI, PSTR(D_PATCH_ISSUE_2186));
|
||||
WiFi.mode(WIFI_OFF); // See https://github.com/esp8266/Arduino/issues/2186
|
||||
}
|
||||
WiFi.disconnect();
|
||||
|
@ -402,7 +495,7 @@ void WIFI_begin(uint8_t flag)
|
|||
}
|
||||
WiFi.hostname(Hostname);
|
||||
WiFi.begin(sysCfg.sta_ssid[sysCfg.sta_active], sysCfg.sta_pwd[sysCfg.sta_active]);
|
||||
snprintf_P(log, sizeof(log), PSTR("Wifi: Connecting to AP%d %s in mode 11%c as %s..."),
|
||||
snprintf_P(log, sizeof(log), PSTR(D_LOG_WIFI D_CONNECTING_TO_AP "%d %s " D_IN_MODE " 11%c " D_AS " %s..."),
|
||||
sysCfg.sta_active +1, sysCfg.sta_ssid[sysCfg.sta_active], PhyMode[WiFi.getPhyMode() & 0x3], Hostname);
|
||||
addLog(LOG_LEVEL_INFO, log);
|
||||
}
|
||||
|
@ -412,7 +505,7 @@ void WIFI_check_ip()
|
|||
if ((WL_CONNECTED == WiFi.status()) && (static_cast<uint32_t>(WiFi.localIP()) != 0)) {
|
||||
_wificounter = WIFI_CHECK_SEC;
|
||||
_wifiretry = WIFI_RETRY_SEC;
|
||||
addLog_P((_wifistatus != WL_CONNECTED) ? LOG_LEVEL_INFO : LOG_LEVEL_DEBUG_MORE, PSTR("Wifi: Connected"));
|
||||
addLog_P((_wifistatus != WL_CONNECTED) ? LOG_LEVEL_INFO : LOG_LEVEL_DEBUG_MORE, S_LOG_WIFI, PSTR(D_CONNECTED));
|
||||
if (_wifistatus != WL_CONNECTED) {
|
||||
// addLog_P(LOG_LEVEL_INFO, PSTR("Wifi: Set IP addresses"));
|
||||
sysCfg.ip_address[1] = (uint32_t)WiFi.gatewayIP();
|
||||
|
@ -424,12 +517,12 @@ void WIFI_check_ip()
|
|||
_wifistatus = WiFi.status();
|
||||
switch (_wifistatus) {
|
||||
case WL_CONNECTED:
|
||||
addLog_P(LOG_LEVEL_INFO, PSTR("Wifi: Connect failed as no IP address received"));
|
||||
addLog_P(LOG_LEVEL_INFO, S_LOG_WIFI, PSTR(D_CONNECT_FAILED_NO_IP_ADDRESS));
|
||||
_wifistatus = 0;
|
||||
_wifiretry = WIFI_RETRY_SEC;
|
||||
break;
|
||||
case WL_NO_SSID_AVAIL:
|
||||
addLog_P(LOG_LEVEL_INFO, PSTR("Wifi: Connect failed as AP cannot be reached"));
|
||||
addLog_P(LOG_LEVEL_INFO, S_LOG_WIFI, PSTR(D_CONNECT_FAILED_AP_NOT_REACHED));
|
||||
if (_wifiretry > (WIFI_RETRY_SEC / 2)) {
|
||||
_wifiretry = WIFI_RETRY_SEC / 2;
|
||||
}
|
||||
|
@ -438,7 +531,7 @@ void WIFI_check_ip()
|
|||
}
|
||||
break;
|
||||
case WL_CONNECT_FAILED:
|
||||
addLog_P(LOG_LEVEL_INFO, PSTR("Wifi: Connect failed with AP incorrect password"));
|
||||
addLog_P(LOG_LEVEL_INFO, S_LOG_WIFI, PSTR(D_CONNECT_FAILED_WRONG_PASSWORD));
|
||||
if (_wifiretry > (WIFI_RETRY_SEC / 2)) {
|
||||
_wifiretry = WIFI_RETRY_SEC / 2;
|
||||
}
|
||||
|
@ -448,9 +541,9 @@ void WIFI_check_ip()
|
|||
break;
|
||||
default: // WL_IDLE_STATUS and WL_DISCONNECTED
|
||||
if (!_wifiretry || ((WIFI_RETRY_SEC / 2) == _wifiretry)) {
|
||||
addLog_P(LOG_LEVEL_INFO, PSTR("Wifi: Connect failed with AP timeout"));
|
||||
addLog_P(LOG_LEVEL_INFO, S_LOG_WIFI, PSTR(D_CONNECT_FAILED_AP_TIMEOUT));
|
||||
} else {
|
||||
addLog_P(LOG_LEVEL_DEBUG, PSTR("Wifi: Attempting connection..."));
|
||||
addLog_P(LOG_LEVEL_DEBUG, S_LOG_WIFI, PSTR(D_ATTEMPTING_CONNECTION));
|
||||
}
|
||||
}
|
||||
if (_wifiretry) {
|
||||
|
@ -500,7 +593,7 @@ void WIFI_Check(uint8_t param)
|
|||
strlcpy(sysCfg.sta_pwd[0], WiFi.psk().c_str(), sizeof(sysCfg.sta_pwd[0]));
|
||||
}
|
||||
sysCfg.sta_active = 0;
|
||||
snprintf_P(log, sizeof(log), PSTR("Wificonfig: SSID1 %s and Password1 %s"), sysCfg.sta_ssid[0], sysCfg.sta_pwd[0]);
|
||||
snprintf_P(log, sizeof(log), PSTR(D_LOG_WIFI D_WCFG_1_SMARTCONFIG D_CMND_SSID "1 %s, " D_CMND_PASSWORD "1 %s"), sysCfg.sta_ssid[0], sysCfg.sta_pwd[0]);
|
||||
addLog(LOG_LEVEL_INFO, log);
|
||||
}
|
||||
}
|
||||
|
@ -512,7 +605,7 @@ void WIFI_Check(uint8_t param)
|
|||
}
|
||||
} else {
|
||||
if (_wificounter <= 0) {
|
||||
addLog_P(LOG_LEVEL_DEBUG_MORE, PSTR("Wifi: Checking connection..."));
|
||||
addLog_P(LOG_LEVEL_DEBUG_MORE, S_LOG_WIFI, PSTR(D_CHECKING_CONNECTION));
|
||||
_wificounter = WIFI_CHECK_SEC;
|
||||
WIFI_check_ip();
|
||||
}
|
||||
|
@ -520,7 +613,7 @@ void WIFI_Check(uint8_t param)
|
|||
#ifdef USE_DISCOVERY
|
||||
if (!mDNSbegun) {
|
||||
mDNSbegun = MDNS.begin(Hostname);
|
||||
snprintf_P(log, sizeof(log), PSTR("mDNS: %s"), (mDNSbegun)?"Initialized":"Failed");
|
||||
snprintf_P(log, sizeof(log), PSTR(D_LOG_MDNS "%s"), (mDNSbegun) ? D_INITIALIZED : D_FAILED);
|
||||
addLog(LOG_LEVEL_INFO, log);
|
||||
}
|
||||
#endif // USE_DISCOVERY
|
||||
|
@ -530,7 +623,7 @@ void WIFI_Check(uint8_t param)
|
|||
#ifdef USE_DISCOVERY
|
||||
#ifdef WEBSERVER_ADVERTISE
|
||||
MDNS.addService("http", "tcp", 80);
|
||||
#endif // WEBSERVER_ADVERTISE
|
||||
#endif // WEBSERVER_ADVERTISE
|
||||
#endif // USE_DISCOVERY
|
||||
} else {
|
||||
stopWebserver();
|
||||
|
@ -590,14 +683,14 @@ boolean mdns_discoverMQTTServer()
|
|||
|
||||
n = MDNS.queryService("mqtt", "tcp"); // Search for mqtt service
|
||||
|
||||
snprintf_P(log, sizeof(log), PSTR("mDNS: Query done with %d mqtt services found"), n);
|
||||
snprintf_P(log, sizeof(log), PSTR(D_LOG_MDNS D_QUERY_DONE " %d"), n);
|
||||
addLog(LOG_LEVEL_INFO, log);
|
||||
|
||||
if (n > 0) {
|
||||
// Note: current strategy is to get the first MQTT service (even when many are found)
|
||||
IPtoCharArray(MDNS.IP(0), ip_str, 20);
|
||||
|
||||
snprintf_P(log, sizeof(log), PSTR("mDNS: Service found on %s ip %s port %d"),
|
||||
|
||||
snprintf_P(log, sizeof(log), PSTR(D_LOG_MDNS D_MQTT_SERVICE_FOUND " %s, " D_IP_ADDRESS " %s, " D_PORT " %d"),
|
||||
MDNS.hostname(0).c_str(), ip_str, MDNS.port(0));
|
||||
addLog(LOG_LEVEL_INFO, log);
|
||||
|
||||
|
@ -701,7 +794,7 @@ void i2c_scan(char *devs, unsigned int devs_len)
|
|||
byte any = 0;
|
||||
char tstr[10];
|
||||
|
||||
snprintf_P(devs, devs_len, PSTR("{\"I2Cscan\":\"Device(s) found at"));
|
||||
snprintf_P(devs, devs_len, PSTR("{\"" D_CMND_I2CSCAN "\":\"" D_I2CSCAN_DEVICES_FOUND_AT));
|
||||
for (address = 1; address <= 127; address++) {
|
||||
Wire.beginTransmission(address);
|
||||
error = Wire.endTransmission();
|
||||
|
@ -711,13 +804,13 @@ void i2c_scan(char *devs, unsigned int devs_len)
|
|||
any = 1;
|
||||
}
|
||||
else if (4 == error) {
|
||||
snprintf_P(devs, devs_len, PSTR("{\"I2Cscan\":\"Unknown error at 0x%2x\"}"), address);
|
||||
snprintf_P(devs, devs_len, PSTR("{\"" D_CMND_I2CSCAN "\":\"" D_I2CSCAN_UNKNOWN_ERROR_AT " 0x%2x\"}"), address);
|
||||
}
|
||||
}
|
||||
if (any) {
|
||||
strncat(devs, "\"}", devs_len);
|
||||
} else {
|
||||
snprintf_P(devs, devs_len, PSTR("{\"I2Cscan\":\"No devices found\"}"));
|
||||
snprintf_P(devs, devs_len, PSTR("{\"" D_CMND_I2CSCAN "\":\"" D_I2CSCAN_NO_DEVICES_FOUND "\"}"));
|
||||
}
|
||||
}
|
||||
#endif // USE_I2C
|
||||
|
@ -741,7 +834,6 @@ extern "C" {
|
|||
Ticker tickerRTC;
|
||||
|
||||
static const uint8_t monthDays[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; // API starts months from 1, this array starts from 0
|
||||
static const char monthNames[] = "JanFebMarAprMayJunJulAugSepOctNovDec";
|
||||
|
||||
uint32_t utctime = 0;
|
||||
uint32_t loctime = 0;
|
||||
|
@ -762,7 +854,7 @@ String getBuildDateTime()
|
|||
int month;
|
||||
int day;
|
||||
int year;
|
||||
|
||||
|
||||
// sscanf(mdate, "%s %d %d", bdt, &day, &year); // Not implemented in 2.3.0 and probably too many code
|
||||
byte i = 0;
|
||||
for (str = strtok_r(mdate, " ", &p); str && i < 3; str = strtok_r(NULL, " ", &p)) {
|
||||
|
@ -778,7 +870,7 @@ String getBuildDateTime()
|
|||
}
|
||||
}
|
||||
month = (strstr(monthNames, smonth) -monthNames) /3 +1;
|
||||
snprintf_P(bdt, sizeof(bdt), PSTR("%d-%02d-%02dT%s"), year, month, day, __TIME__);
|
||||
snprintf_P(bdt, sizeof(bdt), PSTR("%d" D_YEAR_MONTH_SEPARATOR "%02d" D_MONTH_DAY_SEPARATOR "%02d" D_DATE_TIME_SEPARATOR "%s"), year, month, day, __TIME__);
|
||||
return String(bdt);
|
||||
}
|
||||
|
||||
|
@ -786,8 +878,8 @@ String getDateTime()
|
|||
{
|
||||
// "2017-03-07T11:08:02" - ISO8601:2004
|
||||
char dt[21];
|
||||
|
||||
snprintf_P(dt, sizeof(dt), PSTR("%04d-%02d-%02dT%02d:%02d:%02d"),
|
||||
|
||||
snprintf_P(dt, sizeof(dt), PSTR("%04d" D_YEAR_MONTH_SEPARATOR "%02d" D_MONTH_DAY_SEPARATOR "%02d" D_DATE_TIME_SEPARATOR "%02d" D_HOUR_MINUTE_SEPARATOR "%02d" D_MINUTE_SECOND_SEPARATOR "%02d"),
|
||||
rtcTime.Year, rtcTime.Month, rtcTime.Day, rtcTime.Hour, rtcTime.Minute, rtcTime.Second);
|
||||
return String(dt);
|
||||
}
|
||||
|
@ -801,7 +893,7 @@ String getUTCDateTime()
|
|||
breakTime(utctime, tmpTime);
|
||||
tmpTime.Year += 1970;
|
||||
|
||||
snprintf_P(dt, sizeof(dt), PSTR("%04d-%02d-%02dT%02d:%02d:%02d"),
|
||||
snprintf_P(dt, sizeof(dt), PSTR("%04d" D_YEAR_MONTH_SEPARATOR "%02d" D_MONTH_DAY_SEPARATOR "%02d" D_DATE_TIME_SEPARATOR "%02d" D_HOUR_MINUTE_SEPARATOR "%02d" D_MINUTE_SECOND_SEPARATOR "%02d"),
|
||||
tmpTime.Year, tmpTime.Month, tmpTime.Day, tmpTime.Hour, tmpTime.Minute, tmpTime.Second);
|
||||
return String(dt);
|
||||
}
|
||||
|
@ -984,11 +1076,11 @@ void rtc_second()
|
|||
rtcTime.Year = tmpTime.Year + 1970;
|
||||
dsttime = toTime_t(myDST, rtcTime.Year);
|
||||
stdtime = toTime_t(mySTD, rtcTime.Year);
|
||||
snprintf_P(log, sizeof(log), PSTR("RTC: (UTC) %s"), rtc_time(0).c_str());
|
||||
snprintf_P(log, sizeof(log), PSTR(D_LOG_APPLICATION "(" D_UTC_TIME ") %s"), rtc_time(0).c_str());
|
||||
addLog(LOG_LEVEL_DEBUG, log);
|
||||
snprintf_P(log, sizeof(log), PSTR("RTC: (DST) %s"), rtc_time(2).c_str());
|
||||
snprintf_P(log, sizeof(log), PSTR(D_LOG_APPLICATION "(" D_DST_TIME ") %s"), rtc_time(2).c_str());
|
||||
addLog(LOG_LEVEL_DEBUG, log);
|
||||
snprintf_P(log, sizeof(log), PSTR("RTC: (STD) %s"), rtc_time(3).c_str());
|
||||
snprintf_P(log, sizeof(log), PSTR(D_LOG_APPLICATION "(" D_STD_TIME ") %s"), rtc_time(3).c_str());
|
||||
addLog(LOG_LEVEL_DEBUG, log);
|
||||
}
|
||||
}
|
||||
|
@ -1035,7 +1127,7 @@ void rtc_init()
|
|||
float convertTemp(float c)
|
||||
{
|
||||
float result = c;
|
||||
|
||||
|
||||
if (!isnan(c) && sysCfg.flag.temperature_conversion) {
|
||||
result = c * 1.8 + 32; // Fahrenheit
|
||||
}
|
||||
|
@ -1072,7 +1164,7 @@ void syslog(const char *message)
|
|||
} else {
|
||||
syslog_level = 0;
|
||||
syslog_timer = SYSLOG_TIMER;
|
||||
snprintf_P(str, sizeof(str), PSTR("SYSL: Syslog Host not found so logging disabled for %d seconds. Consider syslog 0"), SYSLOG_TIMER);
|
||||
snprintf_P(str, sizeof(str), PSTR(D_LOG_APPLICATION D_SYSLOG_HOST_NOT_FOUND ". " D_RETRY_IN " %d " D_UNIT_SECOND), SYSLOG_TIMER);
|
||||
addLog(LOG_LEVEL_INFO, str);
|
||||
}
|
||||
}
|
||||
|
@ -1081,7 +1173,7 @@ void addLog(byte loglevel, const char *line)
|
|||
{
|
||||
char mxtime[9];
|
||||
|
||||
snprintf_P(mxtime, sizeof(mxtime), PSTR("%02d:%02d:%02d"), rtcTime.Hour, rtcTime.Minute, rtcTime.Second);
|
||||
snprintf_P(mxtime, sizeof(mxtime), PSTR("%02d" D_HOUR_MINUTE_SEPARATOR "%02d" D_MINUTE_SECOND_SEPARATOR "%02d"), rtcTime.Hour, rtcTime.Minute, rtcTime.Second);
|
||||
|
||||
if (loglevel <= seriallog_level) Serial.printf("%s %s\n", mxtime, line);
|
||||
#ifdef USE_WEBSERVER
|
||||
|
@ -1106,6 +1198,17 @@ void addLog_P(byte loglevel, const char *formatP)
|
|||
addLog(loglevel, mess);
|
||||
}
|
||||
|
||||
void addLog_P(byte loglevel, const char *formatP, const char *formatP2)
|
||||
{
|
||||
char mess[LOGSZ]; // was MESSZ
|
||||
char mes2[LOGSZ];
|
||||
|
||||
snprintf_P(mess, sizeof(mess), formatP);
|
||||
snprintf_P(mes2, sizeof(mes2), formatP2);
|
||||
strncat(mess, mes2, sizeof(mess));
|
||||
addLog(loglevel, mess);
|
||||
}
|
||||
|
||||
/*********************************************************************************************\
|
||||
*
|
||||
\*********************************************************************************************/
|
||||
|
|
|
@ -25,6 +25,10 @@
|
|||
* Corresponding MQTT/Serial/Console commands in [brackets]
|
||||
\*********************************************************************************************/
|
||||
|
||||
// -- Localization --------------------------------
|
||||
#define LANGUAGE "language\en-GB.h"
|
||||
//#define LANGUAGE "language\nl-NL.h"
|
||||
|
||||
// -- Project -------------------------------------
|
||||
#define PROJECT "sonoff" // PROJECT is used as the default topic delimiter and OTA file name
|
||||
// As an IDE restriction it needs to be the same as the main .ino file
|
||||
|
@ -45,7 +49,7 @@
|
|||
#define STA_PASS2 "VnsqrtnrsddbrN" // [Password2] Optional alternate AP Wifi password
|
||||
#define WIFI_CONFIG_TOOL WIFI_WPSCONFIG // [WifiConfig] Default tool if wifi fails to connect
|
||||
// (WIFI_RESTART, WIFI_SMARTCONFIG, WIFI_MANAGER, WIFI_WPSCONFIG, WIFI_RETRY)
|
||||
|
||||
|
||||
// -- Syslog --------------------------------------
|
||||
#define SYS_LOG_HOST "domus1" // [LogHost] (Linux) syslog host
|
||||
#define SYS_LOG_PORT 514 // [LogPort] default syslog UDP port
|
||||
|
@ -172,7 +176,7 @@
|
|||
|
||||
/*********************************************************************************************\
|
||||
* Compile a minimal version if upgrade memory gets tight ONLY TO BE USED FOR UPGRADE STEP 1!
|
||||
* To be used as step 1 during upgrade.
|
||||
* To be used as step 1 during upgrade.
|
||||
* Step 2 is re-compile with option BE_MINIMAL commented out.
|
||||
* !!! Needed for next release of Arduino/ESP8266 (+22k code, +2k mem) !!!
|
||||
\*********************************************************************************************/
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
/*****************************************************************************************************\
|
||||
* ATTENTION: - Changes to most PARAMETER defines will only override flash settings if you change
|
||||
* define CFG_HOLDER.
|
||||
* define CFG_HOLDER.
|
||||
* - Expect compiler warnings when no ifdef/undef/endif sequence is used.
|
||||
* - You still need to update user_config.h for major defines MODULE and USE_MQTT_TLS.
|
||||
* - Changing MODULE defines are not being tested for validity as they are in user_config.h.
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -23,22 +23,22 @@
|
|||
|
||||
#ifdef USE_WEBSERVER
|
||||
const char HTTP_FORM_DOMOTICZ[] PROGMEM =
|
||||
"<fieldset><legend><b> Domoticz parameters </b></legend><form method='post' action='sv'>"
|
||||
"<fieldset><legend><b> " D_DOMOTICZ_PARAMETERS " </b></legend><form method='post' action='sv'>"
|
||||
"<input id='w' name='w' value='4' hidden><input id='r' name='r' value='1' hidden>"
|
||||
"<br/><table style='width:97%'>";
|
||||
const char HTTP_FORM_DOMOTICZ_RELAY[] PROGMEM =
|
||||
"<tr><td><b>Idx {1</b></td></td><td width='20%'><input id='r{1' name='r{1' length=8 placeholder='0' value='{2'></td></tr>"
|
||||
"<tr><td><b>Key idx {1</b></td><td><input id='k{1' name='k{1' length=8 placeholder='0' value='{3'></td></tr>";
|
||||
"<tr><td><b>" D_DOMOTICZ_IDX " {1</b></td></td><td width='20%'><input id='r{1' name='r{1' length=8 placeholder='0' value='{2'></td></tr>"
|
||||
"<tr><td><b>" D_DOMOTICZ_KEY_IDX " {1</b></td><td><input id='k{1' name='k{1' length=8 placeholder='0' value='{3'></td></tr>";
|
||||
const char HTTP_FORM_DOMOTICZ_SWITCH[] PROGMEM =
|
||||
"<tr><td><b>Switch idx {1</b></td><td width='20%'><input id='s{1' name='s{1' length=8 placeholder='0' value='{4'></td></tr>";
|
||||
"<tr><td><b>" D_DOMOTICZ_SWITCH_IDX " {1</b></td><td width='20%'><input id='s{1' name='s{1' length=8 placeholder='0' value='{4'></td></tr>";
|
||||
const char HTTP_FORM_DOMOTICZ_SENSOR[] PROGMEM =
|
||||
"<tr><td><b>Sensor idx {1</b> - {2</td><td width='20%'><input id='l{1' name='l{1' length=8 placeholder='0' value='{5'></td></tr>";
|
||||
"<tr><td><b>" D_DOMOTICZ_SENSOR_IDX " {1</b> - {2</td><td width='20%'><input id='l{1' name='l{1' length=8 placeholder='0' value='{5'></td></tr>";
|
||||
const char HTTP_FORM_DOMOTICZ_TIMER[] PROGMEM =
|
||||
"<tr><td><b>Update timer</b> (" STR(DOMOTICZ_UPDATE_TIMER) ")</td><td><input id='ut' name='ut' length=32 placeholder='" STR(DOMOTICZ_UPDATE_TIMER) "' value='{6'</td></tr>";
|
||||
"<tr><td><b>" D_DOMOTICZ_UPDATE_TIMER "</b> (" STR(DOMOTICZ_UPDATE_TIMER) ")</td><td><input id='ut' name='ut' length=32 placeholder='" STR(DOMOTICZ_UPDATE_TIMER) "' value='{6'</td></tr>";
|
||||
#endif // USE_WEBSERVER
|
||||
|
||||
const char domoticz_sensors[DOMOTICZ_MAX_SENSORS][14] PROGMEM =
|
||||
{ "Temp", "Temp,Hum", "Temp,Hum,Baro", "Power,Energy", "Illuminance", "Count" };
|
||||
const char domoticz_sensors[DOMOTICZ_MAX_SENSORS][DOMOTICZ_SENSORS_MAX_STRING_LENGTH] PROGMEM =
|
||||
{ D_DOMOTICZ_TEMP, D_DOMOTICZ_TEMP_HUM, D_DOMOTICZ_TEMP_HUM_BARO, D_DOMOTICZ_POWER_ENERGY, D_DOMOTICZ_ILLUMINANCE, D_DOMOTICZ_COUNT };
|
||||
|
||||
char domoticz_in_topic[] = DOMOTICZ_IN_TOPIC;
|
||||
char domoticz_out_topic[] = DOMOTICZ_OUT_TOPIC;
|
||||
|
@ -142,7 +142,7 @@ boolean domoticz_mqttData(char *topicBuf, uint16_t stopicBuf, char *dataBuf, uin
|
|||
unsigned long idx = 0;
|
||||
int16_t nvalue;
|
||||
int16_t found = 0;
|
||||
|
||||
|
||||
domoticz_update_flag = 1;
|
||||
if (!strncmp(topicBuf, domoticz_out_topic, strlen(domoticz_out_topic)) != 0) {
|
||||
if (sdataBuf < 20) {
|
||||
|
@ -159,7 +159,7 @@ boolean domoticz_mqttData(char *topicBuf, uint16_t stopicBuf, char *dataBuf, uin
|
|||
idx = domoticz["idx"];
|
||||
nvalue = domoticz["nvalue"];
|
||||
|
||||
snprintf_P(log, sizeof(log), PSTR("DMTZ: idx %d, nvalue %d"), idx, nvalue);
|
||||
snprintf_P(log, sizeof(log), PSTR(D_LOG_DOMOTICZ "idx %d, nvalue %d"), idx, nvalue);
|
||||
addLog(LOG_LEVEL_DEBUG_MORE, log);
|
||||
|
||||
if (nvalue >= 0 && nvalue <= 2) {
|
||||
|
@ -174,14 +174,14 @@ boolean domoticz_mqttData(char *topicBuf, uint16_t stopicBuf, char *dataBuf, uin
|
|||
if (sfl_flg && (sysCfg.led_dimmer[i] == nvalue)) {
|
||||
return 1;
|
||||
}
|
||||
snprintf_P(topicBuf, stopicBuf, PSTR("/DIMMER%s"), (Maxdevice > 1) ? stemp1 : "");
|
||||
snprintf_P(topicBuf, stopicBuf, PSTR("/" D_CMND_DIMMER "%s"), (Maxdevice > 1) ? stemp1 : "");
|
||||
snprintf_P(dataBuf, sdataBuf, PSTR("%d"), nvalue);
|
||||
found = 1;
|
||||
} else {
|
||||
if (((power >> i) &1) == nvalue) {
|
||||
return 1;
|
||||
}
|
||||
snprintf_P(topicBuf, stopicBuf, PSTR("/POWER%s"), (Maxdevice > 1) ? stemp1 : "");
|
||||
snprintf_P(topicBuf, stopicBuf, PSTR("/" D_CMND_POWER "%s"), (Maxdevice > 1) ? stemp1 : "");
|
||||
snprintf_P(dataBuf, sdataBuf, PSTR("%d"), nvalue);
|
||||
found = 1;
|
||||
}
|
||||
|
@ -193,7 +193,7 @@ boolean domoticz_mqttData(char *topicBuf, uint16_t stopicBuf, char *dataBuf, uin
|
|||
return 1;
|
||||
}
|
||||
|
||||
snprintf_P(log, sizeof(log), PSTR("DMTZ: Receive topic %s, data %s"), topicBuf, dataBuf);
|
||||
snprintf_P(log, sizeof(log), PSTR(D_LOG_DOMOTICZ D_RECEIVED_TOPIC " %s, " D_DATA " %s"), topicBuf, dataBuf);
|
||||
addLog(LOG_LEVEL_DEBUG_MORE, log);
|
||||
|
||||
domoticz_update_flag = 0;
|
||||
|
@ -208,38 +208,39 @@ boolean domoticz_mqttData(char *topicBuf, uint16_t stopicBuf, char *dataBuf, uin
|
|||
boolean domoticz_command(const char *type, uint16_t index, char *dataBuf, uint16_t data_len, int16_t payload, char *svalue, uint16_t ssvalue)
|
||||
{
|
||||
boolean serviced = true;
|
||||
|
||||
if (!strncmp_P(type,PSTR("DOMOTICZ"),8)) {
|
||||
if (!strcmp_P(type +8,PSTR("IDX")) && (index > 0) && (index <= Maxdevice)) {
|
||||
uint8_t dmtcz_len = strlen(D_CMND_DOMOTICZ); // Prep for string length change
|
||||
|
||||
if (!strncasecmp_P(type, PSTR(D_CMND_DOMOTICZ), dmtcz_len)) { // Prefix
|
||||
if (!strcasecmp_P(type +dmtcz_len, PSTR(D_CMND_IDX)) && (index > 0) && (index <= Maxdevice)) {
|
||||
if (payload >= 0) {
|
||||
sysCfg.domoticz_relay_idx[index -1] = payload;
|
||||
restartflag = 2;
|
||||
}
|
||||
snprintf_P(svalue, ssvalue, PSTR("{\"DomoticzIdx%d\":%d}"), index, sysCfg.domoticz_relay_idx[index -1]);
|
||||
snprintf_P(svalue, ssvalue, PSTR("{\"" D_CMND_DOMOTICZ D_CMND_IDX "%d\":%d}"), index, sysCfg.domoticz_relay_idx[index -1]);
|
||||
}
|
||||
else if (!strcmp_P(type +8,PSTR("KEYIDX")) && (index > 0) && (index <= Maxdevice)) {
|
||||
else if (!strcasecmp_P(type +dmtcz_len, PSTR(D_CMND_KEYIDX)) && (index > 0) && (index <= Maxdevice)) {
|
||||
if (payload >= 0) {
|
||||
sysCfg.domoticz_key_idx[index -1] = payload;
|
||||
}
|
||||
snprintf_P(svalue, ssvalue, PSTR("{\"DomoticzKeyIdx%d\":%d}"), index, sysCfg.domoticz_key_idx[index -1]);
|
||||
snprintf_P(svalue, ssvalue, PSTR("{\"" D_CMND_DOMOTICZ D_CMND_KEYIDX "%d\":%d}"), index, sysCfg.domoticz_key_idx[index -1]);
|
||||
}
|
||||
else if (!strcmp_P(type +8,PSTR("SWITCHIDX")) && (index > 0) && (index <= Maxdevice)) {
|
||||
else if (!strcasecmp_P(type +dmtcz_len, PSTR(D_CMND_SWITCHIDX)) && (index > 0) && (index <= Maxdevice)) {
|
||||
if (payload >= 0) {
|
||||
sysCfg.domoticz_switch_idx[index -1] = payload;
|
||||
}
|
||||
snprintf_P(svalue, ssvalue, PSTR("{\"DomoticzSwitchIdx%d\":%d}"), index, sysCfg.domoticz_key_idx[index -1]);
|
||||
snprintf_P(svalue, ssvalue, PSTR("{\"" D_CMND_DOMOTICZ D_CMND_SWITCHIDX "%d\":%d}"), index, sysCfg.domoticz_key_idx[index -1]);
|
||||
}
|
||||
else if (!strcmp_P(type +8,PSTR("SENSORIDX")) && (index > 0) && (index <= DOMOTICZ_MAX_SENSORS)) {
|
||||
else if (!strcasecmp_P(type +dmtcz_len, PSTR(D_CMND_SENSORIDX)) && (index > 0) && (index <= DOMOTICZ_MAX_SENSORS)) {
|
||||
if (payload >= 0) {
|
||||
sysCfg.domoticz_sensor_idx[index -1] = payload;
|
||||
}
|
||||
snprintf_P(svalue, ssvalue, PSTR("{\"DomoticzSensorIdx%d\":%d}"), index, sysCfg.domoticz_sensor_idx[index -1]);
|
||||
snprintf_P(svalue, ssvalue, PSTR("{\"" D_CMND_DOMOTICZ D_CMND_SENSORIDX "%d\":%d}"), index, sysCfg.domoticz_sensor_idx[index -1]);
|
||||
}
|
||||
else if (!strcmp_P(type +8,PSTR("UPDATETIMER"))) {
|
||||
else if (!strcasecmp_P(type +dmtcz_len, PSTR(D_CMND_UPDATETIMER))) {
|
||||
if ((payload >= 0) && (payload < 3601)) {
|
||||
sysCfg.domoticz_update_timer = payload;
|
||||
}
|
||||
snprintf_P(svalue, ssvalue, PSTR("{\"DomoticzUpdateTimer\":%d}"), sysCfg.domoticz_update_timer);
|
||||
snprintf_P(svalue, ssvalue, PSTR("{\"" D_CMND_DOMOTICZ D_CMND_UPDATETIMER "\":%d}"), sysCfg.domoticz_update_timer);
|
||||
}
|
||||
else serviced = false;
|
||||
}
|
||||
|
@ -327,18 +328,20 @@ void domoticz_sensor6(uint32_t count)
|
|||
\*********************************************************************************************/
|
||||
|
||||
#ifdef USE_WEBSERVER
|
||||
const char S_CONFIGURE_DOMOTICZ[] PROGMEM = D_CONFIGURE_DOMOTICZ;
|
||||
|
||||
void handleDomoticz()
|
||||
{
|
||||
if (HTTP_USER == _httpflag) {
|
||||
handleRoot();
|
||||
return;
|
||||
}
|
||||
addLog_P(LOG_LEVEL_DEBUG, PSTR("HTTP: Handle Domoticz config"));
|
||||
addLog_P(LOG_LEVEL_DEBUG, S_LOG_HTTP, S_CONFIGURE_DOMOTICZ);
|
||||
|
||||
char stemp[20];
|
||||
|
||||
|
||||
String page = FPSTR(HTTP_HEAD);
|
||||
page.replace("{v}", "Configure Domoticz");
|
||||
page.replace("{v}", S_CONFIGURE_DOMOTICZ);
|
||||
page += FPSTR(HTTP_FORM_DOMOTICZ);
|
||||
for (int i = 0; i < 4; i++) {
|
||||
if (i < Maxdevice) {
|
||||
|
@ -384,11 +387,11 @@ void domoticz_saveSettings()
|
|||
sysCfg.domoticz_sensor_idx[i] = (!strlen(webServer->arg(stemp).c_str())) ? 0 : atoi(webServer->arg(stemp).c_str());
|
||||
}
|
||||
sysCfg.domoticz_update_timer = (!strlen(webServer->arg("ut").c_str())) ? DOMOTICZ_UPDATE_TIMER : atoi(webServer->arg("ut").c_str());
|
||||
snprintf_P(log, sizeof(log), PSTR("HTTP: Domoticz idx %d, %d, %d, %d, update timer %d"),
|
||||
snprintf_P(log, sizeof(log), PSTR(D_LOG_DOMOTICZ D_CMND_IDX " %d, %d, %d, %d, " D_CMND_UPDATETIMER " %d"),
|
||||
sysCfg.domoticz_relay_idx[0], sysCfg.domoticz_relay_idx[1], sysCfg.domoticz_relay_idx[2], sysCfg.domoticz_relay_idx[3],
|
||||
sysCfg.domoticz_update_timer);
|
||||
addLog(LOG_LEVEL_INFO, log);
|
||||
snprintf_P(log, sizeof(log), PSTR("HTTP: key %d, %d, %d, %d, switch %d, %d, %d, %d, sensor %d, %d, %d, %d, %d, %d"),
|
||||
snprintf_P(log, sizeof(log), PSTR(D_LOG_DOMOTICZ D_CMND_KEYIDX " %d, %d, %d, %d, " D_CMND_SWITCHIDX " %d, %d, %d, %d, " D_CMND_SENSORIDX " %d, %d, %d, %d, %d, %d"),
|
||||
sysCfg.domoticz_key_idx[0], sysCfg.domoticz_key_idx[1], sysCfg.domoticz_key_idx[2], sysCfg.domoticz_key_idx[3],
|
||||
sysCfg.domoticz_switch_idx[0], sysCfg.domoticz_switch_idx[1], sysCfg.domoticz_switch_idx[2], sysCfg.domoticz_switch_idx[3],
|
||||
sysCfg.domoticz_sensor_idx[0], sysCfg.domoticz_sensor_idx[1], sysCfg.domoticz_sensor_idx[2], sysCfg.domoticz_sensor_idx[3],
|
||||
|
@ -397,4 +400,3 @@ void domoticz_saveSettings()
|
|||
}
|
||||
#endif // USE_WEBSERVER
|
||||
#endif // USE_DOMOTICZ
|
||||
|
||||
|
|
|
@ -84,17 +84,17 @@ boolean ir_send_command(char *type, uint16_t index, char *dataBufUc, uint16_t da
|
|||
|
||||
// char log[LOGSZ];
|
||||
|
||||
if (!strcmp_P(type,PSTR("IRSEND"))) {
|
||||
if (!strcasecmp_P(type, PSTR(D_CMND_IRSEND))) {
|
||||
if (data_len) {
|
||||
StaticJsonBuffer<128> jsonBuf;
|
||||
JsonObject &ir_json = jsonBuf.parseObject(dataBufUc);
|
||||
if (!ir_json.success()) {
|
||||
snprintf_P(svalue, ssvalue, PSTR("{\"IRSend\":\"Invalid JSON\"}")); // JSON decode failed
|
||||
snprintf_P(svalue, ssvalue, PSTR("{\"" D_CMND_IRSEND "\":\"" D_INVALID_JSON "\"}")); // JSON decode failed
|
||||
} else {
|
||||
snprintf_P(svalue, ssvalue, PSTR("{\"IRSend\":\"Done\"}"));
|
||||
protocol = ir_json["PROTOCOL"];
|
||||
bits = ir_json["BITS"];
|
||||
data = ir_json["DATA"];
|
||||
snprintf_P(svalue, ssvalue, PSTR("{\"" D_CMND_IRSEND "\":\"" D_DONE "\"}"));
|
||||
protocol = ir_json[D_IRSEND_PROTOCOL];
|
||||
bits = ir_json[D_IRSEND_BITS];
|
||||
data = ir_json[D_IRSEND_DATA];
|
||||
if (protocol && bits && data) {
|
||||
if (!strcmp_P(protocol,PSTR("NEC"))) irsend->sendNEC(data, bits);
|
||||
else if (!strcmp_P(protocol,PSTR("SONY"))) irsend->sendSony(data, bits);
|
||||
|
@ -104,34 +104,34 @@ boolean ir_send_command(char *type, uint16_t index, char *dataBufUc, uint16_t da
|
|||
else if (!strcmp_P(protocol,PSTR("JVC"))) irsend->sendJVC(data, bits, 1);
|
||||
else if (!strcmp_P(protocol,PSTR("SAMSUNG"))) irsend->sendSAMSUNG(data, bits);
|
||||
else {
|
||||
snprintf_P(svalue, ssvalue, PSTR("{\"IRSend\":\"Protocol not supported\"}"));
|
||||
snprintf_P(svalue, ssvalue, PSTR("{\"" D_CMND_IRSEND "\":\"" D_PROTOCOL_NOT_SUPPORTED "\"}"));
|
||||
}
|
||||
} else error = true;
|
||||
}
|
||||
} else error = true;
|
||||
if (error) {
|
||||
snprintf_P(svalue, ssvalue, PSTR("{\"IRSend\":\"No protocol, bits or data\"}"));
|
||||
snprintf_P(svalue, ssvalue, PSTR("{\"" D_CMND_IRSEND "\":\"" D_NO D_IRSEND_PROTOCOL ", " D_IRSEND_BITS " " D_OR " " D_IRSEND_DATA "\"}"));
|
||||
}
|
||||
}
|
||||
#ifdef USE_IR_HVAC
|
||||
else if (!strcmp_P(type,PSTR("IRHVAC"))) {
|
||||
else if (!strcasecmp_P(type, PSTR(D_CMND_IRHVAC))) {
|
||||
if (data_len) {
|
||||
StaticJsonBuffer<164> jsonBufer;
|
||||
JsonObject &root = jsonBufer.parseObject(dataBufUc);
|
||||
if (!root.success()) {
|
||||
snprintf_P(svalue, ssvalue, PSTR("{\"IRHVAC\":\"Invalid JSON\"}")); // JSON decode failed
|
||||
snprintf_P(svalue, ssvalue, PSTR("{\"" D_CMND_IRHVAC "\":\"" D_INVALID_JSON "\"}")); // JSON decode failed
|
||||
} else {
|
||||
snprintf_P(svalue, ssvalue, PSTR("{\"IRHVAC\":\"Done\"}"));
|
||||
HVAC_Vendor = root["VENDOR"];
|
||||
HVAC_Power = root["POWER"];
|
||||
HVAC_Mode = root["MODE"];
|
||||
HVAC_FanMode = root["FANSPEED"];
|
||||
HVAC_Temp = root["TEMP"];
|
||||
snprintf_P(svalue, ssvalue, PSTR("{\"" D_CMND_IRHVAC "\":\"" D_DONE "\"}"));
|
||||
HVAC_Vendor = root[D_IRHVAC_VENDOR];
|
||||
HVAC_Power = root[D_IRHVAC_POWER];
|
||||
HVAC_Mode = root[D_IRHVAC_MODE];
|
||||
HVAC_FanMode = root[D_IRHVAC_FANSPEED];
|
||||
HVAC_Temp = root[D_IRHVAC_TEMP];
|
||||
|
||||
// snprintf_P(log, sizeof(log), PSTR("IRHVAC: Received Vendor %s, Power %d, Mode %s, FanSpeed %s, Temp %d"),
|
||||
// HVAC_Vendor, HVAC_Power, HVAC_Mode, HVAC_FanMode, HVAC_Temp);
|
||||
// addLog(LOG_LEVEL_DEBUG, log);
|
||||
|
||||
|
||||
if (HVAC_Vendor == NULL || !strcmp_P(HVAC_Vendor,PSTR("TOSHIBA"))) {
|
||||
error = ir_hvac_toshiba(HVAC_Mode, HVAC_FanMode, HVAC_Power, HVAC_Temp);
|
||||
}
|
||||
|
@ -142,7 +142,7 @@ boolean ir_send_command(char *type, uint16_t index, char *dataBufUc, uint16_t da
|
|||
}
|
||||
} else error = true;
|
||||
if (error) {
|
||||
snprintf_P(svalue, ssvalue, PSTR("{\"IRHVAC\":\"Wrong Vendor, Mode and/or FanSpeed\"}"));
|
||||
snprintf_P(svalue, ssvalue, PSTR("{\"" D_CMND_IRHVAC "\":\"" D_WRONG D_IRHVAC_VENDOR ", " D_IRHVAC_MODE " " D_OR " " D_IRHVAC_FANSPEED "\"}"));
|
||||
}
|
||||
}
|
||||
#endif // USE_IR_HVAC
|
||||
|
@ -184,7 +184,7 @@ boolean ir_hvac_toshiba(const char *HVAC_Mode, const char *HVAC_FanMode, boolean
|
|||
if (!p) {
|
||||
return true;
|
||||
}
|
||||
mode = p - FANSPEED +1;
|
||||
mode = p - FANSPEED +1;
|
||||
if ((1 == mode) || (7 == mode)) {
|
||||
mode = 0;
|
||||
}
|
||||
|
@ -247,7 +247,7 @@ boolean ir_hvac_mitsubishi(const char *HVAC_Mode,const char *HVAC_FanMode, boole
|
|||
char *token;
|
||||
uint8_t mode;
|
||||
char log[LOGSZ];
|
||||
|
||||
|
||||
mitsubir->stateReset();
|
||||
|
||||
if (HVAC_Mode == NULL) {
|
||||
|
@ -277,11 +277,11 @@ boolean ir_hvac_mitsubishi(const char *HVAC_Mode,const char *HVAC_FanMode, boole
|
|||
mitsubir->setTemp(HVAC_Temp);
|
||||
mitsubir->setVane(MITSUBISHI_AC_VANE_AUTO);
|
||||
mitsubir->send();
|
||||
|
||||
|
||||
// snprintf_P(log, sizeof(log), PSTR("IRHVAC: Mitsubishi Power %d, Mode %d, FanSpeed %d, Temp %d, VaneMode %d"),
|
||||
// mitsubir->getPower(), mitsubir->getMode(), mitsubir->getFan(), mitsubir->getTemp(), mitsubir->getVane());
|
||||
// addLog(LOG_LEVEL_DEBUG, log);
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
#endif // USE_IR_HVAC
|
||||
|
|
|
@ -45,13 +45,13 @@ void sb_received()
|
|||
for (i = 0; i < SerialInByteCounter; i++) {
|
||||
snprintf_P(svalue, sizeof(svalue), PSTR("%s%02X "), svalue, serialInBuf[i]);
|
||||
}
|
||||
snprintf_P(log, sizeof(log), PSTR("BRDG: Received %s"), svalue);
|
||||
snprintf_P(log, sizeof(log), PSTR(D_LOG_BRIDGE D_RECEIVED " %s"), svalue);
|
||||
addLog(LOG_LEVEL_DEBUG, log);
|
||||
|
||||
if (0xA2 == serialInBuf[0]) { // Learn timeout
|
||||
sfb_learnFlg = 0;
|
||||
snprintf_P(svalue, sizeof(svalue), PSTR("{\"RfKey%d\":\"Learn failed\"}"), sfb_learnKey);
|
||||
mqtt_publish_topic_P(5, PSTR("RFKEY"), svalue);
|
||||
snprintf_P(svalue, sizeof(svalue), PSTR("{\"" D_CMND_RFKEY "%d\":\"" D_LEARN_FAILED "\"}"), sfb_learnKey);
|
||||
mqtt_publish_topic_P(5, PSTR(D_CMND_RFKEY), svalue);
|
||||
}
|
||||
else if (0xA3 == serialInBuf[0]) { // Learned A3 20 F8 01 18 03 3E 2E 1A 22 55
|
||||
sfb_learnFlg = 0;
|
||||
|
@ -61,11 +61,11 @@ void sb_received()
|
|||
for (i = 0; i < 9; i++) {
|
||||
sysCfg.sfb_code[sfb_learnKey][i] = serialInBuf[i +1];
|
||||
}
|
||||
snprintf_P(svalue, sizeof(svalue), PSTR("{\"RfKey%d\":\"Learned\"}"), sfb_learnKey);
|
||||
snprintf_P(svalue, sizeof(svalue), PSTR("{\"" D_CMND_RFKEY "%d\":\"" D_LEARNED "\"}"), sfb_learnKey);
|
||||
} else {
|
||||
snprintf_P(svalue, sizeof(svalue), PSTR("{\"RfKey%d\":\"Learn failed\"}"), sfb_learnKey);
|
||||
snprintf_P(svalue, sizeof(svalue), PSTR("{\"" D_CMND_RFKEY "%d\":\"" D_LEARN_FAILED "\"}"), sfb_learnKey);
|
||||
}
|
||||
mqtt_publish_topic_P(5, PSTR("RFKEY"), svalue);
|
||||
mqtt_publish_topic_P(5, PSTR(D_CMND_RFKEY), svalue);
|
||||
}
|
||||
else if (0xA4 == serialInBuf[0]) { // Received RF data A4 20 EE 01 18 03 3E 2E 1A 22 55
|
||||
rsy = serialInBuf[1] << 8 | serialInBuf[2]; // Sync time in uSec
|
||||
|
@ -77,7 +77,7 @@ void sb_received()
|
|||
if (!((rid == sfb_lastrid) && (now - sfb_lasttime < SFB_TIME_AVOID_DUPLICATE))) {
|
||||
sfb_lastrid = rid;
|
||||
sfb_lasttime = now;
|
||||
strcpy_P(rfkey, PSTR("\"None\""));
|
||||
strcpy_P(rfkey, PSTR("\"" D_NONE "\""));
|
||||
for (i = 1; i <= 16; i++) {
|
||||
if (sysCfg.sfb_code[i][0]) {
|
||||
sid = sysCfg.sfb_code[i][6] << 16 | sysCfg.sfb_code[i][7] << 8 | sysCfg.sfb_code[i][8];
|
||||
|
@ -87,11 +87,11 @@ void sb_received()
|
|||
}
|
||||
}
|
||||
}
|
||||
snprintf_P(svalue, sizeof(svalue), PSTR("{\"RfReceived\":{\"Sync\":%d, \"Low\":%d, \"High\":%d, \"Data\":\"%06X\", \"RfKey\":%s}}"),
|
||||
snprintf_P(svalue, sizeof(svalue), PSTR("{\"" D_RFRECEIVED "\":{\"" D_SYNC "\":%d, \"" D_LOW "\":%d, \"" D_HIGH "\":%d, \"" D_DATA "\":\"%06X\", \"" D_CMND_RFKEY "\":%s}}"),
|
||||
rsy, rlo, rhi, rid, rfkey);
|
||||
mqtt_publish_topic_P(6, PSTR("RFRECEIVED"), svalue);
|
||||
mqtt_publish_topic_P(6, PSTR(D_RFRECEIVED), svalue);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
boolean sb_serial()
|
||||
|
@ -125,7 +125,7 @@ void sb_sendAck()
|
|||
void sb_send(uint8_t idx, uint8_t key)
|
||||
{
|
||||
uint8_t code;
|
||||
|
||||
|
||||
key--; // Support 1 to 16
|
||||
Serial.write(0xAA); // Start of Text
|
||||
Serial.write(0xA5); // Send following code
|
||||
|
@ -160,7 +160,7 @@ boolean sb_command(char *type, uint16_t index, char *dataBuf, uint16_t data_len,
|
|||
boolean serviced = true;
|
||||
char *p;
|
||||
|
||||
if (!strcmp_P(type, PSTR("RFDEFAULT"))) {
|
||||
if (!strcasecmp_P(type, PSTR(D_CMND_RFDEFAULT))) {
|
||||
if (4 == data_len) {
|
||||
uint16_t hexcode = strtol(dataBuf, &p, 16);
|
||||
uint8_t msb = hexcode >> 8;
|
||||
|
@ -170,28 +170,28 @@ boolean sb_command(char *type, uint16_t index, char *dataBuf, uint16_t data_len,
|
|||
sysCfg.sfb_code[0][7] = lsb;
|
||||
}
|
||||
}
|
||||
snprintf_P(svalue, ssvalue, PSTR("{\"RfDefault\":\"%0X%0X\"}"), sysCfg.sfb_code[0][6], sysCfg.sfb_code[0][7]);
|
||||
snprintf_P(svalue, ssvalue, PSTR("{\"" D_CMND_RFDEFAULT "\":\"%0X%0X\"}"), sysCfg.sfb_code[0][6], sysCfg.sfb_code[0][7]);
|
||||
}
|
||||
else if (!strcmp_P(type, PSTR("RFKEY")) && (index > 0) && (index <= 16)) {
|
||||
else if (!strcasecmp_P(type, PSTR(D_CMND_RFKEY)) && (index > 0) && (index <= 16)) {
|
||||
if (!sfb_learnFlg) {
|
||||
if (2 == payload) {
|
||||
sb_learn(index);
|
||||
snprintf_P(svalue, ssvalue, PSTR("{\"RfKey%d\":\"Start learning\"}"), index);
|
||||
snprintf_P(svalue, ssvalue, PSTR("{\"" D_CMND_RFKEY "%d\":\"" D_START_LEARNING "\"}"), index);
|
||||
}
|
||||
else if (3 == payload) {
|
||||
sysCfg.sfb_code[index][0] = 0;
|
||||
snprintf_P(svalue, ssvalue, PSTR("{\"RfKey%d\":\"Set to default\"}"), index);
|
||||
snprintf_P(svalue, ssvalue, PSTR("{\"" D_CMND_RFKEY "%d\":\"" D_SET_TO_DEFAULT "\"}"), index);
|
||||
} else {
|
||||
if ((1 == payload) || (0 == sysCfg.sfb_code[index][0])) {
|
||||
sb_send(0, index);
|
||||
snprintf_P(svalue, ssvalue, PSTR("{\"RfKey%d\":\"Default sent\"}"), index);
|
||||
snprintf_P(svalue, ssvalue, PSTR("{\"" D_CMND_RFKEY "%d\":\"" D_DEFAULT_SENT "\"}"), index);
|
||||
} else {
|
||||
sb_send(index, 0);
|
||||
snprintf_P(svalue, ssvalue, PSTR("{\"RfKey%d\":\"Learned sent\"}"), index);
|
||||
snprintf_P(svalue, ssvalue, PSTR("{\"" D_CMND_RFKEY "%d\":\"" D_LEARNED_SENT "\"}"), index);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
snprintf_P(svalue, ssvalue, PSTR("{\"RfKey%d\":\"Learning active\"}"), sfb_learnKey);
|
||||
snprintf_P(svalue, ssvalue, PSTR("{\"" D_CMND_RFKEY "%d\":\"" D_LEARNING_ACTIVE "\"}"), sfb_learnKey);
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
/*********************************************************************************************\
|
||||
* Sonoff B1, AiLight, Sonoff Led and BN-SZ01
|
||||
*
|
||||
*
|
||||
* sfl_flg Module Color ColorTemp
|
||||
* 1 Sonoff BN-SZ W no
|
||||
* 2 Sonoff Led CW yes
|
||||
|
@ -101,7 +101,7 @@ void sl_my92x1_init()
|
|||
{
|
||||
uint8_t chips = sfl_flg -3; // 1 (AiLight) or 2 (Sonoff B1)
|
||||
|
||||
sl_dcki_pulse(chips * 32); // Clear all duty register
|
||||
sl_dcki_pulse(chips * 32); // Clear all duty register
|
||||
os_delay_us(12); // TStop > 12us.
|
||||
// Send 12 DI pulse, after 6 pulse's falling edge store duty data, and 12
|
||||
// pulse's rising edge convert to command mode.
|
||||
|
@ -160,7 +160,7 @@ void sl_init(void)
|
|||
} else {
|
||||
sl_pdi = pin[GPIO_DI];
|
||||
sl_pdcki = pin[GPIO_DCKI];
|
||||
|
||||
|
||||
pinMode(sl_pdi, OUTPUT);
|
||||
pinMode(sl_pdcki, OUTPUT);
|
||||
digitalWrite(sl_pdi, LOW);
|
||||
|
@ -168,7 +168,7 @@ void sl_init(void)
|
|||
|
||||
sl_my92x1_init();
|
||||
}
|
||||
|
||||
|
||||
sl_power = 0;
|
||||
sl_any = 0;
|
||||
sl_wakeupActive = 0;
|
||||
|
@ -177,7 +177,7 @@ void sl_init(void)
|
|||
void sl_setColorTemp(uint16_t ct)
|
||||
{
|
||||
/* Color Temperature (https://developers.meethue.com/documentation/core-concepts)
|
||||
*
|
||||
*
|
||||
* ct = 153 = 2000K = Warm = CCWW = 00FF
|
||||
* ct = 500 = 6500K = Cold = CCWW = FF00
|
||||
*/
|
||||
|
@ -260,7 +260,7 @@ char* sl_getColor(char* scolor)
|
|||
void sl_prepPower(char *svalue, uint16_t ssvalue)
|
||||
{
|
||||
char scolor[11];
|
||||
|
||||
|
||||
// do_cmnd_power(index, (sysCfg.led_dimmer[0]>0));
|
||||
if (sysCfg.led_dimmer[0] && !(power&1)) {
|
||||
do_cmnd_power(1, 7); // No publishPowerState
|
||||
|
@ -272,10 +272,10 @@ void sl_prepPower(char *svalue, uint16_t ssvalue)
|
|||
mqtt_publishDomoticzPowerState(1);
|
||||
#endif // USE_DOMOTICZ
|
||||
if (sfl_flg > 1) {
|
||||
snprintf_P(svalue, ssvalue, PSTR("{\"POWER\":\"%s\", \"Dimmer\":%d, \"Color\":\"%s\"}"),
|
||||
snprintf_P(svalue, ssvalue, PSTR("{\"" D_RSLT_POWER "\":\"%s\", \"" D_CMND_DIMMER "\":%d, \"" D_CMND_COLOR "\":\"%s\"}"),
|
||||
getStateText(power &1), sysCfg.led_dimmer[0], sl_getColor(scolor));
|
||||
} else {
|
||||
snprintf_P(svalue, ssvalue, PSTR("{\"POWER\":\"%s\", \"Dimmer\":%d}"),
|
||||
snprintf_P(svalue, ssvalue, PSTR("{\"" D_RSLT_POWER "\":\"%s\", \"" D_CMND_DIMMER "\":%d}"),
|
||||
getStateText(power &1), sysCfg.led_dimmer[0]);
|
||||
}
|
||||
}
|
||||
|
@ -295,7 +295,7 @@ void sl_animate()
|
|||
char svalue[32]; // was MESSZ
|
||||
uint8_t fadeValue;
|
||||
uint8_t cur_col[5];
|
||||
|
||||
|
||||
if (0 == sl_power) { // Power Off
|
||||
for (byte i = 0; i < sfl_flg; i++) {
|
||||
sl_tcolor[i] = 0;
|
||||
|
@ -339,8 +339,8 @@ void sl_animate()
|
|||
sl_tcolor[i] = sl_dcolor[i];
|
||||
}
|
||||
} else {
|
||||
snprintf_P(svalue, sizeof(svalue), PSTR("{\"Wakeup\":\"Done\"}"));
|
||||
mqtt_publish_topic_P(2, PSTR("WAKEUP"), svalue);
|
||||
snprintf_P(svalue, sizeof(svalue), PSTR("{\"" D_CMND_WAKEUP "\":\"" D_DONE "\"}"));
|
||||
mqtt_publish_topic_P(2, PSTR(D_CMND_WAKEUP), svalue);
|
||||
sl_wakeupActive = 0;
|
||||
}
|
||||
}
|
||||
|
@ -375,7 +375,7 @@ void sl_animate()
|
|||
void sl_rgb2hsb(float *hue, float *sat, float *bri)
|
||||
{
|
||||
RgbColor dcolor;
|
||||
|
||||
|
||||
sl_setDim(sysCfg.led_dimmer[0]);
|
||||
dcolor.R = sl_dcolor[0];
|
||||
dcolor.G = sl_dcolor[1];
|
||||
|
@ -384,7 +384,7 @@ void sl_rgb2hsb(float *hue, float *sat, float *bri)
|
|||
*hue = hsb.H;
|
||||
*sat = hsb.S;
|
||||
*bri = hsb.B;
|
||||
}
|
||||
}
|
||||
|
||||
/********************************************************************************************/
|
||||
|
||||
|
@ -393,7 +393,7 @@ void sl_replaceHSB(String *response)
|
|||
float hue;
|
||||
float sat;
|
||||
float bri;
|
||||
|
||||
|
||||
if (sfl_flg > 2) {
|
||||
sl_rgb2hsb(&hue, &sat, &bri);
|
||||
response->replace("{h}", String((uint16_t)(65535.0f * hue)));
|
||||
|
@ -423,15 +423,15 @@ void sl_setHSB(float hue, float sat, float bri, uint16_t ct)
|
|||
{
|
||||
char svalue[MESSZ];
|
||||
HsbColor hsb;
|
||||
|
||||
|
||||
/*
|
||||
char log[LOGSZ];
|
||||
char stemp1[10];
|
||||
char stemp2[10];
|
||||
char stemp3[10];
|
||||
dtostrf(hue, 1, 3, stemp1);
|
||||
dtostrf(sat, 1, 3, stemp2);
|
||||
dtostrf(bri, 1, 3, stemp3);
|
||||
dtostrfi(hue, 3, stemp1);
|
||||
dtostrfi(sat, 3, stemp2);
|
||||
dtostrfi(bri, 3, stemp3);
|
||||
snprintf_P(log, sizeof(log), PSTR("HUE: Set Hue %s, Sat %s, Bri %s, Ct %d"), stemp1, stemp2, stemp3, ct);
|
||||
addLog(LOG_LEVEL_DEBUG, log);
|
||||
*/
|
||||
|
@ -450,7 +450,7 @@ void sl_setHSB(float hue, float sat, float bri, uint16_t ct)
|
|||
sl_setColor();
|
||||
}
|
||||
sl_prepPower(svalue, sizeof(svalue));
|
||||
mqtt_publish_topic_P(5, "COLOR", svalue);
|
||||
mqtt_publish_topic_P(5, PSTR(D_CMND_COLOR), svalue);
|
||||
} else {
|
||||
uint8_t tmp = (uint8_t)(bri * 100);
|
||||
sysCfg.led_dimmer[0] = tmp;
|
||||
|
@ -459,10 +459,10 @@ void sl_setHSB(float hue, float sat, float bri, uint16_t ct)
|
|||
sl_setColorTemp(ct);
|
||||
}
|
||||
sl_prepPower(svalue, sizeof(svalue));
|
||||
mqtt_publish_topic_P(5, "COLOR", svalue);
|
||||
mqtt_publish_topic_P(5, PSTR(D_CMND_COLOR), svalue);
|
||||
} else {
|
||||
sl_prepPower(svalue, sizeof(svalue));
|
||||
mqtt_publish_topic_P(5, "DIMMER", svalue);
|
||||
mqtt_publish_topic_P(5, PSTR(D_CMND_DIMMER), svalue);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -478,7 +478,7 @@ boolean sl_command(char *type, uint16_t index, char *dataBufUc, uint16_t data_le
|
|||
char scolor[11];
|
||||
char *p;
|
||||
|
||||
if ((sfl_flg > 1) && !strcmp_P(type,PSTR("COLOR"))) {
|
||||
if ((sfl_flg > 1) && !strcasecmp_P(type, PSTR(D_CMND_COLOR))) {
|
||||
if ((2 * sfl_flg) == data_len) {
|
||||
for (byte i = 0; i < sfl_flg; i++) {
|
||||
strlcpy(scolor, dataBufUc + (i *2), 3);
|
||||
|
@ -487,26 +487,26 @@ boolean sl_command(char *type, uint16_t index, char *dataBufUc, uint16_t data_le
|
|||
sl_setColor();
|
||||
coldim = true;
|
||||
} else {
|
||||
snprintf_P(svalue, ssvalue, PSTR("{\"Color\":\"%s\"}"), sl_getColor(scolor));
|
||||
snprintf_P(svalue, ssvalue, PSTR("{\"" D_CMND_COLOR "\":\"%s\"}"), sl_getColor(scolor));
|
||||
}
|
||||
}
|
||||
else if (!strcmp_P(type,PSTR("CT")) && ((2 == sfl_flg) || (5 == sfl_flg))) { // ColorTemp
|
||||
else if (!strcasecmp_P(type, PSTR(D_CMND_COLORTEMPERATURE)) && ((2 == sfl_flg) || (5 == sfl_flg))) { // ColorTemp
|
||||
if ((payload >= 153) && (payload <= 500)) { // https://developers.meethue.com/documentation/core-concepts
|
||||
sl_setColorTemp(payload);
|
||||
coldim = true;
|
||||
} else {
|
||||
snprintf_P(svalue, ssvalue, PSTR("{\"CT\":%d}"), sl_getColorTemp());
|
||||
snprintf_P(svalue, ssvalue, PSTR("{\"" D_CMND_COLORTEMPERATURE "\":%d}"), sl_getColorTemp());
|
||||
}
|
||||
}
|
||||
else if (!strcmp_P(type,PSTR("DIMMER"))) {
|
||||
else if (!strcasecmp_P(type, PSTR(D_CMND_DIMMER))) {
|
||||
if ((payload >= 0) && (payload <= 100)) {
|
||||
sysCfg.led_dimmer[0] = payload;
|
||||
coldim = true;
|
||||
} else {
|
||||
snprintf_P(svalue, ssvalue, PSTR("{\"Dimmer\":%d}"), sysCfg.led_dimmer[0]);
|
||||
snprintf_P(svalue, ssvalue, PSTR("{\"" D_CMND_DIMMER "\":%d}"), sysCfg.led_dimmer[0]);
|
||||
}
|
||||
}
|
||||
else if (!strcmp_P(type,PSTR("LEDTABLE"))) {
|
||||
else if (!strcasecmp_P(type, PSTR(D_CMND_LEDTABLE))) {
|
||||
if ((payload >= 0) && (payload <= 2)) {
|
||||
switch (payload) {
|
||||
case 0: // Off
|
||||
|
@ -519,9 +519,9 @@ boolean sl_command(char *type, uint16_t index, char *dataBufUc, uint16_t data_le
|
|||
}
|
||||
sl_any = 1;
|
||||
}
|
||||
snprintf_P(svalue, ssvalue, PSTR("{\"LedTable\":\"%s\"}"), getStateText(sysCfg.led_table));
|
||||
snprintf_P(svalue, ssvalue, PSTR("{\"" D_CMND_LEDTABLE "\":\"%s\"}"), getStateText(sysCfg.led_table));
|
||||
}
|
||||
else if (!strcmp_P(type,PSTR("FADE"))) {
|
||||
else if (!strcasecmp_P(type, PSTR(D_CMND_FADE))) {
|
||||
switch (payload) {
|
||||
case 0: // Off
|
||||
case 1: // On
|
||||
|
@ -531,25 +531,25 @@ boolean sl_command(char *type, uint16_t index, char *dataBufUc, uint16_t data_le
|
|||
sysCfg.led_fade ^= 1;
|
||||
break;
|
||||
}
|
||||
snprintf_P(svalue, ssvalue, PSTR("{\"Fade\":\"%s\"}"), getStateText(sysCfg.led_fade));
|
||||
snprintf_P(svalue, ssvalue, PSTR("{\"" D_CMND_FADE "\":\"%s\"}"), getStateText(sysCfg.led_fade));
|
||||
}
|
||||
else if (!strcmp_P(type,PSTR("SPEED"))) { // 1 - fast, 8 - slow
|
||||
else if (!strcasecmp_P(type, PSTR(D_CMND_SPEED))) { // 1 - fast, 8 - slow
|
||||
if ((payload > 0) && (payload <= 8)) {
|
||||
sysCfg.led_speed = payload;
|
||||
}
|
||||
snprintf_P(svalue, ssvalue, PSTR("{\"Speed\":%d}"), sysCfg.led_speed);
|
||||
snprintf_P(svalue, ssvalue, PSTR("{\"" D_CMND_SPEED "\":%d}"), sysCfg.led_speed);
|
||||
}
|
||||
else if (!strcmp_P(type,PSTR("WAKEUPDURATION"))) {
|
||||
else if (!strcasecmp_P(type, PSTR(D_CMND_WAKEUPDURATION))) {
|
||||
if ((payload > 0) && (payload < 3001)) {
|
||||
sysCfg.led_wakeup = payload;
|
||||
sl_wakeupActive = 0;
|
||||
}
|
||||
snprintf_P(svalue, ssvalue, PSTR("{\"WakeUpDuration\":%d}"), sysCfg.led_wakeup);
|
||||
snprintf_P(svalue, ssvalue, PSTR("{\"" D_CMND_WAKEUPDURATION "\":%d}"), sysCfg.led_wakeup);
|
||||
}
|
||||
else if (!strcmp_P(type,PSTR("WAKEUP"))) {
|
||||
else if (!strcasecmp_P(type, PSTR(D_CMND_WAKEUP))) {
|
||||
sl_wakeupActive = 3;
|
||||
do_cmnd_power(1, 1);
|
||||
snprintf_P(svalue, ssvalue, PSTR("{\"Wakeup\":\"Started\"}"));
|
||||
snprintf_P(svalue, ssvalue, PSTR("{\"" D_CMND_WAKEUP "\":\"" D_STARTED "\"}"));
|
||||
}
|
||||
else {
|
||||
serviced = false; // Unknown command
|
||||
|
|
|
@ -106,11 +106,10 @@ void sc_mqttPresent(char* svalue, uint16_t ssvalue, uint8_t* djson)
|
|||
char stemp2[10];
|
||||
|
||||
float t = convertTemp(sc_value[1]);
|
||||
dtostrf(t, 1, sysCfg.flag.temperature_resolution, stemp1);
|
||||
dtostrfd(t, sysCfg.flag.temperature_resolution, stemp1);
|
||||
float h = sc_value[0];
|
||||
dtostrf(h, 1, sysCfg.flag.humidity_resolution, stemp2);
|
||||
// snprintf_P(svalue, ssvalue, PSTR("%s, \"SC\":{\"Temperature\":%s, \"Humidity\":%s, \"Light\":%d, \"Noise\":%d, \"AirQuality\":%d}"),
|
||||
snprintf_P(svalue, ssvalue, PSTR("%s, \"Temperature\":%s, \"Humidity\":%s, \"Light\":%d, \"Noise\":%d, \"AirQuality\":%d"),
|
||||
dtostrfd(h, sysCfg.flag.humidity_resolution, stemp2);
|
||||
snprintf_P(svalue, ssvalue, PSTR("%s, \"" D_TEMPERATURE "\":%s, \"" D_HUMIDITY "\":%s, \"" D_LIGHT "\":%d, \"" D_NOISE "\":%d, \"" D_AIRQUALITY "\":%d"),
|
||||
svalue, stemp1, stemp2, sc_value[2], sc_value[3], sc_value[4]);
|
||||
*djson = 1;
|
||||
#ifdef USE_DOMOTICZ
|
||||
|
@ -131,11 +130,11 @@ String sc_webPresent()
|
|||
char scstype[] = "";
|
||||
|
||||
float t = convertTemp(sc_value[1]);
|
||||
dtostrf(t, 1, sysCfg.flag.temperature_resolution, stemp);
|
||||
dtostrfi(t, sysCfg.flag.temperature_resolution, stemp);
|
||||
snprintf_P(sensor, sizeof(sensor), HTTP_SNS_TEMP, scstype, stemp, tempUnit());
|
||||
page += sensor;
|
||||
float h = sc_value[0];
|
||||
dtostrf(h, 1, sysCfg.flag.humidity_resolution, stemp);
|
||||
dtostrfi(h, sysCfg.flag.humidity_resolution, stemp);
|
||||
snprintf_P(sensor, sizeof(sensor), HTTP_SNS_HUM, scstype, stemp);
|
||||
page += sensor;
|
||||
snprintf_P(sensor, sizeof(sensor), HTTP_SNS_LIGHT, scstype, sc_value[2]);
|
||||
|
|
|
@ -52,7 +52,7 @@ const char WEMO_MSEARCH[] PROGMEM =
|
|||
String wemo_serial()
|
||||
{
|
||||
char serial[16];
|
||||
|
||||
|
||||
snprintf_P(serial, sizeof(serial), PSTR("201612K%08X"), ESP.getChipId());
|
||||
return String(serial);
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ String wemo_serial()
|
|||
String wemo_UUID()
|
||||
{
|
||||
char uuid[27];
|
||||
|
||||
|
||||
snprintf_P(uuid, sizeof(uuid), PSTR("Socket-1_0-%s"), wemo_serial().c_str());
|
||||
return String(uuid);
|
||||
}
|
||||
|
@ -76,11 +76,11 @@ void wemo_respondToMSearch()
|
|||
response.replace("{r2}", wemo_UUID());
|
||||
portUDP.write(response.c_str());
|
||||
portUDP.endPacket();
|
||||
snprintf_P(message, sizeof(message), PSTR("Response sent"));
|
||||
snprintf_P(message, sizeof(message), PSTR(D_RESPONSE_SENT));
|
||||
} else {
|
||||
snprintf_P(message, sizeof(message), PSTR("Failed to send response"));
|
||||
snprintf_P(message, sizeof(message), PSTR(D_FAILED_TO_SEND_RESPONSE));
|
||||
}
|
||||
snprintf_P(log, sizeof(log), PSTR("UPnP: Wemo %s to %s:%d"),
|
||||
snprintf_P(log, sizeof(log), PSTR(D_LOG_UPNP D_WEMO " %s " D_TO " %s:%d"),
|
||||
message, portUDP.remoteIP().toString().c_str(), portUDP.remotePort());
|
||||
addLog(LOG_LEVEL_DEBUG, log);
|
||||
}
|
||||
|
@ -88,7 +88,7 @@ void wemo_respondToMSearch()
|
|||
/*********************************************************************************************\
|
||||
* Hue Bridge UPNP support routines
|
||||
* Need to send 3 response packets with varying ST and USN
|
||||
*
|
||||
*
|
||||
* Using Espressif Inc Mac Address of 5C:CF:7F:00:00:00
|
||||
* Philips Lighting is 00:17:88:00:00:00
|
||||
\*********************************************************************************************/
|
||||
|
@ -101,7 +101,7 @@ const char HUE_RESPONSE[] PROGMEM =
|
|||
"LOCATION: http://{r1}:80/description.xml\r\n"
|
||||
"SERVER: FreeRTOS/7.4.2 UPnP/1.0 IpBridge/1.16.0\r\n"
|
||||
"hue-bridgeid: {r2}\r\n";
|
||||
const char HUE_ST1[] PROGMEM =
|
||||
const char HUE_ST1[] PROGMEM =
|
||||
"ST: upnp:rootdevice\r\n"
|
||||
"USN: uuid:{r3}::upnp:rootdevice\r\n"
|
||||
"\r\n";
|
||||
|
@ -113,7 +113,7 @@ const char HUE_ST3[] PROGMEM =
|
|||
"ST: urn:schemas-upnp-org:device:Basic:1\r\n"
|
||||
"USN: uuid:{r3}\r\n"
|
||||
"\r\n";
|
||||
|
||||
|
||||
String hue_bridgeid()
|
||||
{
|
||||
String temp = WiFi.macAddress();
|
||||
|
@ -154,7 +154,7 @@ void hue_respondToMSearch()
|
|||
portUDP.endPacket();
|
||||
|
||||
//addLog(LOG_LEVEL_DEBUG_MORE, response.c_str());
|
||||
|
||||
|
||||
response = response1;
|
||||
response += FPSTR(HUE_ST2);
|
||||
response.replace("{r3}", hue_UUID());
|
||||
|
@ -162,7 +162,7 @@ void hue_respondToMSearch()
|
|||
portUDP.endPacket();
|
||||
|
||||
//addLog(LOG_LEVEL_DEBUG_MORE, response.c_str());
|
||||
|
||||
|
||||
response = response1;
|
||||
response += FPSTR(HUE_ST3);
|
||||
response.replace("{r3}", hue_UUID());
|
||||
|
@ -171,11 +171,11 @@ void hue_respondToMSearch()
|
|||
|
||||
//addLog(LOG_LEVEL_DEBUG_MORE, response.c_str());
|
||||
|
||||
snprintf_P(message, sizeof(message), PSTR("3 response packets sent"));
|
||||
snprintf_P(message, sizeof(message), PSTR(D_3_RESPONSE_PACKETS_SENT));
|
||||
} else {
|
||||
snprintf_P(message, sizeof(message), PSTR("Failed to send response"));
|
||||
snprintf_P(message, sizeof(message), PSTR(D_FAILED_TO_SEND_RESPONSE));
|
||||
}
|
||||
snprintf_P(log, sizeof(log), PSTR("UPnP: HUE %s to %s:%d"),
|
||||
snprintf_P(log, sizeof(log), PSTR(D_LOG_UPNP D_HUE " %s " D_TO " %s:%d"),
|
||||
message, portUDP.remoteIP().toString().c_str(), portUDP.remotePort());
|
||||
addLog(LOG_LEVEL_DEBUG, log);
|
||||
}
|
||||
|
@ -188,7 +188,7 @@ boolean UDP_Disconnect()
|
|||
{
|
||||
if (udpConnected) {
|
||||
WiFiUDP::stopAll();
|
||||
addLog_P(LOG_LEVEL_DEBUG, PSTR("UPnP: Multicast disabled"));
|
||||
addLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_UPNP D_MULTICAST_DISABLED));
|
||||
udpConnected = false;
|
||||
}
|
||||
return udpConnected;
|
||||
|
@ -198,10 +198,10 @@ boolean UDP_Connect()
|
|||
{
|
||||
if (!udpConnected) {
|
||||
if (portUDP.beginMulticast(WiFi.localIP(), ipMulticast, portMulticast)) {
|
||||
addLog_P(LOG_LEVEL_INFO, PSTR("UPnP: Multicast (re)joined"));
|
||||
addLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_UPNP D_MULTICAST_REJOINED));
|
||||
udpConnected = true;
|
||||
} else {
|
||||
addLog_P(LOG_LEVEL_INFO, PSTR("UPnP: Multicast join failed"));
|
||||
addLog_P(LOG_LEVEL_INFO, PSTR(D_LOG_UPNP D_MULTICAST_JOIN_FAILED));
|
||||
udpConnected = false;
|
||||
}
|
||||
}
|
||||
|
@ -300,13 +300,12 @@ const char WEMO_SETUP_XML[] PROGMEM =
|
|||
"</device>"
|
||||
"</root>\r\n"
|
||||
"\r\n";
|
||||
|
||||
|
||||
/********************************************************************************************/
|
||||
|
||||
void handleUPnPevent()
|
||||
{
|
||||
addLog_P(LOG_LEVEL_DEBUG, PSTR("HTTP: WeMo basic event"));
|
||||
|
||||
addLog_P(LOG_LEVEL_DEBUG, S_LOG_HTTP, PSTR(D_WEMO_BASIC_EVENT));
|
||||
String request = webServer->arg(0);
|
||||
if (request.indexOf(F("State>1</Binary")) > 0) {
|
||||
// do_cmnd_power(1, 1);
|
||||
|
@ -321,14 +320,13 @@ void handleUPnPevent()
|
|||
|
||||
void handleUPnPservice()
|
||||
{
|
||||
addLog_P(LOG_LEVEL_DEBUG, PSTR("HTTP: WeMo event service"));
|
||||
|
||||
addLog_P(LOG_LEVEL_DEBUG, S_LOG_HTTP, PSTR(D_WEMO_EVENT_SERVICE));
|
||||
webServer->send(200, FPSTR(HDR_CTYPE_PLAIN), FPSTR(WEMO_EVENTSERVICE_XML));
|
||||
}
|
||||
|
||||
void handleUPnPsetupWemo()
|
||||
{
|
||||
addLog_P(LOG_LEVEL_DEBUG, PSTR("HTTP: WeMo setup"));
|
||||
addLog_P(LOG_LEVEL_DEBUG, S_LOG_HTTP, PSTR(D_WEMO_SETUP));
|
||||
|
||||
String setup_xml = FPSTR(WEMO_SETUP_XML);
|
||||
setup_xml.replace("{x1}", sysCfg.friendlyname[0]);
|
||||
|
@ -432,8 +430,7 @@ String hue_userId()
|
|||
|
||||
void handleUPnPsetupHue()
|
||||
{
|
||||
addLog_P(LOG_LEVEL_DEBUG, PSTR("HTTP: Hue Bridge setup"));
|
||||
|
||||
addLog_P(LOG_LEVEL_DEBUG, S_LOG_HTTP, PSTR(D_HUE_BRIDGE_SETUP));
|
||||
String description_xml = FPSTR(HUE_DESCRIPTION_XML);
|
||||
description_xml.replace("{x1}", WiFi.localIP().toString());
|
||||
description_xml.replace("{x2}", hue_UUID());
|
||||
|
@ -444,8 +441,8 @@ void handleUPnPsetupHue()
|
|||
void hue_todo(String *path)
|
||||
{
|
||||
char log[LOGSZ];
|
||||
|
||||
snprintf_P(log, sizeof(log), PSTR("HTTP: HUE API not implemented (%s)"),path->c_str());
|
||||
|
||||
snprintf_P(log, sizeof(log), PSTR(D_LOG_HTTP D_HUE_API_NOT_IMPLEMENTED " (%s)"), path->c_str());
|
||||
addLog(LOG_LEVEL_DEBUG_MORE, log);
|
||||
|
||||
webServer->send(200, FPSTR(HDR_CTYPE_JSON), "{}");
|
||||
|
@ -474,7 +471,7 @@ void hue_light_status(byte device, String *response)
|
|||
{
|
||||
*response += FPSTR(HUE_LIGHT_STATUS_JSON);
|
||||
response->replace("{state}", (power & (0x01 << (device-1))) ? "true" : "false");
|
||||
|
||||
|
||||
if (sfl_flg) {
|
||||
sl_replaceHSB(response);
|
||||
#ifdef USE_WS2812
|
||||
|
@ -500,9 +497,9 @@ void hue_global_cfg(String *path)
|
|||
response += F("\":{\"state\":{");
|
||||
hue_light_status(i, &response);
|
||||
response += "},";
|
||||
response += FPSTR(HUE_LIGHTS_STATUS_JSON);
|
||||
response += FPSTR(HUE_LIGHTS_STATUS_JSON);
|
||||
response.replace("{j1}", sysCfg.friendlyname[i-1]);
|
||||
response.replace("{j2}", hue_deviceId(i));
|
||||
response.replace("{j2}", hue_deviceId(i));
|
||||
if (i < Maxdevice) {
|
||||
response += ",\"";
|
||||
}
|
||||
|
@ -516,7 +513,7 @@ void hue_global_cfg(String *path)
|
|||
void hue_auth(String *path)
|
||||
{
|
||||
char response[38];
|
||||
|
||||
|
||||
snprintf_P(response, sizeof(response), PSTR("[{\"success\":{\"username\":\"%s\"}}]"), hue_userId().c_str());
|
||||
webServer->send(200, FPSTR(HDR_CTYPE_JSON), response);
|
||||
}
|
||||
|
@ -547,9 +544,9 @@ void hue_lights(String *path)
|
|||
response += F("\":{\"state\":{");
|
||||
hue_light_status(i, &response);
|
||||
response += "},";
|
||||
response += FPSTR(HUE_LIGHTS_STATUS_JSON);
|
||||
response += FPSTR(HUE_LIGHTS_STATUS_JSON);
|
||||
response.replace("{j1}", sysCfg.friendlyname[i-1]);
|
||||
response.replace("{j2}", hue_deviceId(i));
|
||||
response.replace("{j2}", hue_deviceId(i));
|
||||
if (i < Maxdevice) {
|
||||
response += ",\"";
|
||||
}
|
||||
|
@ -570,11 +567,11 @@ void hue_lights(String *path)
|
|||
StaticJsonBuffer<400> jsonBuffer;
|
||||
JsonObject &hue_json = jsonBuffer.parseObject(webServer->arg(0));
|
||||
if (hue_json.containsKey("on")) {
|
||||
|
||||
|
||||
response += FPSTR(HUE_LIGHT_RESPONSE_JSON);
|
||||
response.replace("{id}", String(device));
|
||||
response.replace("{cmd}", "on");
|
||||
|
||||
|
||||
on = hue_json["on"];
|
||||
switch(on)
|
||||
{
|
||||
|
@ -589,7 +586,7 @@ void hue_lights(String *path)
|
|||
}
|
||||
resp = true;
|
||||
}
|
||||
|
||||
|
||||
if (sfl_flg) {
|
||||
sl_getHSB(&hue,&sat,&bri);
|
||||
#ifdef USE_WS2812
|
||||
|
@ -663,13 +660,13 @@ void hue_lights(String *path)
|
|||
if (2 == response.length()) {
|
||||
response = FPSTR(HUE_ERROR_JSON);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
response = FPSTR(HUE_ERROR_JSON);
|
||||
}
|
||||
|
||||
//addLog(LOG_LEVEL_DEBUG_MORE, response.c_str());
|
||||
|
||||
|
||||
webServer->send(200, FPSTR(HDR_CTYPE_JSON), response);
|
||||
}
|
||||
else if(path->indexOf("/lights/") >= 0) { // Got /lights/ID
|
||||
|
@ -681,7 +678,7 @@ void hue_lights(String *path)
|
|||
response += F("{\"state\":{");
|
||||
hue_light_status(device, &response);
|
||||
response += "},";
|
||||
response += FPSTR(HUE_LIGHTS_STATUS_JSON);
|
||||
response += FPSTR(HUE_LIGHTS_STATUS_JSON);
|
||||
response.replace("{j1}", sysCfg.friendlyname[device-1]);
|
||||
response.replace("{j2}", hue_deviceId(device));
|
||||
webServer->send(200, FPSTR(HDR_CTYPE_JSON), response);
|
||||
|
@ -693,11 +690,11 @@ void hue_lights(String *path)
|
|||
|
||||
void hue_groups(String *path)
|
||||
{
|
||||
/*
|
||||
/*
|
||||
* http://sonoff/api/username/groups?1={"name":"Woonkamer","lights":[],"type":"Room","class":"Living room"})
|
||||
*/
|
||||
String response = "{}";
|
||||
|
||||
|
||||
if (path->endsWith("/0")) {
|
||||
response = FPSTR(HUE_GROUP0_STATUS_JSON);
|
||||
String lights = F("\"1\"");
|
||||
|
@ -708,7 +705,7 @@ void hue_groups(String *path)
|
|||
hue_light_status(1, &response);
|
||||
response += F("}}");
|
||||
}
|
||||
|
||||
|
||||
webServer->send(200, FPSTR(HDR_CTYPE_JSON), response);
|
||||
}
|
||||
|
||||
|
@ -716,31 +713,31 @@ void handle_hue_api(String *path)
|
|||
{
|
||||
/* HUE API uses /api/<userid>/<command> syntax. The userid is created by the echo device and
|
||||
* on original HUE the pressed button allows for creation of this user. We simply ignore the
|
||||
* user part and allow every caller as with Web or WeMo.
|
||||
* user part and allow every caller as with Web or WeMo.
|
||||
*
|
||||
* (c) Heiko Krupp, 2017
|
||||
*/
|
||||
|
||||
|
||||
char log[LOGSZ];
|
||||
uint8_t args = 0;
|
||||
|
||||
path->remove(0, 4); // remove /api
|
||||
uint16_t apilen = path->length();
|
||||
snprintf_P(log, sizeof(log), PSTR("HTTP: Hue API (%s)"), path->c_str());
|
||||
snprintf_P(log, sizeof(log), PSTR(D_LOG_HTTP D_HUE_API " (%s)"), path->c_str());
|
||||
addLog(LOG_LEVEL_DEBUG_MORE, log);
|
||||
for (args = 0; args < webServer->args(); args++) {
|
||||
String json = webServer->arg(args);
|
||||
snprintf_P(log, sizeof(log), PSTR("HTTP: Hue POST args (%s)"), json.c_str());
|
||||
snprintf_P(log, sizeof(log), PSTR(D_LOG_HTTP D_HUE_POST_ARGS " (%s)"), json.c_str());
|
||||
addLog(LOG_LEVEL_DEBUG_MORE, log);
|
||||
}
|
||||
|
||||
|
||||
if (path->endsWith("/invalid/")) {} // Just ignore
|
||||
else if (!apilen) hue_auth(path); // New HUE App setup
|
||||
else if (path->endsWith("/")) hue_auth(path); // New HUE App setup
|
||||
else if (path->endsWith("/config")) hue_config(path);
|
||||
else if (path->indexOf("/lights") >= 0) hue_lights(path);
|
||||
else if (path->indexOf("/groups") >= 0) hue_groups(path);
|
||||
else if (path->endsWith("/schedules")) hue_todo(path);
|
||||
else if (path->indexOf("/groups") >= 0) hue_groups(path);
|
||||
else if (path->endsWith("/schedules")) hue_todo(path);
|
||||
else if (path->endsWith("/sensors")) hue_todo(path);
|
||||
else if (path->endsWith("/scenes")) hue_todo(path);
|
||||
else if (path->endsWith("/rules")) hue_todo(path);
|
||||
|
|
|
@ -63,19 +63,19 @@ ColorScheme schemes[7] = {
|
|||
rainbow, 7,
|
||||
fire, 3 };
|
||||
|
||||
uint8_t widthValues[5] = {
|
||||
uint8_t widthValues[5] = {
|
||||
1, // Small
|
||||
2, // Medium
|
||||
4, // Large
|
||||
8, // Largest
|
||||
255 }; // All
|
||||
uint8_t repeatValues[5] = {
|
||||
uint8_t repeatValues[5] = {
|
||||
8, // Small
|
||||
6, // Medium
|
||||
4, // Large
|
||||
2, // Largest
|
||||
1 }; // All
|
||||
uint8_t speedValues[6] = {
|
||||
uint8_t speedValues[6] = {
|
||||
0, // None
|
||||
9 * (STATES / 10), // Slowest
|
||||
7 * (STATES / 10), // Slower
|
||||
|
@ -108,8 +108,8 @@ void ws2812_setColor(uint16_t led, char* colstr)
|
|||
{
|
||||
HtmlColor hcolor;
|
||||
char log[LOGSZ];
|
||||
char lcolstr[8];
|
||||
|
||||
char lcolstr[8];
|
||||
|
||||
snprintf_P(lcolstr, sizeof(lcolstr), PSTR("#%s"), colstr);
|
||||
uint8_t result = hcolor.Parse<HtmlColorNames>((char *)lcolstr, 7);
|
||||
if (result) {
|
||||
|
@ -121,7 +121,7 @@ void ws2812_setColor(uint16_t led, char* colstr)
|
|||
|
||||
// snprintf_P(log, sizeof(log), PSTR("DBG: Red %02X, Green %02X, Blue %02X"), dcolor.R, dcolor.G, dcolor.B);
|
||||
// addLog(LOG_LEVEL_DEBUG, log);
|
||||
|
||||
|
||||
uint16_t temp = dcolor.R;
|
||||
if (temp < dcolor.G) {
|
||||
temp = dcolor.G;
|
||||
|
@ -131,7 +131,7 @@ void ws2812_setColor(uint16_t led, char* colstr)
|
|||
}
|
||||
float mDim = (float)temp / 2.55;
|
||||
sysCfg.ws_dimmer = (uint8_t)mDim;
|
||||
|
||||
|
||||
float newDim = 100 / mDim;
|
||||
float fmyRed = (float)dcolor.R * newDim;
|
||||
float fmyGrn = (float)dcolor.G * newDim;
|
||||
|
@ -149,14 +149,14 @@ void ws2812_getColor(uint16_t led, char* svalue, uint16_t ssvalue)
|
|||
{
|
||||
RgbColor mcolor;
|
||||
char stemp[20];
|
||||
|
||||
|
||||
if (led) {
|
||||
mcolor = strip->GetPixelColor(led -1);
|
||||
snprintf_P(stemp, sizeof(stemp), PSTR("Led%d"), led);
|
||||
snprintf_P(stemp, sizeof(stemp), PSTR(D_CMND_LED "%d"), led);
|
||||
} else {
|
||||
ws2812_setDim(sysCfg.ws_dimmer);
|
||||
mcolor = dcolor;
|
||||
snprintf_P(stemp, sizeof(stemp), PSTR("Color"));
|
||||
snprintf_P(stemp, sizeof(stemp), PSTR(D_CMND_COLOR));
|
||||
}
|
||||
uint32_t color = (uint32_t)mcolor.R << 16;
|
||||
color += (uint32_t)mcolor.G << 8;
|
||||
|
@ -166,7 +166,7 @@ void ws2812_getColor(uint16_t led, char* svalue, uint16_t ssvalue)
|
|||
|
||||
void ws2812_stripShow()
|
||||
{
|
||||
RgbColor c;
|
||||
RgbColor c;
|
||||
|
||||
if (sysCfg.ws_ledtable) {
|
||||
for (uint16_t i = 0; i < sysCfg.ws_pixels; i++) {
|
||||
|
@ -200,7 +200,7 @@ int mod(int a, int b)
|
|||
void ws2812_clock()
|
||||
{
|
||||
RgbColor c;
|
||||
|
||||
|
||||
strip->ClearTo(0); // Reset strip
|
||||
float newDim = 100 / (float)sysCfg.ws_dimmer;
|
||||
float f1 = 255 / newDim;
|
||||
|
@ -255,7 +255,7 @@ void ws2812_gradientColor(struct wsColor* mColor, uint16_t range, uint16_t gradR
|
|||
|
||||
void ws2812_gradient()
|
||||
{
|
||||
/*
|
||||
/*
|
||||
* This routine courtesy Tony DiCola (Adafruit)
|
||||
* Display a gradient of colors for the current color scheme.
|
||||
* Repeat is the number of repetitions of the gradient (pick a multiple of 2 for smooth looping of the gradient).
|
||||
|
@ -299,7 +299,7 @@ void ws2812_gradient()
|
|||
|
||||
void ws2812_bars()
|
||||
{
|
||||
/*
|
||||
/*
|
||||
* This routine courtesy Tony DiCola (Adafruit)
|
||||
* Display solid bars of color for the current color scheme.
|
||||
* Width is the width of each bar in pixels/lights.
|
||||
|
@ -344,7 +344,7 @@ void ws2812_animate()
|
|||
{
|
||||
char log[LOGSZ];
|
||||
uint8_t fadeValue;
|
||||
|
||||
|
||||
stripTimerCntr++;
|
||||
if (0 == bitRead(power, ws_bit)) { // Power Off
|
||||
sleep = sysCfg.sleep;
|
||||
|
@ -428,7 +428,7 @@ void ws2812_animate()
|
|||
|
||||
if (sysCfg.ws_ledtable) {
|
||||
for (uint16_t i = 0; i < sysCfg.ws_pixels; i++) {
|
||||
strip->SetPixelColor(i, RgbColor(ledTable[lcolor.R],ledTable[lcolor.G],ledTable[lcolor.B]));
|
||||
strip->SetPixelColor(i, RgbColor(ledTable[lcolor.R],ledTable[lcolor.G],ledTable[lcolor.B]));
|
||||
}
|
||||
} else {
|
||||
for (uint16_t i = 0; i < sysCfg.ws_pixels; i++) {
|
||||
|
@ -498,7 +498,7 @@ void ws2812_getHSB(float *hue, float *sat, float *bri)
|
|||
void ws2812_setHSB(float hue, float sat, float bri)
|
||||
{
|
||||
char rgb[7];
|
||||
|
||||
|
||||
HsbColor hsb;
|
||||
hsb.H = hue;
|
||||
hsb.S = sat;
|
||||
|
@ -516,27 +516,27 @@ boolean ws2812_command(char *type, uint16_t index, char *dataBuf, uint16_t data_
|
|||
{
|
||||
boolean serviced = true;
|
||||
|
||||
if (!strcmp_P(type,PSTR("PIXELS"))) {
|
||||
if (!strcasecmp_P(type, PSTR(D_CMND_PIXELS))) {
|
||||
if ((payload > 0) && (payload <= WS2812_MAX_LEDS)) {
|
||||
sysCfg.ws_pixels = payload;
|
||||
ws2812_pixels();
|
||||
}
|
||||
snprintf_P(svalue, ssvalue, PSTR("{\"Pixels\":%d}"), sysCfg.ws_pixels);
|
||||
snprintf_P(svalue, ssvalue, PSTR("{\"" D_CMND_PIXELS "\":%d}"), sysCfg.ws_pixels);
|
||||
}
|
||||
else if (!strcmp_P(type,PSTR("LED")) && (index > 0) && (index <= sysCfg.ws_pixels)) {
|
||||
else if (!strcasecmp_P(type, PSTR(D_CMND_LED)) && (index > 0) && (index <= sysCfg.ws_pixels)) {
|
||||
if (6 == data_len) {
|
||||
ws2812_setColor(index, dataBuf);
|
||||
}
|
||||
ws2812_getColor(index, svalue, ssvalue);
|
||||
}
|
||||
else if (!strcmp_P(type,PSTR("COLOR"))) {
|
||||
else if (!strcasecmp_P(type, PSTR(D_CMND_COLOR))) {
|
||||
if (6 == data_len) {
|
||||
ws2812_setColor(0, dataBuf);
|
||||
bitSet(power, ws_bit);
|
||||
}
|
||||
ws2812_getColor(0, svalue, ssvalue);
|
||||
}
|
||||
else if (!strcmp_P(type,PSTR("DIMMER"))) {
|
||||
else if (!strcasecmp_P(type, PSTR(D_CMND_DIMMER))) {
|
||||
if ((payload >= 0) && (payload <= 100)) {
|
||||
sysCfg.ws_dimmer = payload;
|
||||
bitSet(power, ws_bit);
|
||||
|
@ -545,9 +545,9 @@ boolean ws2812_command(char *type, uint16_t index, char *dataBuf, uint16_t data_
|
|||
mqtt_publishDomoticzPowerState(ws_bit +1);
|
||||
#endif // USE_DOMOTICZ
|
||||
}
|
||||
snprintf_P(svalue, ssvalue, PSTR("{\"Dimmer\":%d}"), sysCfg.ws_dimmer);
|
||||
snprintf_P(svalue, ssvalue, PSTR("{\"" D_CMND_DIMMER "\":%d}"), sysCfg.ws_dimmer);
|
||||
}
|
||||
else if (!strcmp_P(type,PSTR("LEDTABLE"))) {
|
||||
else if (!strcasecmp_P(type, PSTR(D_CMND_LEDTABLE))) {
|
||||
if ((payload >= 0) && (payload <= 2)) {
|
||||
switch (payload) {
|
||||
case 0: // Off
|
||||
|
@ -560,9 +560,9 @@ boolean ws2812_command(char *type, uint16_t index, char *dataBuf, uint16_t data_
|
|||
}
|
||||
ws2812_update();
|
||||
}
|
||||
snprintf_P(svalue, ssvalue, PSTR("{\"LedTable\":\"%s\"}"), getStateText(sysCfg.ws_ledtable));
|
||||
snprintf_P(svalue, ssvalue, PSTR("{\"" D_CMND_LEDTABLE "\":\"%s\"}"), getStateText(sysCfg.ws_ledtable));
|
||||
}
|
||||
else if (!strcmp_P(type,PSTR("FADE"))) {
|
||||
else if (!strcasecmp_P(type, PSTR(D_CMND_FADE))) {
|
||||
switch (payload) {
|
||||
case 0: // Off
|
||||
case 1: // On
|
||||
|
@ -572,30 +572,30 @@ boolean ws2812_command(char *type, uint16_t index, char *dataBuf, uint16_t data_
|
|||
sysCfg.ws_fade ^= 1;
|
||||
break;
|
||||
}
|
||||
snprintf_P(svalue, ssvalue, PSTR("{\"Fade\":\"%s\"}"), getStateText(sysCfg.ws_fade));
|
||||
snprintf_P(svalue, ssvalue, PSTR("{\"" D_CMND_FADE "\":\"%s\"}"), getStateText(sysCfg.ws_fade));
|
||||
}
|
||||
else if (!strcmp_P(type,PSTR("SPEED"))) { // 1 - fast, 5 - slow
|
||||
else if (!strcasecmp_P(type, PSTR(D_CMND_SPEED))) { // 1 - fast, 5 - slow
|
||||
if ((payload > 0) && (payload <= 5)) {
|
||||
sysCfg.ws_speed = payload;
|
||||
}
|
||||
snprintf_P(svalue, ssvalue, PSTR("{\"Speed\":%d}"), sysCfg.ws_speed);
|
||||
snprintf_P(svalue, ssvalue, PSTR("{\"" D_CMND_SPEED "\":%d}"), sysCfg.ws_speed);
|
||||
}
|
||||
else if (!strcmp_P(type,PSTR("WIDTH"))) {
|
||||
else if (!strcasecmp_P(type, PSTR(D_CMND_WIDTH))) {
|
||||
if ((payload >= 0) && (payload <= 4)) {
|
||||
sysCfg.ws_width = payload;
|
||||
}
|
||||
snprintf_P(svalue, ssvalue, PSTR("{\"Width\":%d}"), sysCfg.ws_width);
|
||||
snprintf_P(svalue, ssvalue, PSTR("{\"" D_CMND_WIDTH "\":%d}"), sysCfg.ws_width);
|
||||
}
|
||||
else if (!strcmp_P(type,PSTR("WAKEUP"))) {
|
||||
else if (!strcasecmp_P(type, PSTR(D_CMND_WAKEUP))) {
|
||||
if ((payload > 0) && (payload < 3001)) {
|
||||
sysCfg.ws_wakeup = payload;
|
||||
if (1 == sysCfg.ws_scheme) {
|
||||
sysCfg.ws_scheme = 0;
|
||||
}
|
||||
}
|
||||
snprintf_P(svalue, ssvalue, PSTR("{\"WakeUp\":%d}"), sysCfg.ws_wakeup);
|
||||
snprintf_P(svalue, ssvalue, PSTR("{\"" D_CMND_WAKEUP "\":%d}"), sysCfg.ws_wakeup);
|
||||
}
|
||||
else if (!strcmp_P(type,PSTR("SCHEME"))) {
|
||||
else if (!strcasecmp_P(type, PSTR(D_CMND_SCHEME))) {
|
||||
if ((payload >= 0) && (payload <= 9)) {
|
||||
sysCfg.ws_scheme = payload;
|
||||
if (1 == sysCfg.ws_scheme) {
|
||||
|
@ -604,7 +604,7 @@ boolean ws2812_command(char *type, uint16_t index, char *dataBuf, uint16_t data_
|
|||
bitSet(power, ws_bit);
|
||||
ws2812_resetStripTimer();
|
||||
}
|
||||
snprintf_P(svalue, ssvalue, PSTR("{\"Scheme\":%d}"), sysCfg.ws_scheme);
|
||||
snprintf_P(svalue, ssvalue, PSTR("{\"" D_CMND_SCHEME "\":%d}"), sysCfg.ws_scheme);
|
||||
}
|
||||
else if (!strcmp_P(type,PSTR("UNDOCA"))) { // Theos WS2812 legacy status
|
||||
RgbColor mcolor;
|
||||
|
|
|
@ -67,7 +67,7 @@ boolean bh1750_detect()
|
|||
strcpy(bh1750stype, "BH1750");
|
||||
}
|
||||
if (success) {
|
||||
snprintf_P(log, sizeof(log), PSTR("I2C: %s found at address 0x%x"), bh1750stype, bh1750addr);
|
||||
snprintf_P(log, sizeof(log), PSTR(D_LOG_I2C "%s " D_FOUND_AT " 0x%x"), bh1750stype, bh1750addr);
|
||||
addLog(LOG_LEVEL_DEBUG, log);
|
||||
} else {
|
||||
bh1750type = 0;
|
||||
|
@ -86,7 +86,7 @@ void bh1750_mqttPresent(char* svalue, uint16_t ssvalue, uint8_t* djson)
|
|||
}
|
||||
|
||||
uint16_t l = bh1750_readLux();
|
||||
snprintf_P(svalue, ssvalue, PSTR("%s, \"%s\":{\"Illuminance\":%d}"), svalue, bh1750stype, l);
|
||||
snprintf_P(svalue, ssvalue, PSTR("%s, \"%s\":{\"" D_ILLUMINANCE "\":%d}"), svalue, bh1750stype, l);
|
||||
*djson = 1;
|
||||
#ifdef USE_DOMOTICZ
|
||||
domoticz_sensor5(l);
|
||||
|
@ -95,7 +95,7 @@ void bh1750_mqttPresent(char* svalue, uint16_t ssvalue, uint8_t* djson)
|
|||
|
||||
#ifdef USE_WEBSERVER
|
||||
const char HTTP_SNS_ILLUMINANCE[] PROGMEM =
|
||||
"<tr><th>BH1750 Illuminance</th><td>%d lx</td></tr>";
|
||||
"<tr><th>BH1750 " D_ILLUMINANCE "</th><td>%d lx</td></tr>";
|
||||
|
||||
String bh1750_webPresent()
|
||||
{
|
||||
|
|
|
@ -348,7 +348,7 @@ double bme280_readHumidity(void)
|
|||
double bmp_readTemperature(void)
|
||||
{
|
||||
double t = NAN;
|
||||
|
||||
|
||||
switch (bmptype) {
|
||||
case BMP180_CHIPID:
|
||||
t = bmp180_readTemperature();
|
||||
|
@ -418,7 +418,7 @@ boolean bmp_detect()
|
|||
strcpy_P(bmpstype, PSTR("BME280"));
|
||||
}
|
||||
if (success) {
|
||||
snprintf_P(log, sizeof(log), PSTR("I2C: %s found at address 0x%x"), bmpstype, bmpaddr);
|
||||
snprintf_P(log, sizeof(log), PSTR(D_LOG_I2C "%s " D_FOUND_AT " 0x%x"), bmpstype, bmpaddr);
|
||||
addLog(LOG_LEVEL_DEBUG, log);
|
||||
} else {
|
||||
bmptype = 0;
|
||||
|
@ -443,19 +443,19 @@ void bmp_mqttPresent(char* svalue, uint16_t ssvalue, uint8_t* djson)
|
|||
double t = bmp_readTemperature();
|
||||
double p = bmp_readPressure();
|
||||
double h = bmp_readHumidity();
|
||||
dtostrf(t, 1, sysCfg.flag.temperature_resolution, stemp1);
|
||||
dtostrf(p, 1, sysCfg.flag.pressure_resolution, stemp2);
|
||||
dtostrf(h, 1, sysCfg.flag.humidity_resolution, stemp3);
|
||||
dtostrfd(t, sysCfg.flag.temperature_resolution, stemp1);
|
||||
dtostrfd(p, sysCfg.flag.pressure_resolution, stemp2);
|
||||
dtostrfd(h, sysCfg.flag.humidity_resolution, stemp3);
|
||||
if (!strcmp(bmpstype,"BME280")) {
|
||||
snprintf_P(svalue, ssvalue, PSTR("%s, \"%s\":{\"Temperature\":%s, \"Humidity\":%s, \"Pressure\":%s}"),
|
||||
snprintf_P(svalue, ssvalue, PSTR("%s, \"%s\":{\"" D_TEMPERATURE "\":%s, \"" D_HUMIDITY "\":%s, \"" D_PRESSURE "\":%s}"),
|
||||
svalue, bmpstype, stemp1, stemp3, stemp2);
|
||||
} else {
|
||||
snprintf_P(svalue, ssvalue, PSTR("%s, \"%s\":{\"Temperature\":%s, \"Pressure\":%s}"),
|
||||
snprintf_P(svalue, ssvalue, PSTR("%s, \"%s\":{\"" D_TEMPERATURE "\":%s, \"" D_PRESSURE "\":%s}"),
|
||||
svalue, bmpstype, stemp1, stemp2);
|
||||
}
|
||||
*djson = 1;
|
||||
#ifdef USE_DOMOTICZ
|
||||
domoticz_sensor3(stemp1, stemp3, stemp2);
|
||||
domoticz_sensor3(stemp1, stemp3, stemp2);
|
||||
#endif // USE_DOMOTICZ
|
||||
}
|
||||
|
||||
|
@ -470,15 +470,15 @@ String bmp_webPresent()
|
|||
double t_bmp = bmp_readTemperature();
|
||||
double p_bmp = bmp_readPressure();
|
||||
double h_bmp = bmp_readHumidity();
|
||||
dtostrf(t_bmp, 1, sysCfg.flag.temperature_resolution, stemp);
|
||||
dtostrfi(t_bmp, sysCfg.flag.temperature_resolution, stemp);
|
||||
snprintf_P(sensor, sizeof(sensor), HTTP_SNS_TEMP, bmpstype, stemp, tempUnit());
|
||||
page += sensor;
|
||||
if (!strcmp(bmpstype,"BME280")) {
|
||||
dtostrf(h_bmp, 1, sysCfg.flag.humidity_resolution, stemp);
|
||||
dtostrfi(h_bmp, sysCfg.flag.humidity_resolution, stemp);
|
||||
snprintf_P(sensor, sizeof(sensor), HTTP_SNS_HUM, bmpstype, stemp);
|
||||
page += sensor;
|
||||
}
|
||||
dtostrf(p_bmp, 1, sysCfg.flag.pressure_resolution, stemp);
|
||||
dtostrfi(p_bmp, sysCfg.flag.pressure_resolution, stemp);
|
||||
snprintf_P(sensor, sizeof(sensor), HTTP_SNS_PRESSURE, bmpstype, stemp);
|
||||
page += sensor;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
xsns_counter.ino - Counter sensors (water meters, electricity meters etc.) sensor support for Sonoff-Tasmota
|
||||
xsns_counter.ino - Counter sensors (water meters, electricity meters etc.) sensor support for Sonoff-Tasmota
|
||||
|
||||
Copyright (C) 2017 Maarten Damen and Theo Arends
|
||||
|
||||
|
@ -74,7 +74,7 @@ void counter_init()
|
|||
{
|
||||
typedef void (*function) () ;
|
||||
function counter_callbacks[] = { counter_update1, counter_update2, counter_update3, counter_update4 };
|
||||
|
||||
|
||||
for (byte i = 0; i < MAX_COUNTERS; i++) {
|
||||
if (pin[GPIO_CNTR1 +i] < 99) {
|
||||
pinMode(pin[GPIO_CNTR1 +i], INPUT_PULLUP);
|
||||
|
@ -95,12 +95,12 @@ void counter_mqttPresent(char* svalue, uint16_t ssvalue, uint8_t* djson)
|
|||
for (byte i = 0; i < MAX_COUNTERS; i++) {
|
||||
if (pin[GPIO_CNTR1 +i] < 99) {
|
||||
if (bitRead(sysCfg.pCounterType, i)) {
|
||||
dtostrf((double)rtcMem.pCounter[i] / 1000, 1, 3, stemp);
|
||||
dtostrfd((double)rtcMem.pCounter[i] / 1000, 3, stemp);
|
||||
} else {
|
||||
dsxflg++;
|
||||
dtostrf(rtcMem.pCounter[i], 1, 0, stemp);
|
||||
dtostrfd(rtcMem.pCounter[i], 0, stemp);
|
||||
}
|
||||
snprintf_P(svalue, ssvalue, PSTR("%s, \"Counter%d\":%s"), svalue, i +1, stemp);
|
||||
snprintf_P(svalue, ssvalue, PSTR("%s, \"" D_COUNTER "%d\":%s"), svalue, i +1, stemp);
|
||||
*djson = 1;
|
||||
#ifdef USE_DOMOTICZ
|
||||
if (1 == dsxflg) {
|
||||
|
@ -114,7 +114,7 @@ void counter_mqttPresent(char* svalue, uint16_t ssvalue, uint8_t* djson)
|
|||
|
||||
#ifdef USE_WEBSERVER
|
||||
const char HTTP_SNS_COUNTER[] PROGMEM =
|
||||
"<tr><th>Counter%d</th><td>%s%s</td></tr>";
|
||||
"<tr><th>" D_COUNTER "%d</th><td>%s%s</td></tr>";
|
||||
|
||||
String counter_webPresent()
|
||||
{
|
||||
|
@ -125,11 +125,11 @@ String counter_webPresent()
|
|||
for (byte i = 0; i < MAX_COUNTERS; i++) {
|
||||
if (pin[GPIO_CNTR1 +i] < 99) {
|
||||
if (bitRead(sysCfg.pCounterType, i)) {
|
||||
dtostrf((double)rtcMem.pCounter[i] / 1000, 1, 3, stemp);
|
||||
dtostrfi((double)rtcMem.pCounter[i] / 1000, 3, stemp);
|
||||
} else {
|
||||
dtostrf(rtcMem.pCounter[i], 1, 0, stemp);
|
||||
dtostrfi(rtcMem.pCounter[i], 0, stemp);
|
||||
}
|
||||
snprintf_P(sensor, sizeof(sensor), HTTP_SNS_COUNTER, i+1, stemp, (bitRead(sysCfg.pCounterType, i)) ? " Sec" : "");
|
||||
snprintf_P(sensor, sizeof(sensor), HTTP_SNS_COUNTER, i+1, stemp, (bitRead(sysCfg.pCounterType, i)) ? " " D_UNIT_SECOND : "");
|
||||
page += sensor;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -88,12 +88,12 @@ boolean dht_read(byte sensor)
|
|||
pinMode(dht[sensor].pin, INPUT_PULLUP);
|
||||
delayMicroseconds(10);
|
||||
if (0 == dht_expectPulse(sensor, LOW)) {
|
||||
addLog_P(LOG_LEVEL_DEBUG, PSTR("DHT: Timeout waiting for start signal low pulse"));
|
||||
addLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_DHT D_TIMEOUT_WAITING_FOR " " D_START_SIGNAL_LOW " " D_PULSE));
|
||||
dht[sensor].lastresult = false;
|
||||
return dht[sensor].lastresult;
|
||||
}
|
||||
if (0 == dht_expectPulse(sensor, HIGH)) {
|
||||
addLog_P(LOG_LEVEL_DEBUG, PSTR("DHT: Timeout waiting for start signal high pulse"));
|
||||
addLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_DHT D_TIMEOUT_WAITING_FOR " " D_START_SIGNAL_HIGH " " D_PULSE));
|
||||
dht[sensor].lastresult = false;
|
||||
return dht[sensor].lastresult;
|
||||
}
|
||||
|
@ -107,7 +107,7 @@ boolean dht_read(byte sensor)
|
|||
uint32_t lowCycles = cycles[2*i];
|
||||
uint32_t highCycles = cycles[2*i+1];
|
||||
if ((0 == lowCycles) || (0 == highCycles)) {
|
||||
addLog_P(LOG_LEVEL_DEBUG, PSTR("DHT: Timeout waiting for pulse"));
|
||||
addLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_DHT D_TIMEOUT_WAITING_FOR " " D_PULSE));
|
||||
dht[sensor].lastresult = false;
|
||||
return dht[sensor].lastresult;
|
||||
}
|
||||
|
@ -117,14 +117,14 @@ boolean dht_read(byte sensor)
|
|||
}
|
||||
}
|
||||
|
||||
snprintf_P(log, sizeof(log), PSTR("DHT: Received %02X, %02X, %02X, %02X, %02X =? %02X"),
|
||||
snprintf_P(log, sizeof(log), PSTR(D_LOG_DHT D_RECEIVED " %02X, %02X, %02X, %02X, %02X =? %02X"),
|
||||
dht_data[0], dht_data[1], dht_data[2], dht_data[3], dht_data[4], (dht_data[0] + dht_data[1] + dht_data[2] + dht_data[3]) & 0xFF);
|
||||
addLog(LOG_LEVEL_DEBUG, log);
|
||||
|
||||
if (dht_data[4] == ((dht_data[0] + dht_data[1] + dht_data[2] + dht_data[3]) & 0xFF)) {
|
||||
dht[sensor].lastresult = true;
|
||||
} else {
|
||||
addLog_P(LOG_LEVEL_DEBUG, PSTR("DHT: Checksum failure"));
|
||||
addLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_DHT D_CHECKSUM_FAILURE));
|
||||
dht[sensor].lastresult = false;
|
||||
}
|
||||
return dht[sensor].lastresult;
|
||||
|
@ -175,7 +175,7 @@ boolean dht_readTempHum(byte sensor, float &t, float &h)
|
|||
boolean dht_setup(byte pin, byte type)
|
||||
{
|
||||
boolean success = false;
|
||||
|
||||
|
||||
if (dht_sensors < DHT_MAX_SENSORS) {
|
||||
dht[dht_sensors].pin = pin;
|
||||
dht[dht_sensors].type = type;
|
||||
|
@ -208,9 +208,6 @@ void dht_init()
|
|||
snprintf_P(dht[i].stype, sizeof(dht[i].stype), PSTR("%s-%02d"), dht[i].stype, dht[i].pin);
|
||||
}
|
||||
}
|
||||
|
||||
snprintf_P(log, sizeof(log), PSTR("DHT: Max clock cycles %d"), dht_maxcycles);
|
||||
addLog(LOG_LEVEL_DEBUG, log);
|
||||
}
|
||||
|
||||
/*********************************************************************************************\
|
||||
|
@ -227,10 +224,8 @@ void dht_mqttPresent(char* svalue, uint16_t ssvalue, uint8_t* djson)
|
|||
byte dsxflg = 0;
|
||||
for (byte i = 0; i < dht_sensors; i++) {
|
||||
if (dht_readTempHum(i, t, h)) { // Read temperature
|
||||
dtostrf(t, 1, sysCfg.flag.temperature_resolution, stemp1);
|
||||
dtostrf(h, 1, sysCfg.flag.humidity_resolution, stemp2);
|
||||
// snprintf_P(svalue, ssvalue, PSTR("%s, \"%s\":{\"Temperature\":%s, \"Humidity\":%s}"),
|
||||
// svalue, dhtstype, stemp1, stemp2);
|
||||
dtostrfd(t, sysCfg.flag.temperature_resolution, stemp1);
|
||||
dtostrfd(h, sysCfg.flag.humidity_resolution, stemp2);
|
||||
snprintf_P(svalue, ssvalue, JSON_SNS_TEMPHUM, svalue, dht[i].stype, stemp1, stemp2);
|
||||
*djson = 1;
|
||||
#ifdef USE_DOMOTICZ
|
||||
|
@ -251,13 +246,13 @@ String dht_webPresent()
|
|||
char sensor[80];
|
||||
float t;
|
||||
float h;
|
||||
|
||||
|
||||
for (byte i = 0; i < dht_sensors; i++) {
|
||||
if (dht_readTempHum(i, t, h)) {
|
||||
dtostrf(t, 1, sysCfg.flag.temperature_resolution, stemp);
|
||||
dtostrfi(t, sysCfg.flag.temperature_resolution, stemp);
|
||||
snprintf_P(sensor, sizeof(sensor), HTTP_SNS_TEMP, dht[i].stype, stemp, tempUnit());
|
||||
page += sensor;
|
||||
dtostrf(h, 1, sysCfg.flag.humidity_resolution, stemp);
|
||||
dtostrfi(h, sysCfg.flag.humidity_resolution, stemp);
|
||||
snprintf_P(sensor, sizeof(sensor), HTTP_SNS_HUM, dht[i].stype, stemp);
|
||||
page += sensor;
|
||||
}
|
||||
|
|
|
@ -135,7 +135,7 @@ boolean dsb_readTemp(float &t)
|
|||
}
|
||||
|
||||
if (!dsb_read_bit()) { //check measurement end
|
||||
addLog_P(LOG_LEVEL_DEBUG, PSTR("DSB: Sensor busy"));
|
||||
addLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_DSB D_SENSOR_BUSY));
|
||||
return !isnan(t);
|
||||
}
|
||||
/*
|
||||
|
@ -160,7 +160,7 @@ boolean dsb_readTemp(float &t)
|
|||
crc = dsb_crc(dsb_read(), crc);
|
||||
dsb_reset();
|
||||
if (crc) { //check crc
|
||||
addLog_P(LOG_LEVEL_DEBUG, PSTR("DSB: Sensor CRC error"));
|
||||
addLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_DSB D_SENSOR_CRC_ERROR));
|
||||
} else {
|
||||
DSTemp = (msb << 8) + lsb;
|
||||
if (DSTemp > 2047) {
|
||||
|
@ -183,8 +183,8 @@ void dsb_mqttPresent(char* svalue, uint16_t ssvalue, uint8_t* djson)
|
|||
float t;
|
||||
|
||||
if (dsb_readTemp(t)) { // Check if read failed
|
||||
dtostrf(t, 1, sysCfg.flag.temperature_resolution, stemp1);
|
||||
snprintf_P(svalue, ssvalue, PSTR("%s, \"DS18B20\":{\"Temperature\":%s}"), svalue, stemp1);
|
||||
dtostrfd(t, sysCfg.flag.temperature_resolution, stemp1);
|
||||
snprintf_P(svalue, ssvalue, PSTR("%s, \"DS18B20\":{\"" D_TEMPERATURE "\":%s}"), svalue, stemp1);
|
||||
*djson = 1;
|
||||
#ifdef USE_DOMOTICZ
|
||||
domoticz_sensor1(stemp1);
|
||||
|
@ -198,12 +198,12 @@ String dsb_webPresent()
|
|||
// Needs TelePeriod to refresh data (Do not do it here as it takes too much time)
|
||||
String page = "";
|
||||
float st;
|
||||
|
||||
|
||||
if (dsb_readTemp(st)) { // Check if read failed
|
||||
char stemp[10];
|
||||
char sensor[80];
|
||||
|
||||
dtostrf(st, 1, sysCfg.flag.temperature_resolution, stemp);
|
||||
|
||||
dtostrfi(st, sysCfg.flag.temperature_resolution, stemp);
|
||||
snprintf_P(sensor, sizeof(sensor), HTTP_SNS_TEMP, "DS18B20", stemp, tempUnit());
|
||||
page += sensor;
|
||||
}
|
||||
|
|
|
@ -190,14 +190,14 @@ void ds18x20_mqttPresent(char* svalue, uint16_t ssvalue, uint8_t* djson)
|
|||
for (byte i = 0; i < ds18x20_sensors(); i++) {
|
||||
if (ds18x20_read(i, t)) { // Check if read failed
|
||||
ds18x20_type(i);
|
||||
dtostrf(t, 1, sysCfg.flag.temperature_resolution, stemp2);
|
||||
dtostrfd(t, sysCfg.flag.temperature_resolution, stemp2);
|
||||
if (!dsxflg) {
|
||||
snprintf_P(svalue, ssvalue, PSTR("%s, \"DS18x20\":{"), svalue);
|
||||
*djson = 1;
|
||||
stemp1[0] = '\0';
|
||||
}
|
||||
dsxflg++;
|
||||
snprintf_P(svalue, ssvalue, PSTR("%s%s\"DS%d\":{\"Type\":\"%s\", \"Address\":\"%s\", \"Temperature\":%s}"),
|
||||
snprintf_P(svalue, ssvalue, PSTR("%s%s\"DS%d\":{\"" D_TYPE "\":\"%s\", \"" D_ADDRESS "\":\"%s\", \"" D_TEMPERATURE "\":%s}"),
|
||||
svalue, stemp1, i +1, dsbstype, ds18x20_address(i).c_str(), stemp2);
|
||||
strcpy(stemp1, ", ");
|
||||
#ifdef USE_DOMOTICZ
|
||||
|
@ -222,7 +222,7 @@ String ds18x20_webPresent()
|
|||
for (byte i = 0; i < ds18x20_sensors(); i++) {
|
||||
if (ds18x20_read(i, t)) { // Check if read failed
|
||||
ds18x20_type(i);
|
||||
dtostrf(t, 1, sysCfg.flag.temperature_resolution, stemp);
|
||||
dtostrfi(t, sysCfg.flag.temperature_resolution, stemp);
|
||||
snprintf_P(stemp2, sizeof(stemp2), PSTR("%s-%d"), dsbstype, i +1);
|
||||
snprintf_P(sensor, sizeof(sensor), HTTP_SNS_TEMP, stemp2, stemp, tempUnit());
|
||||
page += sensor;
|
||||
|
|
|
@ -345,32 +345,32 @@ void hlw_margin_chk()
|
|||
snprintf_P(svalue, sizeof(svalue), PSTR("{"));
|
||||
jsonflg = 0;
|
||||
if (hlw_margin(0, sysCfg.hlw_pmin, pwv, flag, hlw_pminflg)) {
|
||||
snprintf_P(svalue, sizeof(svalue), PSTR("%s%s\"PowerLow\":\"%s\""), svalue, (jsonflg)?", ":"", getStateText(flag));
|
||||
snprintf_P(svalue, sizeof(svalue), PSTR("%s%s\"" D_CMND_POWERLOW "\":\"%s\""), svalue, (jsonflg)?", ":"", getStateText(flag));
|
||||
jsonflg = 1;
|
||||
}
|
||||
if (hlw_margin(1, sysCfg.hlw_pmax, pwv, flag, hlw_pmaxflg)) {
|
||||
snprintf_P(svalue, sizeof(svalue), PSTR("%s%s\"PowerHigh\":\"%s\""), svalue, (jsonflg)?", ":"", getStateText(flag));
|
||||
snprintf_P(svalue, sizeof(svalue), PSTR("%s%s\"" D_CMND_POWERHIGH "\":\"%s\""), svalue, (jsonflg)?", ":"", getStateText(flag));
|
||||
jsonflg = 1;
|
||||
}
|
||||
if (hlw_margin(0, sysCfg.hlw_umin, puv, flag, hlw_uminflg)) {
|
||||
snprintf_P(svalue, sizeof(svalue), PSTR("%s%s\"VoltageLow\":\"%s\""), svalue, (jsonflg)?", ":"", getStateText(flag));
|
||||
snprintf_P(svalue, sizeof(svalue), PSTR("%s%s\"" D_CMND_VOLTAGELOW "\":\"%s\""), svalue, (jsonflg)?", ":"", getStateText(flag));
|
||||
jsonflg = 1;
|
||||
}
|
||||
if (hlw_margin(1, sysCfg.hlw_umax, puv, flag, hlw_umaxflg)) {
|
||||
snprintf_P(svalue, sizeof(svalue), PSTR("%s%s\"VoltageHigh\":\"%s\""), svalue, (jsonflg)?", ":"", getStateText(flag));
|
||||
snprintf_P(svalue, sizeof(svalue), PSTR("%s%s\"" D_CMND_VOLTAGEHIGH "\":\"%s\""), svalue, (jsonflg)?", ":"", getStateText(flag));
|
||||
jsonflg = 1;
|
||||
}
|
||||
if (hlw_margin(0, sysCfg.hlw_imin, piv, flag, hlw_iminflg)) {
|
||||
snprintf_P(svalue, sizeof(svalue), PSTR("%s%s\"CurrentLow\":\"%s\""), svalue, (jsonflg)?", ":"", getStateText(flag));
|
||||
snprintf_P(svalue, sizeof(svalue), PSTR("%s%s\"" D_CMND_CURRENTLOW "\":\"%s\""), svalue, (jsonflg)?", ":"", getStateText(flag));
|
||||
jsonflg = 1;
|
||||
}
|
||||
if (hlw_margin(1, sysCfg.hlw_imax, piv, flag, hlw_imaxflg)) {
|
||||
snprintf_P(svalue, sizeof(svalue), PSTR("%s%s\"CurrentHigh\":\"%s\""), svalue, (jsonflg)?", ":"", getStateText(flag));
|
||||
snprintf_P(svalue, sizeof(svalue), PSTR("%s%s\"" D_CMND_CURRENTHIGH "\":\"%s\""), svalue, (jsonflg)?", ":"", getStateText(flag));
|
||||
jsonflg = 1;
|
||||
}
|
||||
if (jsonflg) {
|
||||
snprintf_P(svalue, sizeof(svalue), PSTR("%s}"), svalue);
|
||||
mqtt_publish_topic_P(2, PSTR("MARGINS"), svalue);
|
||||
mqtt_publish_topic_P(2, PSTR(D_RSLT_MARGINS), svalue);
|
||||
hlw_mqttPresent(0);
|
||||
}
|
||||
}
|
||||
|
@ -384,8 +384,8 @@ void hlw_margin_chk()
|
|||
} else {
|
||||
hlw_mplh_counter--;
|
||||
if (!hlw_mplh_counter) {
|
||||
snprintf_P(svalue, sizeof(svalue), PSTR("{\"MaxPowerReached\":\"%d%s\"}"), pwv, (sysCfg.flag.value_units) ? " W" : "");
|
||||
mqtt_publish_topic_P(1, PSTR("WARNING"), svalue);
|
||||
snprintf_P(svalue, sizeof(svalue), PSTR("{\"" D_MAXPOWERREACHED "\":\"%d%s\"}"), pwv, (sysCfg.flag.value_units) ? " " D_UNIT_WATT : "");
|
||||
mqtt_publish_topic_P(1, S_RSLT_WARNING, svalue);
|
||||
hlw_mqttPresent(0);
|
||||
do_cmnd_power(1, 0);
|
||||
if (!hlw_mplr_counter) {
|
||||
|
@ -407,12 +407,12 @@ void hlw_margin_chk()
|
|||
if (hlw_mplr_counter) {
|
||||
hlw_mplr_counter--;
|
||||
if (hlw_mplr_counter) {
|
||||
snprintf_P(svalue, sizeof(svalue), PSTR("{\"PowerMonitor\":\"%s\"}"), getStateText(1));
|
||||
mqtt_publish_topic_P(5, PSTR("POWERMONITOR"), svalue);
|
||||
snprintf_P(svalue, sizeof(svalue), PSTR("{\"" D_POWERMONITOR "\":\"%s\"}"), getStateText(1));
|
||||
mqtt_publish_topic_P(5, PSTR(D_POWERMONITOR), svalue);
|
||||
do_cmnd_power(1, 1);
|
||||
} else {
|
||||
snprintf_P(svalue, sizeof(svalue), PSTR("{\"MaxPowerReachedRetry\":\"%s\"}"), getStateText(0));
|
||||
mqtt_publish_topic_P(1, PSTR("WARNING"), svalue);
|
||||
snprintf_P(svalue, sizeof(svalue), PSTR("{\"" D_MAXPOWERREACHEDRETRY "\":\"%s\"}"), getStateText(0));
|
||||
mqtt_publish_topic_P(1, S_RSLT_WARNING, svalue);
|
||||
hlw_mqttPresent(0);
|
||||
}
|
||||
}
|
||||
|
@ -425,15 +425,15 @@ void hlw_margin_chk()
|
|||
uped = (uint16_t)(ped * 1000);
|
||||
if (!hlw_mkwh_state && (rtcTime.Hour == sysCfg.hlw_mkwhs)) {
|
||||
hlw_mkwh_state = 1;
|
||||
snprintf_P(svalue, sizeof(svalue), PSTR("{\"EnergyMonitor\":\"%s\"}"), getStateText(1));
|
||||
mqtt_publish_topic_P(5, PSTR("ENERGYMONITOR"), svalue);
|
||||
snprintf_P(svalue, sizeof(svalue), PSTR("{\"" D_ENERGYMONITOR "\":\"%s\"}"), getStateText(1));
|
||||
mqtt_publish_topic_P(5, PSTR(D_ENERGYMONITOR), svalue);
|
||||
do_cmnd_power(1, 1);
|
||||
}
|
||||
else if ((1 == hlw_mkwh_state) && (uped >= sysCfg.hlw_mkwh)) {
|
||||
hlw_mkwh_state = 2;
|
||||
dtostrf(ped, 1, 3, svalue);
|
||||
snprintf_P(svalue, sizeof(svalue), PSTR("{\"MaxEnergyReached\":\"%s%s\"}"), svalue, (sysCfg.flag.value_units) ? " kWh" : "");
|
||||
mqtt_publish_topic_P(1, PSTR("WARNING"), svalue);
|
||||
dtostrfd(ped, 3, svalue);
|
||||
snprintf_P(svalue, sizeof(svalue), PSTR("{\"" D_MAXENERGYREACHED "\":\"%s%s\"}"), svalue, (sysCfg.flag.value_units) ? " " D_UNIT_KILOWATTHOUR : "");
|
||||
mqtt_publish_topic_P(1, S_RSLT_WARNING, svalue);
|
||||
hlw_mqttPresent(0);
|
||||
do_cmnd_power(1, 0);
|
||||
}
|
||||
|
@ -450,43 +450,43 @@ boolean hlw_command(char *type, uint16_t index, char *dataBuf, uint16_t data_len
|
|||
boolean serviced = true;
|
||||
uint8_t caltext = 0;
|
||||
|
||||
if (!strcmp_P(type,PSTR("POWERLOW"))) {
|
||||
if (!strcasecmp_P(type, PSTR(D_CMND_POWERLOW))) {
|
||||
if ((payload >= 0) && (payload < 3601)) {
|
||||
sysCfg.hlw_pmin = payload;
|
||||
}
|
||||
snprintf_P(svalue, ssvalue, PSTR("{\"PowerLow\":\"%d%s\"}"), sysCfg.hlw_pmin, (sysCfg.flag.value_units) ? " W" : "");
|
||||
snprintf_P(svalue, ssvalue, PSTR("{\"" D_CMND_POWERLOW "\":\"%d%s\"}"), sysCfg.hlw_pmin, (sysCfg.flag.value_units) ? " " D_UNIT_WATT : "");
|
||||
}
|
||||
else if (!strcmp_P(type,PSTR("POWERHIGH"))) {
|
||||
else if (!strcasecmp_P(type, PSTR(D_CMND_POWERHIGH))) {
|
||||
if ((payload >= 0) && (payload < 3601)) {
|
||||
sysCfg.hlw_pmax = payload;
|
||||
}
|
||||
snprintf_P(svalue, ssvalue, PSTR("{\"PowerHigh\":\"%d%s\"}"), sysCfg.hlw_pmax, (sysCfg.flag.value_units) ? " W" : "");
|
||||
snprintf_P(svalue, ssvalue, PSTR("{\"" D_CMND_POWERHIGH "\":\"%d%s\"}"), sysCfg.hlw_pmax, (sysCfg.flag.value_units) ? " " D_UNIT_WATT : "");
|
||||
}
|
||||
else if (!strcmp_P(type,PSTR("VOLTAGELOW"))) {
|
||||
else if (!strcasecmp_P(type, PSTR(D_CMND_VOLTAGELOW))) {
|
||||
if ((payload >= 0) && (payload < 501)) {
|
||||
sysCfg.hlw_umin = payload;
|
||||
}
|
||||
snprintf_P(svalue, ssvalue, PSTR("{\"VoltageLow\":\"%d%s\"}"), sysCfg.hlw_umin, (sysCfg.flag.value_units) ? " V" : "");
|
||||
snprintf_P(svalue, ssvalue, PSTR("{\"" D_CMND_VOLTAGELOW "\":\"%d%s\"}"), sysCfg.hlw_umin, (sysCfg.flag.value_units) ? " " D_UNIT_VOLT : "");
|
||||
}
|
||||
else if (!strcmp_P(type,PSTR("VOLTAGEHIGH"))) {
|
||||
else if (!strcasecmp_P(type, PSTR(D_CMND_VOLTAGEHIGH))) {
|
||||
if ((payload >= 0) && (payload < 501)) {
|
||||
sysCfg.hlw_umax = payload;
|
||||
}
|
||||
snprintf_P(svalue, ssvalue, PSTR("[\"VoltageHigh\":\"%d%s\"}"), sysCfg.hlw_umax, (sysCfg.flag.value_units) ? " V" : "");
|
||||
snprintf_P(svalue, ssvalue, PSTR("{\"" D_CMND_VOLTAGEHIGH "\":\"%d%s\"}"), sysCfg.hlw_umax, (sysCfg.flag.value_units) ? " " D_UNIT_VOLT : "");
|
||||
}
|
||||
else if (!strcmp_P(type,PSTR("CURRENTLOW"))) {
|
||||
else if (!strcasecmp_P(type, PSTR(D_CMND_CURRENTLOW))) {
|
||||
if ((payload >= 0) && (payload < 16001)) {
|
||||
sysCfg.hlw_imin = payload;
|
||||
}
|
||||
snprintf_P(svalue, ssvalue, PSTR("{\"CurrentLow\":\"%d%s\"}"), sysCfg.hlw_imin, (sysCfg.flag.value_units) ? " mA" : "");
|
||||
snprintf_P(svalue, ssvalue, PSTR("{\"" D_CMND_CURRENTLOW "\":\"%d%s\"}"), sysCfg.hlw_imin, (sysCfg.flag.value_units) ? " " D_UNIT_MILLIAMPERE : "");
|
||||
}
|
||||
else if (!strcmp_P(type,PSTR("CURRENTHIGH"))) {
|
||||
else if (!strcasecmp_P(type, PSTR(D_CMND_CURRENTHIGH))) {
|
||||
if ((payload >= 0) && (payload < 16001)) {
|
||||
sysCfg.hlw_imax = payload;
|
||||
}
|
||||
snprintf_P(svalue, ssvalue, PSTR("{\"CurrentHigh\":\"%d%s\"}"), sysCfg.hlw_imax, (sysCfg.flag.value_units) ? " mA" : "");
|
||||
snprintf_P(svalue, ssvalue, PSTR("{\"" D_CMND_CURRENTHIGH "\":\"%d%s\"}"), sysCfg.hlw_imax, (sysCfg.flag.value_units) ? " " D_UNIT_MILLIAMPERE : "");
|
||||
}
|
||||
else if (!strcmp_P(type,PSTR("ENERGYRESET"))) {
|
||||
else if (!strcasecmp_P(type, PSTR(D_CMND_ENERGYRESET))) {
|
||||
if ((payload >= 1) && (payload <= 3)) {
|
||||
switch (payload) {
|
||||
case 1:
|
||||
|
@ -506,96 +506,96 @@ boolean hlw_command(char *type, uint16_t index, char *dataBuf, uint16_t data_len
|
|||
char sey[10];
|
||||
char sen[10];
|
||||
char set[10];
|
||||
dtostrf((float)sysCfg.hlw_kWhyesterday / 100000000, 1, sysCfg.flag.energy_resolution, sey);
|
||||
dtostrf((float)rtcMem.hlw_kWhtoday / 100000000, 1, sysCfg.flag.energy_resolution, sen);
|
||||
dtostrf((float)(rtcMem.hlw_kWhtotal + (hlw_kWhtoday / 1000)) / 100000, 1, sysCfg.flag.energy_resolution, set);
|
||||
snprintf_P(svalue, ssvalue, PSTR("{\"EnergyReset\":{\"Total\":%s, \"Yesterday\":%s, \"Today\":%s}}"), set, sey, sen);
|
||||
dtostrfd((float)sysCfg.hlw_kWhyesterday / 100000000, sysCfg.flag.energy_resolution, sey);
|
||||
dtostrfd((float)rtcMem.hlw_kWhtoday / 100000000, sysCfg.flag.energy_resolution, sen);
|
||||
dtostrfd((float)(rtcMem.hlw_kWhtotal + (hlw_kWhtoday / 1000)) / 100000, sysCfg.flag.energy_resolution, set);
|
||||
snprintf_P(svalue, ssvalue, PSTR("{\"" D_CMND_ENERGYRESET "\":{\"" D_TOTAL "\":%s, \"" D_YESTERDAY "\":%s, \"" D_TODAY "\":%s}}"), set, sey, sen);
|
||||
}
|
||||
else if (!strcmp_P(type,PSTR("HLWPCAL"))) {
|
||||
else if (!strcasecmp_P(type, PSTR(D_CMND_HLWPCAL))) {
|
||||
if ((payload > 0) && (payload < 32001)) {
|
||||
sysCfg.hlw_pcal = (payload > 4000) ? payload : HLW_PREF_PULSE; // 12530
|
||||
}
|
||||
caltext = 1;
|
||||
}
|
||||
else if (!strcmp_P(type,PSTR("HLWPSET"))) {
|
||||
else if (!strcasecmp_P(type, PSTR(D_CMND_HLWPSET))) {
|
||||
if ((payload > 0) && (payload < 3601) && hlw_cf_plen) {
|
||||
sysCfg.hlw_pcal = (payload * 10 * hlw_cf_plen) / HLW_PREF;
|
||||
}
|
||||
caltext = 1;
|
||||
}
|
||||
else if (!strcmp_P(type,PSTR("HLWUCAL"))) {
|
||||
else if (!strcasecmp_P(type, PSTR(D_CMND_HLWUCAL))) {
|
||||
if ((payload > 0) && (payload < 32001)) {
|
||||
sysCfg.hlw_ucal = (payload > 999) ? payload : HLW_UREF_PULSE; // 1950
|
||||
}
|
||||
caltext = 2;
|
||||
}
|
||||
else if (!strcmp_P(type,PSTR("HLWUSET"))) {
|
||||
else if (!strcasecmp_P(type, PSTR(D_CMND_HLWUSET))) {
|
||||
if ((payload > 0) && (payload < 501) && hlw_cf1u_plen) {
|
||||
sysCfg.hlw_ucal = (payload * 10 * hlw_cf1u_plen) / HLW_UREF;
|
||||
}
|
||||
caltext = 2;
|
||||
}
|
||||
else if (!strcmp_P(type,PSTR("HLWICAL"))) {
|
||||
else if (!strcasecmp_P(type, PSTR(D_CMND_HLWICAL))) {
|
||||
if ((payload > 0) && (payload < 32001)) {
|
||||
sysCfg.hlw_ical = (payload > 1100) ? payload : HLW_IREF_PULSE; // 3500
|
||||
}
|
||||
caltext = 3;
|
||||
}
|
||||
else if (!strcmp_P(type,PSTR("HLWISET"))) {
|
||||
else if (!strcasecmp_P(type, PSTR(D_CMND_HLWISET))) {
|
||||
if ((payload > 0) && (payload < 16001) && hlw_cf1i_plen) {
|
||||
sysCfg.hlw_ical = (payload * hlw_cf1i_plen) / HLW_IREF;
|
||||
}
|
||||
caltext = 3;
|
||||
}
|
||||
#if FEATURE_POWER_LIMIT
|
||||
else if (!strcmp_P(type,PSTR("MAXPOWER"))) {
|
||||
else if (!strcasecmp_P(type, PSTR(D_CMND_MAXPOWER))) {
|
||||
if ((payload >= 0) && (payload < 3601)) {
|
||||
sysCfg.hlw_mpl = payload;
|
||||
}
|
||||
snprintf_P(svalue, ssvalue, PSTR("{\"MaxPower\":\"%d%s\"}"), sysCfg.hlw_mpl, (sysCfg.flag.value_units) ? " W" : "");
|
||||
snprintf_P(svalue, ssvalue, PSTR("{\"" D_CMND_MAXPOWER "\":\"%d%s\"}"), sysCfg.hlw_mpl, (sysCfg.flag.value_units) ? " " D_UNIT_WATT : "");
|
||||
}
|
||||
else if (!strcmp_P(type,PSTR("MAXPOWERHOLD"))) {
|
||||
else if (!strcasecmp_P(type, PSTR(D_CMND_MAXPOWERHOLD))) {
|
||||
if ((payload >= 0) && (payload < 3601)) {
|
||||
sysCfg.hlw_mplh = (1 == payload) ? MAX_POWER_HOLD : payload;
|
||||
}
|
||||
snprintf_P(svalue, ssvalue, PSTR("{\"MaxPowerHold\":\"%d%s\"}"), sysCfg.hlw_mplh, (sysCfg.flag.value_units) ? " Sec" : "");
|
||||
snprintf_P(svalue, ssvalue, PSTR("{\"" D_CMND_MAXPOWERHOLD "\":\"%d%s\"}"), sysCfg.hlw_mplh, (sysCfg.flag.value_units) ? " " D_UNIT_SECOND : "");
|
||||
}
|
||||
else if (!strcmp_P(type,PSTR("MAXPOWERWINDOW"))) {
|
||||
else if (!strcasecmp_P(type, PSTR(D_CMND_MAXPOWERWINDOW))) {
|
||||
if ((payload >= 0) && (payload < 3601)) {
|
||||
sysCfg.hlw_mplw = (1 == payload) ? MAX_POWER_WINDOW : payload;
|
||||
}
|
||||
snprintf_P(svalue, ssvalue, PSTR("{\"MaxPowerWindow\":\"%d%s\"}"), sysCfg.hlw_mplw, (sysCfg.flag.value_units) ? " Sec" : "");
|
||||
snprintf_P(svalue, ssvalue, PSTR("{\"" D_CMND_MAXPOWERWINDOW "\":\"%d%s\"}"), sysCfg.hlw_mplw, (sysCfg.flag.value_units) ? " " D_UNIT_SECOND : "");
|
||||
}
|
||||
else if (!strcmp_P(type,PSTR("SAFEPOWER"))) {
|
||||
else if (!strcasecmp_P(type, PSTR(D_CMND_SAFEPOWER))) {
|
||||
if ((payload >= 0) && (payload < 3601)) {
|
||||
sysCfg.hlw_mspl = payload;
|
||||
}
|
||||
snprintf_P(svalue, ssvalue, PSTR("{\"SafePower\":\"%d%s\"}"), sysCfg.hlw_mspl, (sysCfg.flag.value_units) ? " W" : "");
|
||||
snprintf_P(svalue, ssvalue, PSTR("{\"" D_CMND_SAFEPOWER "\":\"%d%s\"}"), sysCfg.hlw_mspl, (sysCfg.flag.value_units) ? " " D_UNIT_WATT : "");
|
||||
}
|
||||
else if (!strcmp_P(type,PSTR("SAFEPOWERHOLD"))) {
|
||||
else if (!strcasecmp_P(type, PSTR(D_CMND_SAFEPOWERHOLD))) {
|
||||
if ((payload >= 0) && (payload < 3601)) {
|
||||
sysCfg.hlw_msplh = (1 == payload) ? SAFE_POWER_HOLD : payload;
|
||||
}
|
||||
snprintf_P(svalue, ssvalue, PSTR("{\"SafePowerHold\":\"%d%s\"}"), sysCfg.hlw_msplh, (sysCfg.flag.value_units) ? " Sec" : "");
|
||||
snprintf_P(svalue, ssvalue, PSTR("{\"" D_CMND_SAFEPOWERHOLD "\":\"%d%s\"}"), sysCfg.hlw_msplh, (sysCfg.flag.value_units) ? " " D_UNIT_SECOND : "");
|
||||
}
|
||||
else if (!strcmp_P(type,PSTR("SAFEPOWERWINDOW"))) {
|
||||
else if (!strcasecmp_P(type, PSTR(D_CMND_SAFEPOWERWINDOW))) {
|
||||
if ((payload >= 0) && (payload < 1440)) {
|
||||
sysCfg.hlw_msplw = (1 == payload) ? SAFE_POWER_WINDOW : payload;
|
||||
}
|
||||
snprintf_P(svalue, ssvalue, PSTR("{\"SafePowerWindow\":\"%d%s\"}"), sysCfg.hlw_msplw, (sysCfg.flag.value_units) ? " Min" : "");
|
||||
snprintf_P(svalue, ssvalue, PSTR("{\"" D_CMND_SAFEPOWERWINDOW "\":\"%d%s\"}"), sysCfg.hlw_msplw, (sysCfg.flag.value_units) ? " " D_UNIT_MINUTE : "");
|
||||
}
|
||||
else if (!strcmp_P(type,PSTR("MAXENERGY"))) {
|
||||
else if (!strcasecmp_P(type, PSTR(D_CMND_MAXENERGY))) {
|
||||
if ((payload >= 0) && (payload < 3601)) {
|
||||
sysCfg.hlw_mkwh = payload;
|
||||
hlw_mkwh_state = 3;
|
||||
}
|
||||
snprintf_P(svalue, ssvalue, PSTR("{\"MaxEnergy\":\"%d%s\"}"), sysCfg.hlw_mkwh, (sysCfg.flag.value_units) ? " Wh" : "");
|
||||
snprintf_P(svalue, ssvalue, PSTR("{\"" D_CMND_MAXENERGY "\":\"%d%s\"}"), sysCfg.hlw_mkwh, (sysCfg.flag.value_units) ? " " D_UNIT_WATTHOUR : "");
|
||||
}
|
||||
else if (!strcmp_P(type,PSTR("MAXENERGYSTART"))) {
|
||||
else if (!strcasecmp_P(type, PSTR(D_CMND_MAXENERGYSTART))) {
|
||||
if ((payload >= 0) && (payload < 24)) {
|
||||
sysCfg.hlw_mkwhs = payload;
|
||||
}
|
||||
snprintf_P(svalue, ssvalue, PSTR("{\"MaxEnergyStart\":\"%d%s\"}"), sysCfg.hlw_mkwhs, (sysCfg.flag.value_units) ? " Hr" : "");
|
||||
snprintf_P(svalue, ssvalue, PSTR("{\"" D_CMND_MAXENERGYSTART "\":\"%d%s\"}"), sysCfg.hlw_mkwhs, (sysCfg.flag.value_units) ? " " D_UNIT_HOUR : "");
|
||||
}
|
||||
#endif // FEATURE_POWER_LIMIT
|
||||
else {
|
||||
|
@ -603,13 +603,13 @@ boolean hlw_command(char *type, uint16_t index, char *dataBuf, uint16_t data_len
|
|||
}
|
||||
switch (caltext) {
|
||||
case 1:
|
||||
snprintf_P(svalue, ssvalue, PSTR("(\"HlwPcal\":\"%d%s\"}"), sysCfg.hlw_pcal, (sysCfg.flag.value_units) ? " uS" : "");
|
||||
snprintf_P(svalue, ssvalue, PSTR("{\"" D_CMND_HLWPCAL "\":\"%d%s\"}"), sysCfg.hlw_pcal, (sysCfg.flag.value_units) ? " " D_UNIT_MICROSECOND : "");
|
||||
break;
|
||||
case 2:
|
||||
snprintf_P(svalue, ssvalue, PSTR("{\"HlwUcal\":\"%d%s\"}"), sysCfg.hlw_ucal, (sysCfg.flag.value_units) ? " uS" : "");
|
||||
snprintf_P(svalue, ssvalue, PSTR("{\"" D_CMND_HLWUCAL "\":\"%d%s\"}"), sysCfg.hlw_ucal, (sysCfg.flag.value_units) ? " " D_UNIT_MICROSECOND : "");
|
||||
break;
|
||||
case 3:
|
||||
snprintf_P(svalue, ssvalue, PSTR("(\"HlwIcal\":\"%d%s\"}"), sysCfg.hlw_ical, (sysCfg.flag.value_units) ? " uS" : "");
|
||||
snprintf_P(svalue, ssvalue, PSTR("{\"" D_CMND_HLWICAL "\":\"%d%s\"}"), sysCfg.hlw_ical, (sysCfg.flag.value_units) ? " " D_UNIT_MICROSECOND : "");
|
||||
break;
|
||||
}
|
||||
return serviced;
|
||||
|
@ -642,20 +642,20 @@ void hlw_mqttStat(byte option, char* svalue, uint16_t ssvalue)
|
|||
char speriod[20];
|
||||
|
||||
hlw_readEnergy(option, pet, ped, pe, pw, pu, pi, pc);
|
||||
dtostrf(pet, 1, sysCfg.flag.energy_resolution, spet);
|
||||
dtostrf(ped, 1, sysCfg.flag.energy_resolution, sped);
|
||||
dtostrf(pe, 1, sysCfg.flag.wattage_resolution, spe);
|
||||
dtostrf(pw, 1, sysCfg.flag.wattage_resolution, spw);
|
||||
dtostrf(pu, 1, sysCfg.flag.voltage_resolution, spu);
|
||||
dtostrf(pi, 1, 3, spi);
|
||||
dtostrf(pc, 1, 2, spc);
|
||||
dtostrf((float)sysCfg.hlw_kWhyesterday / 100000000, 1, sysCfg.flag.energy_resolution, sey);
|
||||
snprintf_P(speriod, sizeof(speriod), PSTR(", \"Period\":%s"), spe);
|
||||
snprintf_P(svalue, ssvalue, PSTR("%s\"Total\":%s, \"Yesterday\":%s, \"Today\":%s%s, \"Power\":%s, \"Factor\":%s, \"Voltage\":%s, \"Current\":%s}"),
|
||||
dtostrfd(pet, sysCfg.flag.energy_resolution, spet);
|
||||
dtostrfd(ped, sysCfg.flag.energy_resolution, sped);
|
||||
dtostrfd(pe, sysCfg.flag.wattage_resolution, spe);
|
||||
dtostrfd(pw, sysCfg.flag.wattage_resolution, spw);
|
||||
dtostrfd(pu, sysCfg.flag.voltage_resolution, spu);
|
||||
dtostrfd(pi, 3, spi);
|
||||
dtostrfd(pc, 2, spc);
|
||||
dtostrfd((float)sysCfg.hlw_kWhyesterday / 100000000, sysCfg.flag.energy_resolution, sey);
|
||||
snprintf_P(speriod, sizeof(speriod), PSTR(", \"" D_PERIOD "\":%s"), spe);
|
||||
snprintf_P(svalue, ssvalue, PSTR("%s\"" D_TOTAL "\":%s, \"" D_YESTERDAY "\":%s, \"" D_TODAY "\":%s%s, \"" D_POWERUSAGE "\":%s, \"" D_POWERFACTOR "\":%s, \"" D_VOLTAGE "\":%s, \"" D_CURRENT "\":%s}"),
|
||||
svalue, spet, sey, sped, (option) ? speriod : "", spw, spc, spu, spi);
|
||||
#ifdef USE_DOMOTICZ
|
||||
if (option) { // Only send if telemetry
|
||||
dtostrf(pet * 1000, 1, 1, spet);
|
||||
dtostrfd(pet * 1000, 1, spet);
|
||||
domoticz_sensor4((uint16_t)pw, spet);
|
||||
}
|
||||
#endif // USE_DOMOTICZ
|
||||
|
@ -669,27 +669,27 @@ void hlw_mqttPresent(byte option)
|
|||
// {"Time":"2017-03-04T13:37:24", "Total":0.013, "Yesterday":0.013, "Today":0.000, "Period":0, "Power":0, "Factor":0.00, "Voltage":0, "Current":0.000}
|
||||
char svalue[200]; // was MESSZ
|
||||
|
||||
snprintf_P(svalue, sizeof(svalue), PSTR("{\"Time\":\"%s\", "), getDateTime().c_str());
|
||||
snprintf_P(svalue, sizeof(svalue), PSTR("{\"" D_TIME "\":\"%s\", "), getDateTime().c_str());
|
||||
hlw_mqttStat(option, svalue, sizeof(svalue));
|
||||
mqtt_publish_topic_P(2, PSTR("ENERGY"), svalue);
|
||||
mqtt_publish_topic_P(2, PSTR(D_RSLT_ENERGY), svalue);
|
||||
}
|
||||
|
||||
void hlw_mqttStatus(char* svalue, uint16_t ssvalue)
|
||||
{
|
||||
snprintf_P(svalue, ssvalue, PSTR("{\"StatusPWR\":{"));
|
||||
snprintf_P(svalue, ssvalue, PSTR("{\"" D_CMND_STATUS D_STATUS8_POWER "\":{"));
|
||||
hlw_mqttStat(0, svalue, ssvalue);
|
||||
snprintf_P(svalue, ssvalue, PSTR("%s}"), svalue);
|
||||
}
|
||||
|
||||
#ifdef USE_WEBSERVER
|
||||
const char HTTP_ENERGY_SNS[] PROGMEM =
|
||||
"<tr><th>Voltage</th><td>%s V</td></tr>"
|
||||
"<tr><th>Current</th><td>%s A</td></tr>"
|
||||
"<tr><th>Power</th><td>%s W</td></tr>"
|
||||
"<tr><th>Power Factor</th><td>%s</td></tr>"
|
||||
"<tr><th>Energy Today</th><td>%s kWh</td></tr>"
|
||||
"<tr><th>Energy Yesterday</th><td>%s kWh</td></tr>"
|
||||
"<tr><th>Energy Total</th><td>%s kWh</td></tr>";
|
||||
"<tr><th>" D_VOLTAGE "</th><td>%s " D_UNIT_VOLT "</td></tr>"
|
||||
"<tr><th>" D_CURRENT "</th><td>%s " D_UNIT_AMPERE "</td></tr>"
|
||||
"<tr><th>" D_POWERUSAGE "</th><td>%s " D_UNIT_WATT "</td></tr>"
|
||||
"<tr><th>" D_POWER_FACTOR "</th><td>%s</td></tr>"
|
||||
"<tr><th>" D_ENERGY_TODAY "</th><td>%s " D_UNIT_KILOWATTHOUR "</td></tr>"
|
||||
"<tr><th>" D_ENERGY_YESTERDAY "</th><td>%s " D_UNIT_KILOWATTHOUR "</td></tr>"
|
||||
"<tr><th>" D_ENERGY_TOTAL "</th><td>%s " D_UNIT_KILOWATTHOUR "</td></tr>";
|
||||
|
||||
String hlw_webPresent()
|
||||
{
|
||||
|
@ -707,16 +707,16 @@ String hlw_webPresent()
|
|||
char spi[10];
|
||||
char spc[10];
|
||||
char sey[10];
|
||||
char sensor[320];
|
||||
char sensor[400];
|
||||
|
||||
hlw_readEnergy(0, pet, ped, pe, pw, pu, pi, pc);
|
||||
dtostrf(pet, 1, sysCfg.flag.energy_resolution, spet);
|
||||
dtostrf(ped, 1, sysCfg.flag.energy_resolution, sped);
|
||||
dtostrf(pw, 1, sysCfg.flag.wattage_resolution, spw);
|
||||
dtostrf(pu, 1, sysCfg.flag.voltage_resolution, spu);
|
||||
dtostrf(pi, 1, 3, spi);
|
||||
dtostrf(pc, 1, 2, spc);
|
||||
dtostrf((float)sysCfg.hlw_kWhyesterday / 100000000, 1, sysCfg.flag.energy_resolution, sey);
|
||||
dtostrfi(pet, sysCfg.flag.energy_resolution, spet);
|
||||
dtostrfi(ped, sysCfg.flag.energy_resolution, sped);
|
||||
dtostrfi(pw, sysCfg.flag.wattage_resolution, spw);
|
||||
dtostrfi(pu, sysCfg.flag.voltage_resolution, spu);
|
||||
dtostrfi(pi, 3, spi);
|
||||
dtostrfi(pc, 2, spc);
|
||||
dtostrfi((float)sysCfg.hlw_kWhyesterday / 100000000, sysCfg.flag.energy_resolution, sey);
|
||||
snprintf_P(sensor, sizeof(sensor), HTTP_ENERGY_SNS, spu, spi, spw, spc, sped, sey, spet);
|
||||
return String(sensor);
|
||||
}
|
||||
|
|
|
@ -244,7 +244,7 @@ uint8_t htu_detect()
|
|||
delayH=23;
|
||||
}
|
||||
if (success) {
|
||||
snprintf_P(log, sizeof(log), PSTR("I2C: %s found at address 0x%x"), htustype, htuaddr);
|
||||
snprintf_P(log, sizeof(log), PSTR(D_LOG_I2C "%s " D_FOUND_AT " 0x%x"), htustype, htuaddr);
|
||||
addLog(LOG_LEVEL_DEBUG, log);
|
||||
} else {
|
||||
htutype = 0;
|
||||
|
@ -268,8 +268,8 @@ void htu_mqttPresent(char* svalue, uint16_t ssvalue, uint8_t* djson)
|
|||
float t = htu21_readTemperature();
|
||||
float h = htu21_readHumidity();
|
||||
h = htu21_compensatedHumidity(h, t);
|
||||
dtostrf(t, 1, sysCfg.flag.temperature_resolution, stemp1);
|
||||
dtostrf(h, 1, sysCfg.flag.humidity_resolution, stemp2);
|
||||
dtostrfd(t, sysCfg.flag.temperature_resolution, stemp1);
|
||||
dtostrfd(h, sysCfg.flag.humidity_resolution, stemp2);
|
||||
snprintf_P(svalue, ssvalue, JSON_SNS_TEMPHUM, svalue, htustype, stemp1, stemp2);
|
||||
*djson = 1;
|
||||
#ifdef USE_DOMOTICZ
|
||||
|
@ -288,10 +288,10 @@ String htu_webPresent()
|
|||
float t_htu21 = htu21_readTemperature();
|
||||
float h_htu21 = htu21_readHumidity();
|
||||
h_htu21 = htu21_compensatedHumidity(h_htu21, t_htu21);
|
||||
dtostrf(t_htu21, 1, sysCfg.flag.temperature_resolution, stemp);
|
||||
dtostrfi(t_htu21, sysCfg.flag.temperature_resolution, stemp);
|
||||
snprintf_P(sensor, sizeof(sensor), HTTP_SNS_TEMP, htustype, stemp, tempUnit());
|
||||
page += sensor;
|
||||
dtostrf(h_htu21, 1, sysCfg.flag.humidity_resolution, stemp);
|
||||
dtostrfi(h_htu21, sysCfg.flag.humidity_resolution, stemp);
|
||||
snprintf_P(sensor, sizeof(sensor), HTTP_SNS_HUM, htustype, stemp);
|
||||
page += sensor;
|
||||
}
|
||||
|
|
|
@ -77,7 +77,7 @@ boolean sht_sendCommand(const byte cmd)
|
|||
}
|
||||
if (ackerror) {
|
||||
shttype = 0;
|
||||
addLog_P(LOG_LEVEL_DEBUG, PSTR("SHT1X: Sensor did not ACK command"));
|
||||
addLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_SHT1 D_SENSOR_DID_NOT_ACK_COMMAND));
|
||||
}
|
||||
return (!ackerror);
|
||||
}
|
||||
|
@ -91,7 +91,7 @@ boolean sht_awaitResult()
|
|||
}
|
||||
delay(20);
|
||||
}
|
||||
addLog_P(LOG_LEVEL_DEBUG, PSTR("SHT1X: Data not ready"));
|
||||
addLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_SHT1 D_SENSOR_BUSY));
|
||||
shttype = 0;
|
||||
return false;
|
||||
}
|
||||
|
@ -159,17 +159,6 @@ boolean sht_readTempHum(float &t, float &h)
|
|||
return (!isnan(t) && !isnan(h));
|
||||
}
|
||||
|
||||
boolean sht_readCharTempHum(char* temp, char* hum)
|
||||
{
|
||||
float t;
|
||||
float h;
|
||||
|
||||
boolean success = sht_readTempHum(t, h);
|
||||
dtostrf(t, 1, sysCfg.flag.temperature_resolution, temp);
|
||||
dtostrf(h, 1, sysCfg.flag.humidity_resolution, hum);
|
||||
return success;
|
||||
}
|
||||
|
||||
boolean sht_detect()
|
||||
{
|
||||
if (shttype) {
|
||||
|
@ -178,12 +167,12 @@ boolean sht_detect()
|
|||
|
||||
float t;
|
||||
float h;
|
||||
|
||||
|
||||
sht_sda_pin = pin[GPIO_I2C_SDA];
|
||||
sht_scl_pin = pin[GPIO_I2C_SCL];
|
||||
if (sht_readTempHum(t, h)) {
|
||||
shttype = 1;
|
||||
addLog_P(LOG_LEVEL_DEBUG, PSTR("I2C: SHT1X found"));
|
||||
addLog_P(LOG_LEVEL_DEBUG, PSTR(D_LOG_I2C D_SHT1X_FOUND));
|
||||
} else {
|
||||
Wire.begin(sht_sda_pin, sht_scl_pin);
|
||||
shttype = 0;
|
||||
|
@ -201,10 +190,15 @@ void sht_mqttPresent(char* svalue, uint16_t ssvalue, uint8_t* djson)
|
|||
return;
|
||||
}
|
||||
|
||||
char stemp[10];
|
||||
char shum[10];
|
||||
|
||||
if (sht_readCharTempHum(stemp, shum)) {
|
||||
float t;
|
||||
float h;
|
||||
|
||||
if (sht_readTempHum(t, h)) {
|
||||
char stemp[10];
|
||||
char shum[10];
|
||||
|
||||
dtostrfd(t, sysCfg.flag.temperature_resolution, stemp);
|
||||
dtostrfd(h, sysCfg.flag.humidity_resolution, shum);
|
||||
snprintf_P(svalue, ssvalue, JSON_SNS_TEMPHUM, svalue, "SHT1X", stemp, shum);
|
||||
*djson = 1;
|
||||
#ifdef USE_DOMOTICZ
|
||||
|
@ -216,13 +210,18 @@ void sht_mqttPresent(char* svalue, uint16_t ssvalue, uint8_t* djson)
|
|||
#ifdef USE_WEBSERVER
|
||||
String sht_webPresent()
|
||||
{
|
||||
float t;
|
||||
float h;
|
||||
|
||||
String page = "";
|
||||
if (shttype) {
|
||||
char stemp[10];
|
||||
char shum[10];
|
||||
|
||||
if (sht_readCharTempHum(stemp, shum)) {
|
||||
if (sht_readTempHum(t, h)) {
|
||||
char stemp[10];
|
||||
char shum[10];
|
||||
char sensor[80];
|
||||
|
||||
dtostrfi(t, sysCfg.flag.temperature_resolution, stemp);
|
||||
dtostrfi(h, sysCfg.flag.humidity_resolution, shum);
|
||||
snprintf_P(sensor, sizeof(sensor), HTTP_SNS_TEMP, "SHT1X", stemp, tempUnit());
|
||||
page += sensor;
|
||||
snprintf_P(sensor, sizeof(sensor), HTTP_SNS_HUM, "SHT1X", shum);
|
||||
|
@ -234,4 +233,3 @@ String sht_webPresent()
|
|||
#endif // USE_WEBSERVER
|
||||
#endif // USE_SHT
|
||||
#endif // USE_I2C
|
||||
|
||||
|
|
Loading…
Reference in New Issue