I plan to use an ESP8266 D1 as presence detection for my car.
And no need to have it running after about 120sec after car parked. Wondering if possible to issue deep sleep command over WIFI then wake up using RTC and use ESPHome to program this functionality? Of course plan B is PlatformIO and MQTT integration.
The idea is to wake it every 15min using RTC and as soon it reports to HA issue deep sleep command over WIFI if car is home.
On the esp8266 you can enter deepsleep anytime you want. I do it with mqtt
mqtt:
on_message:
- topic: gardensensor/sleepearly
payload: 'ON'
then:
- deep_sleep.enter: deep_sleep_1
Ok, thanks! I’m trying this…
On a different subject: will captive portal timeout and esp boot to programed fw? That is when car away from home, no router to connect to.
sensor:
- platform: wifi_signal
name: "SUB WiFi Signal"
id: sub_home
update_interval: 120s
filters:
- sliding_window_moving_average:
window_size: 10
send_every: 10
send_first_at: 10
icon: mdi:wifi
binary_sensor:
- platform: template
name: "SUB Home"
lambda: |-
float analog = id(sub_home).state;
return analog < -60;
on_press:
then:
- deep_sleep.enter:
id: deep_sleep_1
sleep_duration: 60min
deep_sleep:
id: deep_sleep_1
# Turns LED on GPIO04 On when Wake
switch:
- platform: gpio
pin: GPIO4
name: "SUB connected LED"
id: led