mirror of
https://github.com/letscontrolit/ESPEasy.git
synced 2026-07-28 04:07:47 +00:00
[docs] added rules example + fixed S11 (P052) links
This commit is contained in:
@@ -28,8 +28,8 @@
|
||||
.. |P052_status| replace:: :green:`NORMAL`
|
||||
.. |P052_github| replace:: P052_SenseAir.ino
|
||||
.. _P052_github: https://github.com/letscontrolit/ESPEasy/blob/mega/src/_P052_SenseAir.ino
|
||||
.. |P052_usedby| replace:: :ref:`P052_S8_page`, :ref:`P052_tSense_K70_page`
|
||||
.. |P052_shortinfo| replace:: The Senseair plugin can be used for multiple gas sensors from the company Senseair. The mostly used sensor is the S8 but other sensor units that work is tSense (K70), K30, K33, S8 (and soon LP8).
|
||||
.. |P052_usedby| replace:: :ref:`P052_S8_page`, :ref:`P052_S11_page`, :ref:`P052_tSense_K70_page`
|
||||
.. |P052_shortinfo| replace:: The Senseair plugin can be used for multiple gas sensors from the company Senseair. The mostly used sensor is the S8 but other sensor units that work is tSense (K70), K30, K33, S8, LP8, S11.
|
||||
.. |P052_maintainer| replace:: `.`
|
||||
.. |P052_compileinfo| replace:: `.`
|
||||
.. |P052_usedlibraries| replace:: `.`
|
||||
|
||||
@@ -948,3 +948,35 @@ button in less than a second or press it for more than a second:
|
||||
//Action if button is still pressed
|
||||
endif
|
||||
endon
|
||||
|
||||
Calculating water consumption
|
||||
-----------------------------
|
||||
|
||||
Using the pulse counter you can calculate and act on waterflow and changes like this:
|
||||
|
||||
.. code-block:: html
|
||||
|
||||
On System#Boot do // When the ESP boots, do
|
||||
TaskValueSet,3,1,0 // TaskValueSet TASKnr,VARnr,Value, Reset the Liters counter to 0
|
||||
TaskValueSet,3,2,0 // TaskValueSet TASKnr,VARnr,Value, Reset the PreviousLiters counter to 0
|
||||
TaskValueSet,3,3,0 // TaskValueSet TASKnr,VARnr,Value, Reset the Flow counter to 0
|
||||
TaskValueSet,3,4,0 // TaskValueSet TASKnr,VARnr,Value, Reset the PreviousFlow counter to 0
|
||||
TimerSet,1,30 // Set Timer 1 for the next event in 30 seconds
|
||||
EndOn
|
||||
|
||||
On Watermeter#Count do // When Pulse is detected
|
||||
if [Watermeter#Count] > 0
|
||||
SendToHTTP,192.168.1.50,8084,/json.htm?type=command¶m=udevice&idx=337&nvalue=0&svalue=1
|
||||
TaskValueSet,3,3,60000/[Watermeter#Time]
|
||||
SendToHTTP,192.168.1.50,8084,/json.htm?type=command¶m=udevice&idx=338&nvalue=0&svalue=[Liters#Flow]
|
||||
endif
|
||||
EndOn
|
||||
|
||||
On Rules#Timer=1 do // When Timer 1 expires, do
|
||||
if [Liters#Flow] > 0 or [Liters#PreviousFlow] > 0 // Only send value if amount of Liters > 0
|
||||
SendToHTTP,192.168.1.50,8084,/json.htm?type=command¶m=udevice&idx=338&nvalue=0&svalue=[Liters#Flow]
|
||||
TaskValueSet,3,4,[Liters#Flow] // set flow to previous counter
|
||||
TaskValueSet,3,3,0
|
||||
endif
|
||||
TimerSet,1,30 // Set Timer 1 for the next event in 30 seconds
|
||||
Endon
|
||||
|
||||
@@ -55,6 +55,16 @@ build_flags = ${regular_platform.build_flags}
|
||||
lib_ignore = ESP32_ping, ESP32WebServer
|
||||
extra_scripts = pre:pre_custom_esp82xx.py
|
||||
|
||||
; Custom: 1M version --------------------------
|
||||
[env:custom_ESP8266_1M]
|
||||
extends = esp8266_1M
|
||||
platform = ${regular_platform.platform}
|
||||
platform_packages = ${regular_platform.platform_packages}
|
||||
build_flags = ${regular_platform.build_flags}
|
||||
${esp8266_1M.build_flags}
|
||||
-DPLUGIN_BUILD_CUSTOM
|
||||
lib_ignore = ESP32_ping, ESP32WebServer, ESP8266WiFiMesh
|
||||
extra_scripts = pre:pre_custom_esp82xx.py
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -739,6 +739,12 @@ void run10TimesPerSecond() {
|
||||
PluginCall(PLUGIN_MONITOR, 0, dummy);
|
||||
STOP_TIMER(PLUGIN_CALL_10PSU);
|
||||
}
|
||||
{
|
||||
START_TIMER;
|
||||
CPluginCall(CPLUGIN_TEN_PER_SECOND, 0, dummy);
|
||||
STOP_TIMER(CPLUGIN_CALL_10PS);
|
||||
}
|
||||
|
||||
if (Settings.UseRules)
|
||||
{
|
||||
processNextEvent();
|
||||
|
||||
@@ -56,14 +56,15 @@
|
||||
#define CPLUGIN_INIT 50
|
||||
#define CPLUGIN_UDP_IN 51
|
||||
#define CPLUGIN_FLUSH 52 // Force offloading data stored in buffers, called before sleep/reboot
|
||||
#define CPLUGIN_TEN_PER_SECOND 53 // Called 10x per second (typical for checking new data instead of waiting)
|
||||
|
||||
// new messages for autodiscover controller plugins (experimental) i.e. C014
|
||||
#define CPLUGIN_GOT_CONNECTED 53 // call after connected to mqtt server to publich device autodicover features
|
||||
#define CPLUGIN_GOT_INVALID 54 // should be called before major changes i.e. changing the device name to clean up data on the controller. !ToDo
|
||||
#define CPLUGIN_INTERVAL 55 // call every interval loop
|
||||
#define CPLUGIN_ACKNOWLEDGE 56 // call for sending acknowledges !ToDo done by direct function call in PluginCall() for now.
|
||||
#define CPLUGIN_GOT_CONNECTED 54 // call after connected to mqtt server to publich device autodicover features
|
||||
#define CPLUGIN_GOT_INVALID 55 // should be called before major changes i.e. changing the device name to clean up data on the controller. !ToDo
|
||||
#define CPLUGIN_INTERVAL 56 // call every interval loop
|
||||
#define CPLUGIN_ACKNOWLEDGE 57 // call for sending acknowledges !ToDo done by direct function call in PluginCall() for now.
|
||||
|
||||
#define CPLUGIN_WEBFORM_SHOW_HOST_CONFIG 57 // Used for showing host information for the controller.
|
||||
#define CPLUGIN_WEBFORM_SHOW_HOST_CONFIG 58 // Used for showing host information for the controller.
|
||||
|
||||
|
||||
|
||||
|
||||
+5
-3
@@ -9,9 +9,11 @@
|
||||
// The "Host name" should match exactly the EspEasy name (Config -> Unit Name)
|
||||
// Add a group (mandatory) and hit add. No need to set up IP address or agent.
|
||||
// Go to the newly created host ->Items ->Create Item
|
||||
// Nane the item something descriptive
|
||||
// Name the item something descriptive
|
||||
// For Key add the EspEasy task Value name (case sensitive)
|
||||
// Type of information select "Numeric (float)" and press add. Thats it.
|
||||
// Type of information select "Numeric (float)" and press add.
|
||||
// Aslo make sure that you enable send to controller (under Data Acquisition in tasks)
|
||||
// and set an interval because you need to actively send the data to Zabbix
|
||||
|
||||
#define CPLUGIN_017
|
||||
#define CPLUGIN_ID_017 17
|
||||
@@ -123,4 +125,4 @@ bool do_process_c017_delay_queue(int controller_number, const C017_queue_element
|
||||
client.stop();
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
+1
-1
@@ -226,7 +226,7 @@ boolean Plugin_012(byte function, struct EventStruct *event, String& string)
|
||||
success = true;
|
||||
int colPos = event->Par2 - 1;
|
||||
int rowPos = event->Par1 - 1;
|
||||
String text = parseString(string, 4);
|
||||
String text = parseStringKeepCase(string, 4);
|
||||
text = P012_parseTemplate(text, Plugin_012_cols);
|
||||
|
||||
//clear line before writing new string
|
||||
|
||||
+14
-1
@@ -17,6 +17,7 @@
|
||||
// IF the IR code is an Air Condition protocol that the IR library can decode, then there will be a human-readable description of that IR message.
|
||||
// If the IR library can encode those kind of messages then a JSON formated command will be given, that can be replayed by P035 as well.
|
||||
// That commands format is: IRSENDAC,'{"protocol":"COOLIX","power":"on","mode":"dry","fanspeed":"auto","temp":22,"swingv":"max","swingh":"off"}'
|
||||
#include <ArduinoJson.h>
|
||||
#include <IRremoteESP8266.h>
|
||||
#include <IRutils.h>
|
||||
#include <IRrecv.h>
|
||||
@@ -266,7 +267,7 @@ boolean Plugin_016(byte function, struct EventStruct *event, String &string)
|
||||
doc[F("turbo")] = IRac::boolToString(state.turbo); //Turbo setting ON or OFF
|
||||
if (state.econo)
|
||||
doc[F("econo")] = IRac::boolToString(state.econo); //Economy setting ON or OFF
|
||||
if (state.light)
|
||||
if (!state.light)
|
||||
doc[F("light")] = IRac::boolToString(state.light); //Light setting ON or OFF
|
||||
if (state.filter)
|
||||
doc[F("filter")] = IRac::boolToString(state.filter); //Filter setting ON or OFF
|
||||
@@ -447,3 +448,15 @@ unsigned int storeB32Hex(char out[], unsigned int iOut, unsigned int val)
|
||||
#endif //P016_P035_RAW_RAW2
|
||||
|
||||
#endif // USES_P016
|
||||
|
||||
void enableIR_RX(boolean enable)
|
||||
{
|
||||
#ifdef PLUGIN_016
|
||||
if (irReceiver == 0) return;
|
||||
if (enable) {
|
||||
irReceiver->enableIRIn(); // Start the receiver
|
||||
} else {
|
||||
irReceiver->disableIRIn(); // Stop the receiver
|
||||
}
|
||||
#endif //PLUGIN_016
|
||||
}
|
||||
|
||||
+1
-1
@@ -110,7 +110,7 @@ boolean Plugin_033(byte function, struct EventStruct *event, String& string)
|
||||
log += F(" value ");
|
||||
log += event->Par2;
|
||||
log += F(" parameter3: ");
|
||||
log += parseString(string, 4);
|
||||
log += parseStringKeepCase(string, 4);
|
||||
log += F(" not a float value!");
|
||||
addLog(LOG_LEVEL_ERROR,log);
|
||||
}
|
||||
|
||||
+3
-15
@@ -31,7 +31,7 @@
|
||||
// - "sleep" Nr. of mins of sleep mode, or use sleep mode. (<= 0 means off.)
|
||||
// - "clock" Nr. of mins past midnight to set the clock to. (< 0 means off.)
|
||||
// - "model" . Nr or string representation of the model. Better to find it throught P016 - IR RX (0 means default.)
|
||||
|
||||
#include <ArduinoJson.h>
|
||||
#include <IRremoteESP8266.h>
|
||||
#include <IRac.h>
|
||||
#include <IRutils.h>
|
||||
@@ -207,7 +207,7 @@ boolean handleIRremote(const String &cmd) {
|
||||
|
||||
boolean handle_AC_IRremote(const String &cmd) {
|
||||
String irData = "";
|
||||
StaticJsonDocument<300> doc;
|
||||
StaticJsonDocument<JSON_OBJECT_SIZE(18) + 190> doc;
|
||||
|
||||
int argIndex = cmd.indexOf(',') + 1;
|
||||
if (argIndex)
|
||||
@@ -252,7 +252,7 @@ boolean handle_AC_IRremote(const String &cmd) {
|
||||
tempstr = doc[F("econo")].as<String>();
|
||||
st.econo = IRac::strToBool(tempstr.c_str(), false); //Economy setting ON or OFF. Defaults to false if missing from JSON
|
||||
tempstr = doc[F("light")].as<String>();
|
||||
st.light = IRac::strToBool(tempstr.c_str(), false); //Light setting ON or OFF. Defaults to false if missing from JSON
|
||||
st.light = IRac::strToBool(tempstr.c_str(), true); //Light setting ON or OFF. Defaults to true if missing from JSON
|
||||
tempstr = doc[F("filter")].as<String>();
|
||||
st.filter = IRac::strToBool(tempstr.c_str(), false); //Filter setting ON or OFF. Defaults to false if missing from JSON
|
||||
tempstr = doc[F("clean")].as<String>();
|
||||
@@ -483,18 +483,6 @@ boolean addErrorTrue()
|
||||
return true;
|
||||
}
|
||||
|
||||
void enableIR_RX(boolean enable)
|
||||
{
|
||||
#ifdef PLUGIN_016
|
||||
if (irReceiver == 0) return;
|
||||
if (enable) {
|
||||
irReceiver->enableIRIn(); // Start the receiver
|
||||
} else {
|
||||
irReceiver->disableIRIn(); // Stop the receiver
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
// A lot of the following code has been taken directly (with permission) from the IRMQTTServer.ino example code
|
||||
// of the IRremoteESP8266 library. (https://github.com/markszabo/IRremoteESP8266)
|
||||
|
||||
|
||||
@@ -209,15 +209,9 @@ boolean Plugin_088(byte function, struct EventStruct *event, String& string)
|
||||
|
||||
if (strcmp_P(heatpumpModel.c_str(), shortName) == 0)
|
||||
{
|
||||
#ifdef PLUGIN_016
|
||||
if (irReceiver != 0)
|
||||
irReceiver->disableIRIn(); // Stop the receiver
|
||||
#endif
|
||||
enableIR_RX(false);
|
||||
heatpumpIR[i]->send(*Plugin_088_irSender, powerMode, operatingMode, fanSpeed, temperature, vDir, hDir);
|
||||
#ifdef PLUGIN_016
|
||||
if (irReceiver != 0)
|
||||
irReceiver->enableIRIn(); // Start the receiver
|
||||
#endif
|
||||
enableIR_RX(true);
|
||||
addLog(LOG_LEVEL_INFO, F("P088: Heatpump IR code transmitted"));
|
||||
#ifdef IR_DEBUG_PACKET
|
||||
addLog(LOG_LEVEL_DEBUG, IRPacket);
|
||||
@@ -269,15 +263,9 @@ boolean Plugin_088(byte function, struct EventStruct *event, String& string)
|
||||
{
|
||||
PanasonicCKPHeatpumpIR *panasonicHeatpumpIR = new PanasonicCKPHeatpumpIR();
|
||||
|
||||
#ifdef PLUGIN_016
|
||||
if (irReceiver != 0)
|
||||
irReceiver->disableIRIn(); // Stop the receiver
|
||||
#endif
|
||||
enableIR_RX(false);
|
||||
panasonicHeatpumpIR->sendPanasonicCKPCancelTimer(*Plugin_088_irSender);
|
||||
#ifdef PLUGIN_016
|
||||
if (irReceiver != 0)
|
||||
irReceiver->enableIRIn(); // Start the receiver
|
||||
#endif
|
||||
enableIR_RX(true);
|
||||
addLog(LOG_LEVEL_INFO, F("P088: The TIMER led on Panasonic CKP should now be OFF"));
|
||||
}
|
||||
}
|
||||
@@ -294,5 +282,4 @@ boolean Plugin_088(byte function, struct EventStruct *event, String& string)
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
#endif // USES_P088
|
||||
|
||||
+4
-3
@@ -159,7 +159,7 @@ bool CPluginCall(byte Function, struct EventStruct *event, String& str)
|
||||
|
||||
switch (Function)
|
||||
{
|
||||
// Unconditional calls to all plugins
|
||||
// Unconditional calls to all controllers
|
||||
case CPLUGIN_PROTOCOL_ADD:
|
||||
|
||||
for (byte x = 0; x < CPLUGIN_MAX; x++) {
|
||||
@@ -181,13 +181,14 @@ bool CPluginCall(byte Function, struct EventStruct *event, String& str)
|
||||
break;
|
||||
|
||||
|
||||
// calls to active plugins
|
||||
// calls to all active controllers
|
||||
case CPLUGIN_INIT:
|
||||
case CPLUGIN_UDP_IN:
|
||||
case CPLUGIN_INTERVAL: // calls to send stats information
|
||||
case CPLUGIN_GOT_CONNECTED: // calls to send autodetect information
|
||||
case CPLUGIN_GOT_INVALID: // calls to mark unit as invalid
|
||||
case CPLUGIN_FLUSH:
|
||||
case CPLUGIN_TEN_PER_SECOND:
|
||||
|
||||
for (byte x = 0; x < CONTROLLER_MAX; x++) {
|
||||
if ((Settings.Protocol[x] != 0) && Settings.ControllerEnabled[x]) {
|
||||
@@ -199,7 +200,7 @@ bool CPluginCall(byte Function, struct EventStruct *event, String& str)
|
||||
return true;
|
||||
break;
|
||||
|
||||
case CPLUGIN_ACKNOWLEDGE: // calls to send acknolages back to controller
|
||||
case CPLUGIN_ACKNOWLEDGE: // calls to send acknowledge back to controller
|
||||
|
||||
for (byte x = 0; x < CONTROLLER_MAX; x++) {
|
||||
if ((Settings.Protocol[x] != 0) && Settings.ControllerEnabled[x]) {
|
||||
|
||||
@@ -22,52 +22,53 @@
|
||||
# define PLUGIN_CALL_10PSU 5
|
||||
# define PLUGIN_CALL_1PS 6
|
||||
# define SENSOR_SEND_TASK 7
|
||||
# define SEND_DATA_STATS 8
|
||||
# define COMPUTE_FORMULA_STATS 9
|
||||
# define PROC_SYS_TIMER 10
|
||||
# define SET_NEW_TIMER 11
|
||||
# define TIME_DIFF_COMPUTE 12
|
||||
# define MQTT_DELAY_QUEUE 13
|
||||
# define C001_DELAY_QUEUE 14
|
||||
# define C002_DELAY_QUEUE 15
|
||||
# define C003_DELAY_QUEUE 16
|
||||
# define C004_DELAY_QUEUE 17
|
||||
# define C005_DELAY_QUEUE 18
|
||||
# define C006_DELAY_QUEUE 19
|
||||
# define C007_DELAY_QUEUE 20
|
||||
# define C008_DELAY_QUEUE 21
|
||||
# define C009_DELAY_QUEUE 22
|
||||
# define C010_DELAY_QUEUE 23
|
||||
# define C011_DELAY_QUEUE 24
|
||||
# define C012_DELAY_QUEUE 25
|
||||
# define C013_DELAY_QUEUE 26
|
||||
# define C014_DELAY_QUEUE 27
|
||||
# define C015_DELAY_QUEUE 28
|
||||
# define C016_DELAY_QUEUE 29
|
||||
# define C017_DELAY_QUEUE 30
|
||||
# define C018_DELAY_QUEUE 31
|
||||
# define C019_DELAY_QUEUE 32
|
||||
# define C020_DELAY_QUEUE 33
|
||||
# define TRY_CONNECT_HOST_TCP 34
|
||||
# define TRY_CONNECT_HOST_UDP 35
|
||||
# define HOST_BY_NAME_STATS 36
|
||||
# define CONNECT_CLIENT_STATS 37
|
||||
# define LOAD_CUSTOM_TASK_STATS 38
|
||||
# define WIFI_ISCONNECTED_STATS 39
|
||||
# define WIFI_NOTCONNECTED_STATS 40
|
||||
# define LOAD_TASK_SETTINGS 41
|
||||
# define TRY_OPEN_FILE 42
|
||||
# define SPIFFS_GC_SUCCESS 43
|
||||
# define SPIFFS_GC_FAIL 44
|
||||
# define PARSE_SYSVAR 45
|
||||
# define PARSE_SYSVAR_NOCHANGE 46
|
||||
# define PARSE_TEMPLATE 47
|
||||
# define RULES_PROCESSING 48
|
||||
# define GRAT_ARP_STATS 49
|
||||
# define BACKGROUND_TASKS 50
|
||||
# define HANDLE_SCHEDULER_IDLE 51
|
||||
# define HANDLE_SCHEDULER_TASK 52
|
||||
# define HANDLE_SERVING_WEBPAGE 53
|
||||
# define CPLUGIN_CALL_10PS 8
|
||||
# define SEND_DATA_STATS 9
|
||||
# define COMPUTE_FORMULA_STATS 10
|
||||
# define PROC_SYS_TIMER 11
|
||||
# define SET_NEW_TIMER 12
|
||||
# define TIME_DIFF_COMPUTE 13
|
||||
# define MQTT_DELAY_QUEUE 14
|
||||
# define C001_DELAY_QUEUE 15
|
||||
# define C002_DELAY_QUEUE 16
|
||||
# define C003_DELAY_QUEUE 17
|
||||
# define C004_DELAY_QUEUE 18
|
||||
# define C005_DELAY_QUEUE 19
|
||||
# define C006_DELAY_QUEUE 20
|
||||
# define C007_DELAY_QUEUE 21
|
||||
# define C008_DELAY_QUEUE 22
|
||||
# define C009_DELAY_QUEUE 23
|
||||
# define C010_DELAY_QUEUE 24
|
||||
# define C011_DELAY_QUEUE 25
|
||||
# define C012_DELAY_QUEUE 26
|
||||
# define C013_DELAY_QUEUE 27
|
||||
# define C014_DELAY_QUEUE 28
|
||||
# define C015_DELAY_QUEUE 29
|
||||
# define C016_DELAY_QUEUE 30
|
||||
# define C017_DELAY_QUEUE 31
|
||||
# define C018_DELAY_QUEUE 32
|
||||
# define C019_DELAY_QUEUE 33
|
||||
# define C020_DELAY_QUEUE 34
|
||||
# define TRY_CONNECT_HOST_TCP 35
|
||||
# define TRY_CONNECT_HOST_UDP 36
|
||||
# define HOST_BY_NAME_STATS 37
|
||||
# define CONNECT_CLIENT_STATS 38
|
||||
# define LOAD_CUSTOM_TASK_STATS 39
|
||||
# define WIFI_ISCONNECTED_STATS 40
|
||||
# define WIFI_NOTCONNECTED_STATS 41
|
||||
# define LOAD_TASK_SETTINGS 42
|
||||
# define TRY_OPEN_FILE 43
|
||||
# define SPIFFS_GC_SUCCESS 44
|
||||
# define SPIFFS_GC_FAIL 45
|
||||
# define PARSE_SYSVAR 46
|
||||
# define PARSE_SYSVAR_NOCHANGE 47
|
||||
# define PARSE_TEMPLATE 48
|
||||
# define RULES_PROCESSING 49
|
||||
# define GRAT_ARP_STATS 50
|
||||
# define BACKGROUND_TASKS 51
|
||||
# define HANDLE_SCHEDULER_IDLE 52
|
||||
# define HANDLE_SCHEDULER_TASK 53
|
||||
# define HANDLE_SERVING_WEBPAGE 54
|
||||
|
||||
class TimingStats {
|
||||
public:
|
||||
|
||||
Reference in New Issue
Block a user