# Eeking Best Practice for "Last State" w/ Gledopto & Shelly 3EM Failsafe (Zigbee Mesh Stability)

**URL:** <https://community.homey.app/t/eeking-best-practice-for-last-state-w-gledopto-shelly-3em-failsafe-zigbee-mesh-stability/146551>\
**Category:** Questions & Help\
**Created:** [December 8, 2025, 3:14am UTC](https://community.homey.app/t/eeking-best-practice-for-last-state-w-gledopto-shelly-3em-failsafe-zigbee-mesh-stability/146551 "2025-12-08T03:14:50Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gabriel\_Pedrosa\_Mach](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/gabriel_pedrosa_mach/32/176567_2.png) [@Gabriel\_Pedrosa\_Mach](https://community.homey.app/u/Gabriel_Pedrosa_Mach)\
**Post date:** [December 8, 2025, 3:14am UTC](https://community.homey.app/t/eeking-best-practice-for-last-state-w-gledopto-shelly-3em-failsafe-zigbee-mesh-stability/146551/1 "2025-12-08T03:14:50Z")

</div>

### **Homey Pro: Robust Zigbee Mesh and “Last State” Simulation**

**Hardware:** Homey Pro (Flow Advanced), **Gledopto LED Controllers** (Zigbee), Shelly 3EM (3-phase monitor), ZBMINIR2 (currently cutting power).

**The Challenge:** Gledopto controllers **lack** a configurable “Power On Behavior” and return **ON** after an outage. Our current fix uses the ZBMINIR2 to cut power, but this **destabilizes the Zigbee mesh** as controllers (routers) go offline.

**Goal:** Simulate a reliable **“Last State”**  **WITHOUT** removing power from the Gledopto controllers (to ensure mesh stability, as the Homey hub is on a UPS).

* * *

### **Critical Failure Point: Shelly 3EM Failsafe**

- The **Shelly 3EM** is powered by **Phase 1**. If Phase 1 fails, the Shelly goes **offline/unavailable** , preventing Homey from receiving the required **low voltage** reading (it won’t report 0V).

- **Mitigation:** We need a robust **failsafe Flow** that registers a power failure (`bl_has_power_failed = true`) if the Shelly 3EM device status changes to **unavailable** in Homey.

* * *

### **Proposed Solution (Better Logic Variables)**

1. Use **Persistent Better Logic Variables** (e.g., `bl_led_state`) to store the desired ON/OFF state of each light.

2. The auxiliary switch (3-Way) flow will only **Toggle the Variable**. A separate Flow will then command the Gledopto controller based on the variable’s state change (decoupling).

3. A restoration Flow, triggered by the return of power (Shelly back online or voltage \> 100V), restores the lights based on the saved variable state.

* * *

### **Questions for the Community:**

1. **Storage Method:** For persistent “Last State” storage, which is more reliable and performant: **Better Logic Persistent Variables** or the built-in **Zone Memory** feature?

2. **Saving Trigger:** If using Zone Memory, when is the best time to save the zone state: **a) Continuously** (on every light state change) **OR** **b) Only when the Shelly 3EM detects a power failure** (low voltage or device unavailable)?
