Updated Support for Deepsleep and Wake Up PIN (markdown)

Michael Ingraham 2019-10-14 16:48:58 -04:00
parent 2bd7c86389
commit 150192ec00
1 changed files with 23 additions and 17 deletions

@ -21,34 +21,40 @@ Deep sleep is then triggered at the TELEPERIOD event. In this example, it will o
If you want to minimize the time that the device is in operation, decrease TELEPERIOD down to 10 seconds. This period of time is counted **after** MQTT is connected. Also, in this case, the device will wake up at 9:00 am even if the uptime was much smaller. If the device missed a wake-up it will try a start at the next event - in this case 10:00 am.
## WEMOS D1 side-effects
Not all GPIO behave the same during deep sleep. Some GPIO go HIGH, some LOW, some FOLLOW the relay but work only on FET transistors. As soon as current flows they go LOW. I use one GPIO to trigger a BC337 transistor to switch OFF all of my connected devices during deep sleep. Here is the list of found behavior (D0 excluded because of the wake-up pin):
## WEMOS D1 Deep Sleep Side-effects
Not all GPIO behave the same during deep sleep. Some GPIO go HIGH, some LOW, some FOLLOW the relay but work only on FET transistors. As soon as current flows they go LOW. I use one GPIO to trigger a BC337 transistor to switch OFF all connected devices during deep sleep.
* D1: KEEP STATE, go LOW if resistance to ground < infinite
* D2: KEEP STATE, go LOW if resistance to ground < infinite
* D3: HIGH
* D4: HIGH
* D5: HIGH, go LOW if resistance to ground < infinite
* D6: HIGH, go LOW if resistance to ground < infinite
* D7: HIGH, go LOW if resistance to ground < infinite
* D8: LOW
Findings:
Pin|GPIO|Behavior
-|:-:|-
D0|16|Excluded due to use as wake-up pin
D1|5|KEEP STATE, go LOW if resistance to ground < infinite
D2|4|KEEP STATE, go LOW if resistance to ground < infinite
D3|0|HIGH
D4|2|HIGH
D5|14|HIGH, go LOW if resistance to ground < infinite
D6|12|HIGH, go LOW if resistance to ground < infinite
D7|13|HIGH, go LOW if resistance to ground < infinite
D8|15|LOW
## Log Output Explanation
_(logging level `5`)_
`13:08:43 MQT: hm/status/sonoff/INFO3 = {"RestartReason":"Deep-Sleep Wake"}`
When MQTT connects, this sets the system to READY. In this example, TELEPERIOD is 10. Therefore 10 seconds from now reporting will start.
`13:08:44 APP: Boot Count 84`
`13:08:44 CFG: Saved to flash at F4, Count 96, Bytes 3824`
TELEPERIOD is reached. DATETIME is set. Go for reporting.
When MQTT connects at 13:08:38, this sets the system to READY.
```
13:08:43 MQT: tele/sonoff/INFO3 = {"RestartReason":"Deep-Sleep Wake"}
13:08:44 APP: Boot Count 84
13:08:44 CFG: Saved to flash at F4, Count 96, Bytes 3824
```
In this example, TELEPERIOD is 10. Therefore when TELEPERIOD is reached, telemetry reporting occurs.
```
13:08:48 MQT: tele/sonoff/STATE = {"Time":"2019-09-04T13:08:48","Epoch":1567595328,"Uptime":"0T00:00:14","UptimeSec":14,"Heap":24,"SleepMode":"Dynamic","Sleep":50,"LoadAvg":20,"MqttCount":1,"Wifi":{"AP":1,"SSId":"MyWLAN","BSSId":"AA:FF:AA:AA:AA:AA","Channel":11,"RSSI":100,"LinkCount":1,"Downtime":"0T00:00:08","DeepSleep":300,"Heap":25160}}
13:08:48 MQT: tele/sonoff/SENSOR = {"Time":"2019-09-04T13:08:48","Epoch":1567595328,"ANALOG":{"A0":8}}
```
Status and telemetry sent. Now start shutdown procedure.
DATETIME is set. Status and telemetry sent. Now start shutdown procedure.
First, send MQTT offline.
`13:08:48 MQT: state/sonoff/LWT = Offline`