Hi all,
T-Energy S3 + magnetic sensor + 18650 battery, used for get MQTT alert on garage open/close and/or twice a day for battery stats.
GPIO12 is the sensor normally open pin.
When the contact is closed, ESP32 sleeps; when I open the contact, it wakes up and it let ESP32 awake until the contact is closed again. So this code work as expected. Below the config:
esphome:
name: tens3-bascula-sx
friendly_name: tens3-bascula-sx
esp32:
board: esp32-s3-devkitc-1
framework:
type: arduino
flash_size: 16MB
# Enable logging
logger:
level: DEBUG
ota:
- platform: esphome
password: !secret esphome_secret
web_server:
port: 80
wifi:
fast_connect: True
ssid: "xxx"
password: "xxx"
manual_ip:
static_ip: 192.168.xx
gateway: 192.168.xx
subnet: 255.255.xx
mdns:
disabled: true
captive_portal:
mqtt:
id: mqtt_client
broker: 192.168.xx
port: 1883
username: mqtt-xx
password: xxx
birth_message:
will_message:
on_message:
- topic: tens3-bascula-sx/deep_sleep_mode
payload: 'OFF'
then:
- logger.log: ">>>>>> MQTT received topic=tens3-bascula-sx/deep_sleep_mode, payload='OFF'"
- deep_sleep.prevent: deep_sleep_1
- topic: tens3-bascula-sx/deep_sleep_mode
payload: 'ON'
then:
- logger.log: ">>>>>> MQTT received topic=tens3-bascula-sx/deep_sleep_mode, payload='ON'"
- deep_sleep.enter: deep_sleep_1
deep_sleep:
id: deep_sleep_1
run_duration: 5sec
sleep_duration: 15min
wakeup_pin:
number: GPIO12
allow_other_uses: True
wakeup_pin_mode: INVERT_WAKEUP
binary_sensor:
- platform: gpio
name: BasculaSX
device_class: garage_door
pin:
number: GPIO12
mode: INPUT_PULLUP
allow_other_uses: True
sensor:
- platform: adc
pin: 3
name: "T3SX Battery Voltage"
update_interval: 1s
attenuation: 12db
About the issue: when the ESP is connected to a USB power it works, when it is powered by battery (yes, fully charged battery) it goes to sleep but it never awake then.
Do you think is it something wrong with the esphome config? Or is it the ESP board the problem? I saw other posts about Lilygo boards regarding power management on the net…
Thanks for any help,
-f