mirror of
https://github.com/letscontrolit/ESPEasy.git
synced 2026-07-27 19:57:38 +00:00
Merge branch 'mega' into feature/SPI-add-support-for-multiple-buses
This commit is contained in:
@@ -303,6 +303,18 @@
|
||||
|
||||
Example output: ``IP:192.168.10.86(DHCP)``"
|
||||
"
|
||||
Latitude","
|
||||
:red:`Internal`","
|
||||
Set the latitude for the unit, that's used when calculation the sunrise/sunset times.
|
||||
|
||||
``Latitude[,<degrees>]``
|
||||
|
||||
Range: -90 .. 90 (decimal, negative is southern hemisphere)
|
||||
|
||||
When no argument is provided, the current setting is shown.
|
||||
|
||||
See also ``Longitude``."
|
||||
"
|
||||
Let","
|
||||
:red:`Internal`","
|
||||
Set the value of variable n (1..INT_MAX), or use a variable name.
|
||||
@@ -344,6 +356,18 @@
|
||||
|
||||
``LogPortStatus``"
|
||||
"
|
||||
Longitude","
|
||||
:red:`Internal`","
|
||||
Set the longitude for the unit, that's used when calculation the sunrise/sunset times.
|
||||
|
||||
``Longitude[,<degrees>]``
|
||||
|
||||
Range: -180 .. 180 (decimal, negative is west of the prime meridian)
|
||||
|
||||
When no argument is provided, the current setting is shown.
|
||||
|
||||
See also ``Latitude``."
|
||||
"
|
||||
LoopTimerSet
|
||||
|
||||
LoopTimerSet_ms","
|
||||
|
||||
@@ -123,6 +123,14 @@ More uses of these system variables can be seen in the rules section and formula
|
||||
|
||||
Does not have the ``+xm`` and ``-xh`` calculations that ``%sunrise%`` and ``%sunset%`` support.
|
||||
-
|
||||
* - ``%latitude%``
|
||||
- 50.12345
|
||||
- Configured Latitude (decimal degrees) as used for calculating the sunrise and sunset times.
|
||||
-
|
||||
* - ``%longitude%``
|
||||
- 50.12345
|
||||
- Configured Longitude (decimal degrees) as used for calculating the sunrise and sunset times.
|
||||
-
|
||||
* - ``%lcltime_am%``
|
||||
- 2020-03-16 1:23:54 AM
|
||||
- Current date/time (AM/PM) if NTP is enabled (YYYY-MM-DD hh:mm:ss xM).
|
||||
|
||||
@@ -252,6 +252,23 @@
|
||||
// #define FEATURE_RTTTL_EVENTS 1 // Enable RTTTL events for Async use, for blocking it doesn't make sense
|
||||
// #define FEATURE_BUSCMD_STRING 1 // Enable support for String data-format in Helpers/BusCmd_Handler, default disabled for LIMIT_BUILD_SIZE only
|
||||
// #define FEATURE_STRING_VARIABLES 1 // Enable String variable support (enabled on ESP32, NOT supported on ESP8266 for memory restrictions!)
|
||||
// #define FEATURE_COMMAND_OWSCAN 0 // Disable 1-wire scanner support, only feasible when 1-wire support is included in the build (P004, P080, P100), default disabled for MINIMAL_OTA builds
|
||||
// #define FEATURE_MQTT_CONNECT_BACKGROUND 1 // Enable connecting to an MQTT broker in an ESP32 RTOS background thread (not possible on ESP8266)
|
||||
// #define FEATURE_I2C_MULTIPLE 0 // Disable multiple I2C buses, only available for ESP32, default enabled on ESP32, can be disabled here
|
||||
// #define FEATURE_PLUGIN_LIST 1 // Enable the Tools / Plugin list page (default enabled for ESP32)
|
||||
// #define FEATURE_LAT_LONG_VAR_CMD 1 // Enable the %latitude% and %longitude% system variables, and Latitude and Longitude commands (default enabled for ESP32)
|
||||
|
||||
// #define FEATURE_TASKVALUE_ATTRIBUTES 1 // Enable extra Task Value attributes (default enabled for ESP32)
|
||||
// #define FEATURE_TASKVALUE_UNIT_OF_MEASURE 1 // Enable Unit of Measure per Task Value (default enabled for ESP32), also useful for MQTT Discovery
|
||||
// #define FEATURE_CUSTOM_TASKVAR_VTYPE 1 // Enable Custom Value Type per Task Value (default enabled for ESP32), also useful for MQTT Discovery
|
||||
|
||||
// #define FEATURE_MQTT_DISCOVER 1 // Enable MQTT Auto Discovery (currently only available for Home Assistant C005)
|
||||
// #define FEATURE_MQTT_DEVICECLASS 1 // Enable selectable Device Class for Auto Discovery
|
||||
// #define FEATURE_MQTT_STATE_CLASS 1 // Enable selectable State Class per Task Valie for Auto Discovery
|
||||
|
||||
// #define FEATURE_MQTT_TLS 1 // Enable TLS support for MQTT Controller connections (only available on ESP32)
|
||||
// #define FEATURE_EMAIL_TLS 1 // Enable TLS support for Email Notifications (only available on ESP32)
|
||||
// #define FEATURE_HTTP_TLS 1 // Enable TLS support for HTTP connections (only available on ESP32)
|
||||
|
||||
#if FEATURE_CUSTOM_PROVISIONING
|
||||
// For device models, see src/src/DataTypes/DeviceModel.h
|
||||
|
||||
@@ -68,6 +68,7 @@ boolean Plugin_003(uint8_t function, struct EventStruct *event, String& string)
|
||||
dev.PluginStats = true;
|
||||
dev.TaskLogsOwnPeaks = true;
|
||||
dev.CustomVTypeVar = true;
|
||||
dev.MqttStateClass = true;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -235,3 +235,35 @@ String Command_GetORSetInt8_t(struct EventStruct *event,
|
||||
}
|
||||
return return_command_success();
|
||||
}
|
||||
|
||||
String Command_GetORSetFloatMinMax(struct EventStruct *event,
|
||||
const __FlashStringHelper *targetDescription,
|
||||
const char *Line,
|
||||
float *value,
|
||||
int arg,
|
||||
float _min,
|
||||
float _max)
|
||||
{
|
||||
bool hasArgument = false;
|
||||
{
|
||||
// Check if command is valid. Leave in separate scope to delete the TmpStr1
|
||||
String TmpStr1;
|
||||
|
||||
if (GetArgv(Line, TmpStr1, arg + 1)) {
|
||||
hasArgument = true;
|
||||
TmpStr1.toLowerCase();
|
||||
|
||||
float tmp_float{};
|
||||
|
||||
if (validFloatFromString(TmpStr1, tmp_float) &&
|
||||
definitelyGreaterThan(tmp_float, _min) &&
|
||||
definitelyLessThan(tmp_float, _max)) {
|
||||
*value = tmp_float;
|
||||
} else {
|
||||
return return_command_failed();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return return_result(event, concat(targetDescription, toString(*value)));
|
||||
}
|
||||
|
||||
@@ -66,4 +66,12 @@ String Command_GetORSetInt8_t(struct EventStruct *event,
|
||||
int8_t *value,
|
||||
int arg);
|
||||
|
||||
String Command_GetORSetFloatMinMax(struct EventStruct *event,
|
||||
const __FlashStringHelper * targetDescription,
|
||||
const char *Line,
|
||||
float *value,
|
||||
int arg,
|
||||
float _min,
|
||||
float _max);
|
||||
|
||||
#endif // COMMAND_COMMON_H
|
||||
|
||||
@@ -18,6 +18,10 @@
|
||||
#include "../Commands/InternalCommands_decoder.h"
|
||||
#include "../Commands/i2c.h"
|
||||
|
||||
#if FEATURE_LAT_LONG_VAR_CMD
|
||||
#include "../Commands/LatitudeLongitude.h"
|
||||
#endif // if FEATURE_LAT_LONG_VAR_CMD
|
||||
|
||||
#if FEATURE_MQTT
|
||||
# include "../Commands/MQTT.h"
|
||||
#endif // if FEATURE_MQTT
|
||||
@@ -319,12 +323,18 @@ bool InternalCommands::executeInternalCommand()
|
||||
#ifndef BUILD_NO_DIAGNOSTIC_COMMANDS
|
||||
case ESPEasy_cmd_e::jsonportstatus: COMMAND_CASE_A(Command_JSONPortStatus, -1); // Diagnostic.h
|
||||
#endif // ifndef BUILD_NO_DIAGNOSTIC_COMMANDS
|
||||
#if FEATURE_LAT_LONG_VAR_CMD
|
||||
case ESPEasy_cmd_e::latitude: COMMAND_CASE_A(Command_Latitude, -1); // LatitudeLongitude.h
|
||||
#endif // if FEATURE_LAT_LONG_VAR_CMD
|
||||
case ESPEasy_cmd_e::let: COMMAND_CASE_A(Command_Rules_Let, 2); // Rules.h
|
||||
#if FEATURE_STRING_VARIABLES
|
||||
case ESPEasy_cmd_e::letstr: COMMAND_CASE_A(Command_Rules_LetStr, 2); // Rules.h
|
||||
#endif // if FEATURE_STRING_VARIABLES
|
||||
case ESPEasy_cmd_e::load: COMMAND_CASE_A(Command_Settings_Load, 0); // Settings.h
|
||||
case ESPEasy_cmd_e::logentry: COMMAND_CASE_A(Command_logentry, -1); // Diagnostic.h
|
||||
#if FEATURE_LAT_LONG_VAR_CMD
|
||||
case ESPEasy_cmd_e::longitude: COMMAND_CASE_A(Command_Longitude, -1); // LatitudeLongitude.h
|
||||
#endif // if FEATURE_LAT_LONG_VAR_CMD
|
||||
case ESPEasy_cmd_e::looptimerset: COMMAND_CASE_A(Command_Loop_Timer_Set, 3); // Timers.h
|
||||
case ESPEasy_cmd_e::looptimerset_ms: COMMAND_CASE_A(Command_Loop_Timer_Set_ms, 3); // Timers.h
|
||||
case ESPEasy_cmd_e::looptimersetandrun: COMMAND_CASE_A(Command_Loop_Timer_SetAndRun, 3); // Timers.h
|
||||
|
||||
@@ -96,14 +96,24 @@ const char Internal_commands_fghij[] PROGMEM =
|
||||
#endif // ifndef BUILD_NO_DIAGNOSTIC_COMMANDS
|
||||
;
|
||||
|
||||
#if FEATURE_LAT_LONG_VAR_CMD
|
||||
#define Int_cmd_l_offset ESPEasy_cmd_e::latitude
|
||||
#else // if FEATURE_LAT_LONG_VAR_CMD
|
||||
#define Int_cmd_l_offset ESPEasy_cmd_e::let
|
||||
#endif // if FEATURE_LAT_LONG_VAR_CMD
|
||||
const char Internal_commands_l[] PROGMEM =
|
||||
#if FEATURE_LAT_LONG_VAR_CMD
|
||||
"latitude|"
|
||||
#endif // if FEATURE_LAT_LONG_VAR_CMD
|
||||
"let|"
|
||||
#if FEATURE_STRING_VARIABLES
|
||||
"letstr|"
|
||||
#endif
|
||||
"load|"
|
||||
"logentry|"
|
||||
#if FEATURE_LAT_LONG_VAR_CMD
|
||||
"longitude|"
|
||||
#endif // if FEATURE_LAT_LONG_VAR_CMD
|
||||
"looptimerset|"
|
||||
"looptimerset_ms|"
|
||||
"looptimersetandrun|"
|
||||
|
||||
@@ -76,12 +76,18 @@ enum class ESPEasy_cmd_e : uint8_t {
|
||||
jsonportstatus,
|
||||
#endif // ifndef BUILD_NO_DIAGNOSTIC_COMMANDS
|
||||
|
||||
#if FEATURE_LAT_LONG_VAR_CMD
|
||||
latitude,
|
||||
#endif // if FEATURE_LAT_LONG_VAR_CMD
|
||||
let,
|
||||
#if FEATURE_STRING_VARIABLES
|
||||
letstr,
|
||||
#endif // if FEATURE_STRING_VARIABLES
|
||||
load,
|
||||
logentry,
|
||||
#if FEATURE_LAT_LONG_VAR_CMD
|
||||
longitude,
|
||||
#endif // if FEATURE_LAT_LONG_VAR_CMD
|
||||
looptimerset,
|
||||
looptimerset_ms,
|
||||
looptimersetandrun,
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
#include "../Commands/Common.h"
|
||||
#include "../Commands/LatitudeLongitude.h"
|
||||
#include "../Globals/Settings.h"
|
||||
|
||||
String Command_Latitude(struct EventStruct *event,
|
||||
const char *Line) {
|
||||
return Command_GetORSetFloatMinMax(event, F("Latitude:"), Line, &Settings.Latitude, 1, -90.0001f, 90.0001f);
|
||||
}
|
||||
|
||||
String Command_Longitude(struct EventStruct *event,
|
||||
const char *Line) {
|
||||
return Command_GetORSetFloatMinMax(event, F("Longitude:"), Line, &Settings.Longitude, 1, -180.0001f, 180.0001f);
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
#include "../../ESPEasy_common.h"
|
||||
|
||||
String Command_Latitude(struct EventStruct *event,
|
||||
const char *Line);
|
||||
String Command_Longitude(struct EventStruct *event,
|
||||
const char *Line);
|
||||
@@ -4151,6 +4151,15 @@ To create/register a plugin, you have to :
|
||||
#define FEATURE_MQTT_CONNECT_BACKGROUND 0 // Disable always on ESP8266
|
||||
#endif // if defined(ESP8266) && FEATURE_MQTT_CONNECT_BACKGROUND
|
||||
|
||||
#ifndef FEATURE_LAT_LONG_VAR_CMD
|
||||
#ifdef ESP32
|
||||
#define FEATURE_LAT_LONG_VAR_CMD 1
|
||||
#endif
|
||||
#ifdef ESP8266
|
||||
#define FEATURE_LAT_LONG_VAR_CMD 0
|
||||
#endif
|
||||
#endif // ifndef FEATURE_LAT_LONG_VAR_CMD
|
||||
|
||||
//-------------------HTTPResponseParser Section----------------
|
||||
#ifndef FEATURE_THINGSPEAK_EVENT
|
||||
#if defined(PLUGIN_BUILD_MAX_ESP32)
|
||||
|
||||
@@ -219,7 +219,8 @@ const __FlashStringHelper * BusCmd_Helper_struct::cacheSuffix(BusCmd_CommandSour
|
||||
switch (source) {
|
||||
case BusCmd_CommandSource_e::PluginIdle:
|
||||
case BusCmd_CommandSource_e::PluginGetConfigVar:
|
||||
case BusCmd_CommandSource_e::PluginRead: return F("");
|
||||
case BusCmd_CommandSource_e::PluginRead:
|
||||
case BusCmd_CommandSource_e::PluginWrite: return F("");
|
||||
case BusCmd_CommandSource_e::PluginOncePerSecond: return F("_1ps");
|
||||
case BusCmd_CommandSource_e::PluginTenPerSecond: return F("_10ps");
|
||||
case BusCmd_CommandSource_e::PluginFiftyPerSecond: return F("_50ps");
|
||||
@@ -256,18 +257,20 @@ std::vector<BusCmd_Command_struct>BusCmd_Helper_struct::parseBusCmdCommands(cons
|
||||
|
||||
const String key = parseString(name, 1);
|
||||
String keyPostfix;
|
||||
const bool parseAndLogOK = ((BusCmd_CommandSource_e::PluginRead == _commandSource) ||
|
||||
(BusCmd_CommandSource_e::PluginGetConfigVar == _commandSource) ||
|
||||
(BusCmd_CommandSource_e::PluginWrite == _commandSource)
|
||||
);
|
||||
|
||||
if (!key.isEmpty() && (_commandCache.count(key) == 1) && !update) {
|
||||
commands = _commandCache.find(key)->second;
|
||||
|
||||
if (loglevelActiveFor(LOG_LEVEL_INFO) && _showLog && ((BusCmd_CommandSource_e::PluginRead == _commandSource) ||
|
||||
(BusCmd_CommandSource_e::PluginGetConfigVar == _commandSource))) {
|
||||
if (loglevelActiveFor(LOG_LEVEL_INFO) && _showLog && parseAndLogOK) {
|
||||
addLog(LOG_LEVEL_INFO, strformat(F("BUSCMD: Retrieve '%s' from cache with %d commands."), name.c_str(), commands.size()));
|
||||
}
|
||||
}
|
||||
|
||||
if (!line.isEmpty() && ((commands.empty()) || update) && ((BusCmd_CommandSource_e::PluginRead == _commandSource) ||
|
||||
(BusCmd_CommandSource_e::PluginGetConfigVar == _commandSource))) {
|
||||
if (!line.isEmpty() && ((commands.empty()) || update) && parseAndLogOK) {
|
||||
int evt = 1;
|
||||
|
||||
while (evt > 0) {
|
||||
@@ -322,8 +325,7 @@ std::vector<BusCmd_Command_struct>BusCmd_Helper_struct::parseBusCmdCommands(cons
|
||||
|
||||
#ifndef LIMIT_BUILD_SIZE
|
||||
|
||||
if (loglevelActiveFor(LOG_LEVEL_INFO) && _showLog && ((BusCmd_CommandSource_e::PluginRead == _commandSource) ||
|
||||
(BusCmd_CommandSource_e::PluginGetConfigVar == _commandSource))) {
|
||||
if (loglevelActiveFor(LOG_LEVEL_INFO) && _showLog && parseAndLogOK) {
|
||||
addLog(LOG_LEVEL_INFO, strformat(F("BUSCMD: Arguments parsed: %d (%s)"), args.size(), cmdAll.c_str()));
|
||||
}
|
||||
#endif // ifndef LIMIT_BUILD_SIZE
|
||||
@@ -528,6 +530,10 @@ bool BusCmd_Helper_struct::executeBusCmdCommands() {
|
||||
if ((nullptr == _iBusCmd_Handler) || !_iBusCmd_Handler->init()) {
|
||||
return result;
|
||||
}
|
||||
const bool parseAndLogOK = ((BusCmd_CommandSource_e::PluginRead == _commandSource) ||
|
||||
(BusCmd_CommandSource_e::PluginGetConfigVar == _commandSource) ||
|
||||
(BusCmd_CommandSource_e::PluginWrite == _commandSource)
|
||||
);
|
||||
|
||||
if (BusCmd_CommandState_e::Processing == _commandState) {
|
||||
_it = _commands.begin();
|
||||
@@ -928,8 +934,7 @@ bool BusCmd_Helper_struct::executeBusCmdCommands() {
|
||||
if (!newVar.isEmpty()) {
|
||||
setCustomStringVar(newVar, newCalc); // Assign string value to a string variable
|
||||
|
||||
if (loglevelActiveFor(LOG_LEVEL_INFO) && _showLog && ((BusCmd_CommandSource_e::PluginRead == _commandSource) ||
|
||||
(BusCmd_CommandSource_e::PluginGetConfigVar == _commandSource))) {
|
||||
if (loglevelActiveFor(LOG_LEVEL_INFO) && _showLog && parseAndLogOK) {
|
||||
addLog(LOG_LEVEL_INFO, strformat(F("BUSCMD: Calculation: %s -> LetStr,%s,%s"),
|
||||
toCalc.c_str(), newVar.c_str(), newCalc.c_str()));
|
||||
}
|
||||
@@ -938,8 +943,7 @@ bool BusCmd_Helper_struct::executeBusCmdCommands() {
|
||||
#endif // if FEATURE_BUSCMD_STRING && FEATURE_STRING_VARIABLES
|
||||
|
||||
if (Calculate(newCalc, tmp) == CalculateReturnCode::OK) {
|
||||
if (loglevelActiveFor(LOG_LEVEL_INFO) && _showLog && ((BusCmd_CommandSource_e::PluginRead == _commandSource) ||
|
||||
(BusCmd_CommandSource_e::PluginGetConfigVar == _commandSource))) {
|
||||
if (loglevelActiveFor(LOG_LEVEL_INFO) && _showLog && parseAndLogOK) {
|
||||
addLog(LOG_LEVEL_INFO, strformat(F("BUSCMD: Calculation: %s, result: %s"), toCalc.c_str(), doubleToString(tmp).c_str()));
|
||||
}
|
||||
|
||||
@@ -1058,18 +1062,18 @@ bool BusCmd_Helper_struct::executeBusCmdCommands() {
|
||||
}
|
||||
}
|
||||
#ifndef LIMIT_BUILD_SIZE
|
||||
if (loglevelActiveFor(LOG_LEVEL_INFO) && _showLog && ((BusCmd_CommandSource_e::PluginRead == _commandSource) ||
|
||||
(BusCmd_CommandSource_e::PluginGetConfigVar == _commandSource))) {
|
||||
#if FEATURE_USE_DOUBLE_AS_ESPEASY_RULES_FLOAT_TYPE
|
||||
|
||||
if (loglevelActiveFor(LOG_LEVEL_INFO) && _showLog && parseAndLogOK) {
|
||||
# if FEATURE_USE_DOUBLE_AS_ESPEASY_RULES_FLOAT_TYPE
|
||||
const String valStr = doubleToString(_value, 2, true);
|
||||
#else // if FEATURE_USE_DOUBLE_AS_ESPEASY_RULES_FLOAT_TYPE
|
||||
# else // if FEATURE_USE_DOUBLE_AS_ESPEASY_RULES_FLOAT_TYPE
|
||||
const String valStr = toString(_value, 2, true);
|
||||
#endif // if FEATURE_USE_DOUBLE_AS_ESPEASY_RULES_FLOAT_TYPE
|
||||
# endif // if FEATURE_USE_DOUBLE_AS_ESPEASY_RULES_FLOAT_TYPE
|
||||
|
||||
addLog(LOG_LEVEL_INFO, strformat(F("BUSCMD: Executing command: %s, value[%d]:(%c): %s"),
|
||||
_it->toString().c_str(), _varIndex, _valueIsSet ? 't' : 'f', valStr.c_str()));
|
||||
}
|
||||
#endif
|
||||
#endif // ifndef LIMIT_BUILD_SIZE
|
||||
++_it; // Next command
|
||||
|
||||
while (toSkip > 0 && _it != _commands.end()) {
|
||||
@@ -1206,7 +1210,9 @@ bool BusCmd_Helper_struct::processCommands(struct EventStruct *event) {
|
||||
|
||||
_commands = parseBusCmdCommands(cacheName, // PluginOnce/Ten/Fifty-PerSecond must come from cache
|
||||
(BusCmd_CommandSource_e::PluginRead == _commandSource) ||
|
||||
(BusCmd_CommandSource_e::PluginGetConfigVar == _commandSource) ? buf.commandSet : EMPTY_STRING);
|
||||
(BusCmd_CommandSource_e::PluginGetConfigVar == _commandSource) ||
|
||||
(BusCmd_CommandSource_e::PluginWrite == _commandSource)
|
||||
? buf.commandSet : EMPTY_STRING);
|
||||
}
|
||||
_varIndex = _loop;
|
||||
}
|
||||
@@ -1226,7 +1232,9 @@ bool BusCmd_Helper_struct::processCommands(struct EventStruct *event) {
|
||||
|
||||
_commands = parseBusCmdCommands(cacheName, // PluginOnce/Ten/Fifty-PerSecond must come from cache
|
||||
(BusCmd_CommandSource_e::PluginRead == _commandSource) ||
|
||||
(BusCmd_CommandSource_e::PluginGetConfigVar == _commandSource) ? buf.commandSet : EMPTY_STRING);
|
||||
(BusCmd_CommandSource_e::PluginGetConfigVar == _commandSource) ||
|
||||
(BusCmd_CommandSource_e::PluginWrite == _commandSource)
|
||||
? buf.commandSet : EMPTY_STRING);
|
||||
_varIndex = _loop;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,6 +72,7 @@ enum class BusCmd_CommandState_e :uint8_t {
|
||||
enum class BusCmd_CommandSource_e : uint8_t {
|
||||
PluginIdle = 0u,
|
||||
PluginRead,
|
||||
PluginWrite,
|
||||
PluginOncePerSecond,
|
||||
PluginTenPerSecond,
|
||||
PluginFiftyPerSecond,
|
||||
@@ -189,6 +190,14 @@ struct BusCmd_Helper_struct {
|
||||
const String& name,
|
||||
const String& line);
|
||||
|
||||
inline void setCommandSource(BusCmd_CommandSource_e commandSource) {
|
||||
_commandSource = commandSource;
|
||||
}
|
||||
|
||||
inline BusCmd_CommandSource_e getCommandSource() const {
|
||||
return _commandSource;
|
||||
}
|
||||
|
||||
// Getters
|
||||
BusCmd_CommandState_e getCommandState() const {
|
||||
return _commandState;
|
||||
|
||||
@@ -112,6 +112,10 @@ LabelType::Enum SystemVariables2LabelType(SystemVariables::Enum enumval) {
|
||||
case SystemVariables::ETHSPEEDSTATE: label = LabelType::ETH_SPEED_STATE; break;
|
||||
#endif // if FEATURE_ETHERNET
|
||||
case SystemVariables::LCLTIME: label = LabelType::LOCAL_TIME; break;
|
||||
#if FEATURE_LAT_LONG_VAR_CMD
|
||||
case SystemVariables::LATITUDE: label = LabelType::LATITUDE; break;
|
||||
case SystemVariables::LONGITUDE: label = LabelType::LONGITUDE; break;
|
||||
#endif // if FEATURE_LAT_LONG_VAR_CMD
|
||||
case SystemVariables::MAC: label = LabelType::STA_MAC; break;
|
||||
case SystemVariables::RSSI: label = LabelType::WIFI_RSSI; break;
|
||||
case SystemVariables::SUNRISE_S: label = LabelType::SUNRISE_S; break;
|
||||
@@ -608,6 +612,10 @@ const __FlashStringHelper * SystemVariables::toFlashString(SystemVariables::Enum
|
||||
case Enum::LCLTIME: return F("lcltime");
|
||||
case Enum::LCLTIME_AM: return F("lcltime_am");
|
||||
case Enum::LF: return F("LF");
|
||||
#if FEATURE_LAT_LONG_VAR_CMD
|
||||
case Enum::LATITUDE: return F("latitude");
|
||||
case Enum::LONGITUDE: return F("longitude");
|
||||
#endif // if FEATURE_LAT_LONG_VAR_CMD
|
||||
case Enum::SUNRISE_M: return F("m_sunrise");
|
||||
case Enum::SUNSET_M: return F("m_sunset");
|
||||
case Enum::MAC: return F("mac");
|
||||
|
||||
@@ -55,6 +55,10 @@ public:
|
||||
LCLTIME,
|
||||
LCLTIME_AM,
|
||||
LF,
|
||||
#if FEATURE_LAT_LONG_VAR_CMD
|
||||
LATITUDE,
|
||||
LONGITUDE,
|
||||
#endif // if FEATURE_LAT_LONG_VAR_CMD
|
||||
SUNRISE_M,
|
||||
SUNSET_M,
|
||||
MAC,
|
||||
|
||||
@@ -471,9 +471,9 @@ const __FlashStringHelper* MQTT_sensor_StateClass(uint8_t index,
|
||||
switch (index) {
|
||||
case 0: return F("");
|
||||
case 1: return display ? F("Measurement") : F("measurement");
|
||||
case 2: return display ? F("Total") : F("total");
|
||||
case 3: return display ? F("Total-increasing") : F("total_increasing");
|
||||
case 4: return display ? F("Measurement-angle") : F("measurement_angle");
|
||||
case 2: return display ? F("Measurement-angle") : F("measurement_angle");
|
||||
case 3: return display ? F("Total") : F("total");
|
||||
case 4: return display ? F("Total-increasing") : F("total_increasing");
|
||||
}
|
||||
return F("");
|
||||
}
|
||||
|
||||
@@ -145,7 +145,10 @@ bool P180_data_struct::plugin_write(struct EventStruct *event,
|
||||
cacheName = parseString(string, 5);
|
||||
}
|
||||
|
||||
BusCmd_CommandSource_e old = busCmd_Helper->getCommandSource();
|
||||
busCmd_Helper->setCommandSource(BusCmd_CommandSource_e::PluginWrite);
|
||||
cmds = busCmd_Helper->parseBusCmdCommands(cacheName, par3, !cacheName.isEmpty());
|
||||
busCmd_Helper->setCommandSource(old);
|
||||
} else if (equals(sub, F("exec")) && hasPar3 && hasBusCmd) { // genI2c,exec,<cache_name>[,<TaskValueIndex>]
|
||||
cmds = busCmd_Helper->parseBusCmdCommands(par3, EMPTY_STRING); // Fetch commands from cache by name
|
||||
} else if (equals(sub, F("log")) && hasPar3) { // genI2c,log,<1|0>
|
||||
|
||||
@@ -1861,9 +1861,9 @@ void devicePage_show_task_values(taskIndex_t taskIndex, deviceIndex_t DeviceInde
|
||||
const __FlashStringHelper *stateClasses[] = {
|
||||
MQTT_sensor_StateClass(0),
|
||||
MQTT_sensor_StateClass(1),
|
||||
MQTT_sensor_StateClass(4),
|
||||
MQTT_sensor_StateClass(2),
|
||||
MQTT_sensor_StateClass(3),
|
||||
MQTT_sensor_StateClass(4),
|
||||
};
|
||||
constexpr size_t stateCount = NR_ELEMENTS(stateClasses);
|
||||
#endif // if FEATURE_MQTT_STATE_CLASS
|
||||
|
||||
@@ -260,7 +260,11 @@ void handle_sysvars() {
|
||||
F("%s_sunset%"),
|
||||
F("%s_sunrise%"),
|
||||
F("%m_sunset%"),
|
||||
F("%m_sunrise%")
|
||||
F("%m_sunrise%"),
|
||||
#if FEATURE_LAT_LONG_VAR_CMD
|
||||
F("%latitude%"),
|
||||
F("%longitude%"),
|
||||
#endif // if FEATURE_LAT_LONG_VAR_CMD
|
||||
};
|
||||
|
||||
for (unsigned int i = 0; i < NR_ELEMENTS(vars); ++i) {
|
||||
|
||||
+2
-2
@@ -6,7 +6,7 @@ var commonAtoms = ["And", "Or"];
|
||||
var commonKeywords = ["If", "Else", "Elseif", "Endif"];
|
||||
var commonCommands = ["AccessInfo", "Background", "Build", "ClearAccessBlock", "ClearRTCam", "Config", "ControllerDisable",
|
||||
"ControllerEnable", "DateTime", "Debug", "Dec", "DeepSleep", "DisablePriorityTask", "DNS", "DST", "EraseSDKWiFi", "ExecuteRules", "FactoryReset", "Gateway", "I2Cscanner", "Inc",
|
||||
"IP", "Let", "LetStr", "Load", "LogEntry", "LogPortStatus", "LoopTimerSet", "LoopTimerSet_ms", "LoopTimerSetAndRun", "LoopTimerSetAndRun_ms", "MemInfo", "MemInfoDetail", "Name", "Password", "PostToHTTP", "PostToHTTPS", "Publish", "PublishR",
|
||||
"IP", "Latitude", "Let", "LetStr", "Load", "LogEntry", "LogPortStatus", "Longitude", "LoopTimerSet", "LoopTimerSet_ms", "LoopTimerSetAndRun", "LoopTimerSetAndRun_ms", "MemInfo", "MemInfoDetail", "Name", "Password", "PostToHTTP", "PostToHTTPS", "Publish", "PublishR",
|
||||
"PutToHTTP", "PutToHTTPS", "Reboot", "Save", "SendTo", "SendToHTTP", "SendToHTTPS", "SendToUDP", "SendToUDPMix", "Settings", "Subnet", "Subscribe", "TaskClear", "TaskClearAll",
|
||||
"TaskDisable", "TaskEnable", "TaskRun", "TaskValueSet", "TaskValueSetAndRun", "TaskValueSetDerived", "TaskValueSetPresentation", "TimerPause", "TimerResume", "TimerSet", "TimerSet_ms", "TimeZone",
|
||||
"UdpPort", "UdpTest", "Unit", "UseNTP", "WdConfig", "WdRead", "WiFi", "WiFiAllowAP", "WiFiAPMode", "WiFiConnect", "WiFiDisconnect", "WiFiKey",
|
||||
@@ -167,7 +167,7 @@ var AnythingElse = [
|
||||
//System Variables
|
||||
"%eventvalue%", "%eventpar%", "%eventname%", "%sysname%", "%bootcause%", "%systime%", "%systm_hm%",
|
||||
"%systm_hm_0%", "%systm_hm_sp%", "%systime_am%", "%systime_am_0%", "%systime_am_sp%", "%systm_hm_am%", "%systm_hm_am_0%", "%systm_hm_am_sp%",
|
||||
"%lcltime%", "%sunrise%", "%s_sunrise%", "%m_sunrise%", "%sunset%", "%s_sunset%", "%m_sunset%", "%lcltime_am%",
|
||||
"%lcltime%", "%sunrise%", "%s_sunrise%", "%m_sunrise%", "%sunset%", "%s_sunset%", "%m_sunset%", "%lcltime_am%", "%latitude%", "%longitude%",
|
||||
"%syshour%", "%syshour_0%", "%sysmin%", "%sysmin_0%", "%syssec%", "%syssec_0%", "%sysday%", "%sysday_0%", "%sysmonth%",
|
||||
"%sysmonth_0%", "%systzoffset%", "%systzoffset_s%", "%sysyear%", "%sysyear_0%", "%sysyears%", "%sysweekday%", "%sysweekday_s%", "%unixtime%", "%unixtime_lcl%", "%uptime%", "%uptime_ms%",
|
||||
"%rssi%", "%ip%", "%unit%", "%unit_0%", "%ssid%", "%bssid%", "%wi_ch%", "%iswifi%", "%vcc%", "%mac%", "%mac_int%", "%isntp%", "%ismqtt%",
|
||||
|
||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user