diff --git a/blynkFunc.h b/blynkFunc.h index b19b17b..5f4dcbe 100644 --- a/blynkFunc.h +++ b/blynkFunc.h @@ -4,6 +4,20 @@ bool resetFlag = false; +// This function runs every time Blynk connection is established. +BLYNK_CONNECTED() +{ + if ( isFirstConnect ) + { + Blynk.syncAll(); + isFirstConnect = false; + } + + #ifdef forwardTemp + blynkBridge1.setAuthToken(forwardAuth); // Device to forward to + #endif +} + void sendBlynk() { //Feedback to the Blynk app Blynk.virtualWrite(V49,temp.cur); @@ -16,6 +30,11 @@ void sendBlynk() { //Feedback to the Blynk app #else Blynk.virtualWrite(V61,0); #endif + + + #ifdef forwardTemp + blynkBridge1.virtualWrite(V51,temp.cur); + #endif } BLYNK_WRITE(V51) { diff --git a/config.h b/config.h index e50040c..5f90b8a 100644 --- a/config.h +++ b/config.h @@ -4,6 +4,7 @@ //to identify the device for OTA updates. #define deviceName "Heater" + /*Uncomment the operating mode you wish to use. * Normal - Used for heating. If temp.cur < desired, turn on * Inverse - Operates in the inverse. If temp.cur > desired turn on | This mode could be used for an exhaust fan to limit @@ -34,3 +35,7 @@ int cooldownPeriod = 30; // Attempts before giving up and leaving relay off until reset #define loadConnectAttempts 3 + +//If you wish to forward the temperature to another device uncomment this line. +//And, add the token in "blynk.h" +#define forwardTemp