When the device is turning OFF; condition.



  • Please I need a method to apply a condition when the device is turning OFF. I want to send a message via MQTT with the status {"dev":"OFF"} before is turned off.
    Someting like:

    if (M5.TurningOFF()) {
    do_it_someting();
    }

    Thanks.