Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ to change the MQTT topic prefix.

- The device boots, prevents deep sleep, and waits for MQTT to connect.
- When connected it resets the state bitmask, republishes retained topics, and
schedules a sleep once all required messages have been seen.
waits for the retained online-lock, OpenGarage status, and door-state
messages before scheduling deep sleep.
- The WS2812 LED uses the following colors:
- **Green** – Door open and OpenGarage online
- **Blue** – Door open while OpenGarage is offline
Expand Down
34 changes: 29 additions & 5 deletions config/ogrgb.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -230,14 +230,38 @@ script:
- id: maybe_finish_and_sleep
mode: restart
then:
- lambda: 'if (!id(ready)) return;'
- if:
condition:
lambda: 'return !id(online_lock);'
lambda: 'return id(ready);'
then:
- deep_sleep.allow: deep_sleep_1
else:
- logger.log: "Online lock active, remaining awake."
- if:
condition:
lambda: 'return (id(seen_mask) & 0x07) == 0x07;'
then:
- if:
condition:
lambda: 'return !id(online_lock);'
then:
- deep_sleep.allow: deep_sleep_1
else:
- logger.log: "Online lock active, remaining awake."
else:
- lambda: |-
uint8_t missing = static_cast<uint8_t>(0x07 & ~id(seen_mask));
std::string topics;
if (missing & 0x01) {
if (!topics.empty()) topics += ", ";
topics += "online lock";
}
if (missing & 0x02) {
if (!topics.empty()) topics += ", ";
topics += "OpenGarage status";
}
if (missing & 0x04) {
if (!topics.empty()) topics += ", ";
topics += "door state";
}
ESP_LOGW("Sleep", "Awaiting retained MQTT updates for: %s", topics.c_str());

- id: online_lock_timeout_arm
mode: restart
Expand Down