[ONOFF] ESP32 Attempt to recover previous actuator state when power has been lost and overcurrent detection change (#1494)
And set the trigger of overCurrent to 2 consecutive measures
This commit is contained in:
1 parent
fa636bae0f
commit
1cdf6558a9
5 files changed
+164
-39
No files matched your search
@@ -33,9 +33,14 @@ extern void MQTTtoONOFF(char* topicOri, JsonObject& RFdata);
|
||||
/*-------------DEFINE YOUR MQTT PARAMETERS BELOW----------------*/
|
||||
#define subjectMQTTtoONOFF "/commands/MQTTtoONOFF"
|
||||
#define subjectGTWONOFFtoMQTT "/ONOFFtoMQTT"
|
||||
#define subjectMQTTtoONOFFset "/commands/MQTTtoONOFF/config"
|
||||
|
||||
#define ONKey "setON"
|
||||
#define OFFKey "setOFF"
|
||||
|
||||
#ifndef USE_LAST_STATE_ON_RESTART
|
||||
# define USE_LAST_STATE_ON_RESTART true // Define if we use the last state upon a power restart
|
||||
#endif
|
||||
#ifndef ACTUATOR_ON
|
||||
# define ACTUATOR_ON LOW // LOW or HIGH, set to the output level of the GPIO pin to turn the actuator on.
|
||||
#endif
|
||||
@@ -71,4 +76,15 @@ extern void MQTTtoONOFF(char* topicOri, JsonObject& RFdata);
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef ESP32
|
||||
/*----------------CONFIGURABLE PARAMETERS-----------------*/
|
||||
struct ONOFFConfig_s {
|
||||
bool ONOFFState; // Recorded actuator state
|
||||
bool useLastStateOnStart; // Do we use the recorded actuator state on start
|
||||
};
|
||||
|
||||
// Global struct to store live ONOFF configuration data
|
||||
extern ONOFFConfig_s ONOFFConfig;
|
||||
#endif
|
||||
|
||||
#endif
|
||||
Reference in new issue
Block a user