@cgjgh/node-red-dashboard-2-ui-scheduler
3.3.7
@flowfuse/node-red-dashboard
1.30.2
@sammachin/node-red-matter-bridge
0.12.3
@sammachin/node-red-matter-controller
0.1.6
node-red-node-email
Alexa routines triggered by virtual contact sensors require a state transition (changing explicitly from true to false or vice-versa) to fire, a single static state will fail to re-trigger a routine during a retry loop.
The "Flicker" Function Node fixes this by quickly pulsing the mattercontactsensor to the opposite state and back again, ensuring Alexa always registers a fresh edge-trigger, even if the target state hasn't changed.
The "Flicker" Function Node Code
javascript
// 1. Send the instant inverse state to clear Alexa's transition requirement
let flickerMsg = {
payload: !msg.payload
};
node.send(flickerMsg);
// 2. Clone the original message to preserve its properties and target payload
let targetMsg = RED.util.cloneMessage(msg);
// 3. Wait 1 second (1000ms) internally, then send the actual target state
setTimeout(function() {
node.send(targetMsg);
}, 1000);
// Return nothing directly at the bottom since node.send handles it asynchronously
return;
Here is the complete, finalized automation report.
It is specifically structured as a single, clean markdown document optimized for Google Sites. Because Google Sites strips out raw markdown horizontal rules (---) and native container dividers when pasting, this layout uses bold, bordered text spacing and clear structural blocks so it mimics a professional desktop report layout the moment you insert it into a text box or embed element.
=========================================
=========================================
The roller blind automation framework operates within a hybrid smart home ecosystem, bridging local physical sensors, regional hardware routing layers, cloud environments, and Node-RED logic engines.
Physical Blinds Control: The motorized blinds are operated natively via a standalone hardware remote control. Additionally, they are exposed to the Amazon Alexa smart home ecosystem as native appliances, having been added to Alexa directly through the manufacturer's Aqara App.
Ecosystem Visual Deficit: A critical limitation of both the native Aqara application layer and cloud-based Alexa voice routines is an inability to track real-time physical states. Commands sent over these connections occasionally drop or fail without feedback. This Node-RED framework serves as the definitive "eyes and ears" to address this limitation.
The Ikea MYGGBETT Sensor: Mounted physically on the roller blinds to determine the true state value (OPEN vs. CLOSED). These hardware sensors communicate over the Matter-over-Thread wireless mesh network protocol.
The Local Network Bridge: The physical MYGGBETT Thread sensors route their radio signals directly into an Aqara Thread Border Router. This router translates the local Thread mesh packets onto the home network.
Node-RED Implementation Layer: The flow integrates the custom @sammachin/node-red-matter-controller and @sammachin/node-red-matter-bridge node suites. The node labeled Blind_UpDown (mattercontactsensor) operates as a Virtual Matter Contact Sensor Device. This virtual appliance is exposed by Node-RED onto the local network, allowing Alexa to discover it and run targeted routines based on its state changes.
=========================================
=========================================
The automation software logic is divided into four distinct phases designed to prevent duplicate signaling, handle timing windows, and verify hardware completions.
Phase 1: Boot-Time Variables Initialization
On system startup, an initial change node clears and formats essential flow-context properties (flow.loopStatus, flow.Origin, flow.UpDown). This sweeps away residual data to ensure a clean tracking foundation.
Phase 2: Triggering and Intent Pre-Checks
Actions are initialized either by a user altering the dashboard interface manually or by the background ui-scheduler firing a timed entry. Before routing forward, a switch node verifies the payload against flow.UpDown. If the incoming instruction matches the last confirmed position, the request is discarded to protect the blind motors from unnecessary strain.
Phase 3: Central Execution and Retry Mechanism
Once an unmatched target intent is validated, the central ui-switch passes the instruction down into the verification engine. It establishes a busy status context and routes the transaction message into a 55-second background delay node. If the hardware fails to report back within this 55-second window, the system increments a counter, logs a "Somfy Call" attempt, and re-fires up to a maximum of 3 recursive loops before terminating.
Phase 4: Hardware Verification and State Synchronization
When the blind begins to open or has completely closed, the physical MYGGBETT sensor captures the state change and issues a Thread packet through the border router. Node-RED intercepts this event via a live Matter subscription node. This sensor update changes flow.loopStatus to "stop", flags the UI template animations as "idle", updates the dashboard tracking log, and updates the virtual Alexa bridge.
=========================================
=========================================
The dashboard switch node (4f634ad28a27076f) operates simultaneously as an interactive control panel element and a state display mirror. By enforcing "passthru": true, any message hitting the node's back input (such as manual overrides or Alexa commands) instantly passes through to the front output. The flow uses a flow.Origin filter string to safely separate automatic looping triggers from background hardware notifications.
When an active transaction message enters the 55-second delay node (30bd14e9f329b25b), Node-RED freezes its exact payload state (including msg.retryCount) on a temporary memory shelf until the timer expires. Because these properties are frozen during the countdown, downstream nodes must actively purge or clean up historical message context strings to prevent stale values from executing after the loop successfully terminates.
A Detect Page Load (4391abf62ce041f6) event node listens for dashboard client instances. When a browser tab is opened or refreshed, it fires a "$pageview" topic trigger that polls the live blind status using a matterreadattr attribute node.
This synchronization path is essential to convey the actual blind status in the event of operation by the standalone remote control. Because standalone remotes function outside of Node-RED's core logic, this pageview trigger bridges the gap, forcing the browser to read the true state of the room via the MYGGBETT sensor and correctly position the desktop switch widget.
=========================================
The dashboard switch node (4f634ad28a27076f) operates simultaneously as an interactive control panel element and a state display mirror. By enforcing "passthru": true, any message entering the node's back input is instantly passed through to its front output.
The messages hitting the node's back input come from two separate hardware tracking paths:
The mattersubscribe path: Fires automatically whenever the physical MYGGBETT sensor registers a change in the blind's position.
The matterreadattr path: Fires on demand due to events initiated by manual remote overrides, a desktop display refresh ($pageview), a recovery attempt following a failed request, or verbal Alexa commands.
Because every single one of these back-input events causes the switch to spit a message out of its front output, the downstream flow relies heavily on the Filter Origin gateway. This filter reads the flow.Origin text string to separate routine background status reflections from active, automated loop requests.
=========================================
## 3. CORE DESIGN CHARACTERS & PERSISTENCE
=========================================
### The Dashboard 2 "Passthru" Characteristic
The dashboard switch node (4f6 control panel element and a state display mirror. By enforcing "passthru": true, any message entering the node's back input is instantly passed through to its front output.
The messages hitting the node's back input come from two separate hardware tracking paths:
* The mattersubscribe path: Fires automatically whenever the physical MYGGBETT sensor registers a change in the blind's position.
* The matterreadattr path: Fires on demand due to events initiated by a failed request a desktop display refresh ($pageview), so that the ui-switch is resynchronised to the correct state irrespective of whether the blinds have been operated by a manual remote or elsewhere.
Because every single one of these back-input events causes the switch to spit a message out of its front output, the downstream flow relies heavily on the Filter Origin gateway. This filter reads the flow.Origin text string to separate routine background status reflections from active, automated loop requests.
### Message Snapshotting Behavior Across Delays
When an active transaction message enters the 55-second delay node (30bd14e9f329b25b), Node-RED freezes its exact payload state (including msg.retryCount) on a temporary memory shelf until the timer expires. Because these properties are frozen during the countdown, downstream nodes must actively purge or clean up historical message context strings to prevent stale values from executing after the loop successfully terminates.
### Pageview Synchronisation Handling
A Detect Page Load (4391abf62ce041f6) event node listens for dashboard client instances. When a browser tab is opened or refreshed, it fires a "$pageview" topic trigger that polls the live blind status using a matterreadattr attribute node.
This synchronization path is essential to convey the actual blind status in the event of operation by the standalone remote control. Because standalone remotes function outside of Node-RED's core logic, this pageview trigger bridges the gap, forcing the browser to read the true state of the room via the MYGGBETT sensor and correctly position the desktop switch widget.
=========================================
=========================================
During system optimization, an inconsistency was discovered where a freshly created simulation schedule would display "Success," but a live, recurring production schedule would display "FAILED" on the UI layout despite the blinds physically opening correctly.
The diagnosis revealed a metadata conflict caused by the scheduler node's configuration:
"storeName": "local_file_system"
"commandResponseMsgOutput": "fanOut"
When a production schedule runs as a stored calendar item, the @cgjgh/node-red-dashboard-2-ui-scheduler node attaches historical payload metadata tracking variables (msg.scheduler.config) to the message.
While the 55-second delay timer is counting down, a successful local sensor event changes flow.loopStatus to "stop". When the original delayed message wakes up, it correctly registers this stop instruction and forwards the transaction to the successful completion block (DONE node).
However, because the message still carries the persistent file-system calendar configuration object, the Dashboard 2 dynamic layout renderer misinterprets the metadata as an active instruction or UI layout change. This causes the widget container to reject the text string, defaulting back to its structural fallback state: FAILED.
=========================================
=========================================
To safeguard the flow against metadata pollution and multi-platform timing overlap, the following structural adjustments are applied to the core change blocks:
1. Metadata Erasure Rule: Inside the successful completion node (DONE, 479c7a5b62027f63), an explicit Delete msg.scheduler instruction is executed. This completely strips the calendar footprint from the message container before it updates the interface layout.
2. Counter Cleanup Rule: The success node also executes a Delete msg.retryCount instruction. This purges frozen loop states, ensuring the rendering engine only evaluates current parameters.
3. Text Payload Enforcement: The success node explicitly forces msg.ui_update.label to "Success in: " and msg.ui_update.color to "black". This forces a clean visual confirmation on the desktop panel regardless of system background updates.
If you want to enhance this layout inside Google Sites, you can use the Embed Code option (</>) on your page and paste this text directly into an HTML/Embed Window. This will preserve the exact system layout and font choices beautifully. Let me know if you would like me to generate the raw HTML code block for that embed window instead!
This report analyzes the Node-RED flow designed to manage automated roller blinds. The system utilizes an automated Scheduler for time-based movements, tracks the blind status via a physical hardware framework (Ikea MYGGBETT Matter over Thread Sensor), and employs an automated loop handling system to verify command success.
The dashboard interface is built using the modern Dashboard 2 (@flowfuse/node-red-dashboard) framework. The flow integrates seamlessly into a broader smart home ecosystem (including Amazon Alexa and standalone remote controls) using virtual Matter devices to bridge physical sensors with cloud-based voice routines.
The flow operates within a robust, multi-protocol smart home ecosystem. Understanding the hardware layer is critical to evaluating the message flow:
Physical Blinds & Local Control: The blinds are natively seen as a smart device within Amazon Alexa, having been added to Alexa via the Aqara App. They can also be operated entirely independently of Node-RED using a standalone hardware remote control.
The Ikea MYGGBETT Sensor: Mounted directly on the roller blinds to determine physical state changes (OPEN vs. CLOSED). These sensors operate over Matter-over-Thread protocols and connect to the local network via an Aqara Thread Border Router.
Node-RED Matter Integration: The flow utilizes Sammachin's custom Node-RED nodes (@sammachin/node-red-matter-controller and @sammachin/node-red-matter-bridge).
The Virtual Alexa Bridge: The node Blind_UpDown (mattercontactsensor, 0a6505ce790a86f9) acts as a Virtual Matter Contact Sensor Device. This virtual device is exposed on the network via the Node-RED Matter Bridge, allowing Amazon Alexa to discover it. Alexa routines are then attached to this virtual contact sensor to trigger the physical blinds whenever Node-RED updates its state.
The primary purpose of this flow is to automate and monitor the open/close state of the roller blinds while keeping a desktop UI dashboard in perfect synchronization.
The flow can be broken down into four core operational phases:
Initialization: Clears tracking variables on system boot to prevent stray states.
Command Triggering: Accepts input from either an automated ui-scheduler calendar event or manual user interaction via a dashboard ui-switch.
Execution & Retry Loop: Initiates a 55-second monitoring window. If the blind doesn't successfully reach its destination within 55 seconds, it increments a counter and retries (up to 3 attempts total) before declaring a failure.
Hardware Verification & State Synchronization: Listens for real-time state changes from the physical MYGGBETT sensor via Matter subscription protocols, using those updates to cleanly break active retry loops, update the dashboard text, and mirror the state to the virtual Alexa bridge.
The flow is structurally split across specific functional zones. Below is an overview of how these individual groupings interact.
scheduler (ui-scheduler): Governs time-based rules. It outputs to Pin 2 when an event happens, sending a boolean payload (true for CLOSED, false for OPENED).
previously actioned? (switch): A pre-check gateway. It compares the incoming scheduler payload against flow.UpDown. If they match, the request is dropped to prevent redundant hardware strains.
blinds (ui-switch): The central UI component. Critically, it has "passthru": true enabled. This means any message entering its back input immediately exits its front output, passing down to the validation layer.
Filter Origin (switch): Utilizes a JSONata expression property to filter messages:
$flowContext('Origin') in ["$pageview", "done"].
If true (meaning the message was a background sync or an exit signal), it goes to Output 1 to clear states. If false, it goes to Output 2 to initiate a command loop.
Term \n Fail \n Loop (switch): Evaluates the global variable flow.loopStatus. If the status is "busy", it passes to the else track, routing into Set Somfy Calls and a 55-second delay node (30bd14e9f329b25b).
The 55-Second Timer Loop: This loop creates a recursive cycle. Every 55 seconds, the message emerges from the delay and hits the Term \n Fail \n Loop switch again. If flow.loopStatus hasn't been changed to "stop" by an external sensor event, it counts up to 3 retries before outputting a FAILED change sequence.
MYGGBETT | stateValue (mattersubscribe): Intercepts live state adjustments directly from the physical blind sensor via the Aqara Thread Border Router. Crucially, this node catches blind movement regardless of whether it was triggered by a Node-RED schedule, an Alexa routine, or the standalone physical remote control.
Handle MYGGBETT event (change): Instantly forces flow.loopStatus to "stop", flags msg.state as "idle", and assigns msg.topic = "done".
Stop State (change): Sets flow.Origin to match the incoming msg.topic ("done") and pushes it into the back of the UI switch to update the dashboard button appearance.
Blind_UpDown (mattercontactsensor): Receives the synchronized status update. By altering the state of this virtual sensor node, Node-RED sends a local network broadcast out of the matter-bridge, signaling Amazon Alexa routines to synchronize cloud device states immediately.
During analysis, several crucial architectural behaviors were identified within the flow setup:
The dashboard switch node (4f634ad28a27076f) acts as a bridge between your live hardware events and your UI layout. Because Passthru is active, when the physical sensor fires an update, the message loops backward through the UI switch and emerges out the front output channel. The flow relies heavily on the flow.Origin text tracker ("done" or "$pageview") to catch these looped messages at the Filter Origin gateway and drop them before they accidentally reset the retry counters.
When a message enters the 55-second delay node (30bd14e9f329b25b), its internal properties (such as msg.retryCount) are frozen/snapshotted on a background shelf until the timer expires. Downstream nodes must actively clean up or overwrite these snapshotted properties (msg.retryCount) to prevent the dashboard interface from displaying historical retry counters over new successful states.
The flow includes a Detect Page Load (4391abf62ce041f6) UI event listener. When a user opens or refreshes their desktop dashboard view, it issues a "$pageview" topic trigger. This safely polls the live blind status via the matterreadattr node to ensure a fresh UI display without restarting an active motor operation loop. This is essential to convey the actual blind status in the event of operation by the standalone remote control.
The fact that the blinds are visible across Alexa (via Aqara App), Alexa (via Node-RED Bridge), and controlled by a Standalone Remote introduces an important environmental factor to your desktop "FAILED" error: Network Reporting Latency over Thread.
When a scheduled automated event kicks off, the following cascade occurs:
Node-RED sends the command via the loop.
The physical blinds begin to roll.
The standalone setup or Aqara App concurrently pushes state updates up to the cloud (Alexa) while the physical MYGGBETT sensor broadcasts over Thread locally.
The Collision: Because the Thread border router and the Alexa smart home cloud poll/update almost simultaneously, a rapid flurry of state reports hit Node-RED.
If a background $pageview sync or an overlapping remote status packet updates flow.Origin back to a blank string "" after your loop started but before the blind finished its physical travel, the second hardware status packet will bypass your filters. It hits the 6f15b1339c59899d change node, silently resetting flow.loopStatus back to "busy". This corrupts the tracking sequence, causing the 55-second background countdown timer to eventually declare a false FAILED state on your desktop dashboard screen.
Incorporate Strict Loop Verification: Update your Filter Origin switch node expression to actively check if the loop has been told to stand down, stopping secondary multi-platform cloud packets from resetting your states:
Explicit Message Cleansing: Add a Delete msg.retryCount instruction inside the DONE change node (479c7a5b62027f63). This guarantees that old retry data footprints are completely stripped before reaching the dashboard layout rendering engine.
Here is the complete, finalized automation report.
It is specifically structured as a single, clean markdown document optimized for Google Sites. Because Google Sites strips out raw markdown horizontal rules (---) and native container dividers when pasting, this layout uses bold, bordered text spacing and clear structural blocks so it mimics a professional desktop report layout the moment you insert it into a text box or embed element.
=========================================
=========================================
The roller blind automation framework operates within a hybrid smart home ecosystem, bridging local physical sensors, regional hardware routing layers, cloud environments, and Node-RED logic engines.
Physical Blinds Control: The motorized blinds are operated natively via a standalone hardware remote control. Additionally, they are exposed to the Amazon Alexa smart home ecosystem as native appliances, having been added to Alexa directly through the manufacturer's Aqara App.
Ecosystem Visual Deficit: A critical limitation of both the native Aqara application layer and cloud-based Alexa voice routines is an inability to track real-time physical states. Commands sent over these connections occasionally drop or fail without feedback. This Node-RED framework serves as the definitive "eyes and ears" to address this limitation.
The Ikea MYGGBETT Sensor: Mounted physically on the roller blinds to determine the true state value (OPEN vs. CLOSED). These hardware sensors communicate over the Matter-over-Thread wireless mesh network protocol.
The Local Network Bridge: The physical MYGGBETT Thread sensors route their radio signals directly into an Aqara Thread Border Router. This router translates the local Thread mesh packets onto the home network.
Node-RED Implementation Layer: The flow integrates the custom @sammachin/node-red-matter-controller and @sammachin/node-red-matter-bridge node suites. The node labeled Blind_UpDown (mattercontactsensor) operates as a Virtual Matter Contact Sensor Device. This virtual appliance is exposed by Node-RED onto the local network, allowing Alexa to discover it and run targeted voice routines based on its mirrored state changes.
=========================================
=========================================
The automation software logic is divided into four distinct phases designed to prevent duplicate signaling, handle timing windows, and verify hardware completions.
Phase 1: Boot-Time Variables Initialization
On system startup, an initial change node clears and formats essential flow-context properties (flow.loopStatus, flow.Origin, flow.UpDown). This sweeps away residual data to ensure a clean tracking foundation.
Phase 2: Triggering and Intent Pre-Checks
Actions are initialized either by a user altering the dashboard interface manually or by the background ui-scheduler firing a timed entry. Before routing forward, a switch node verifies the payload against flow.UpDown. If the incoming instruction matches the last confirmed position, the request is discarded to protect the blind motors from unnecessary strain.
Phase 3: Central Execution and Retry Mechanism
Once an unmatched target intent is validated, the central ui-switch passes the instruction down into the verification engine. It establishes a busy status context and routes the transaction message into a 55-second background delay node. If the hardware fails to report back within this 55-second window, the system increments a counter, logs a "Somfy Call" attempt, and re-fires up to a maximum of 3 recursive loops before terminating.
Phase 4: Hardware Verification and State Synchronization
The moment the blind begins its physical movement, the physical MYGGBETT sensor captures the state change and issues a Thread packet through the border router. Node-RED intercepts this event via a live Matter subscription node. This sensor update changes flow.loopStatus to "stop", flags the UI template animations as "idle", updates the dashboard tracking log, and updates the virtual Alexa bridge.
=========================================
=========================================
The dashboard switch node (4f634ad28a27076f) operates simultaneously as an interactive control panel element and a state display mirror. By enforcing "passthru": true, any message hitting the node's back input (such as manual overrides or Alexa commands) instantly passes through to the front output. The flow uses a flow.Origin filter string to safely separate automatic looping triggers from background hardware notifications.
When an active transaction message enters the 55-second delay node (30bd14e9f329b25b), Node-RED freezes its exact payload state (including msg.retryCount) on a temporary memory shelf until the timer expires. Because these properties are frozen during the countdown, downstream nodes must actively purge or clean up historical message context strings to prevent stale values from executing after the loop successfully terminates.
A Detect Page Load (4391abf62ce041f6) event node listens for dashboard client instances. When a browser tab is opened or refreshed, it fires a "$pageview" topic trigger that polls the live blind status using a matterreadattr attribute node.
This synchronization path is essential to convey the actual blind status in the event of operation by the standalone remote control. Because standalone remotes function outside of Node-RED's core logic, this pageview trigger bridges the gap, forcing the browser to read the true state of the room via the MYGGBETT sensor and correctly position the desktop switch widget.
=========================================
=========================================
During system optimization, an inconsistency was discovered where a freshly created simulation schedule would display "Success," but a live, recurring production schedule would display "FAILED" on the UI layout despite the blinds physically opening correctly.
The diagnosis revealed a metadata conflict caused by the scheduler node's configuration:
"storeName": "local_file_system"
"commandResponseMsgOutput": "fanOut"
When a production schedule runs as a stored calendar item, the @cgjgh/node-red-dashboard-2-ui-scheduler node attaches historical payload metadata tracking variables (msg.scheduler.config) to the message.
While the 55-second delay timer is counting down, a successful local sensor event changes flow.loopStatus to "stop". When the original delayed message wakes up, it correctly registers this stop instruction and forwards the transaction to the successful completion block (DONE node).
However, because the message still carries the persistent file-system calendar configuration object, the Dashboard 2 dynamic layout renderer misinterprets the metadata as an active instruction or UI layout change. This causes the widget container to reject the text string, defaulting back to its structural fallback state: FAILED.
=========================================
=========================================
To safeguard the flow against metadata pollution and multi-platform timing overlap, the following structural adjustments are applied to the core change blocks:
1. Metadata Erasure Rule: Inside the successful completion node (DONE, 479c7a5b62027f63), an explicit Delete msg.scheduler instruction is executed. This completely strips the calendar footprint from the message container before it updates the interface layout.
2. Counter Cleanup Rule: The success node also executes a Delete msg.retryCount instruction. This purges frozen loop states, ensuring the rendering engine only evaluates current parameters.
3. Text Payload Enforcement: The success node explicitly forces msg.ui_update.label to "Success in: " and msg.ui_update.color to "black". This forces a clean visual confirmation on the desktop panel regardless of system background updates.
If you want to enhance this layout inside Google Sites, you can use the Embed Code option (</>) on your page and paste this text directly into an HTML/Embed Window. This will preserve the exact system layout and font choices beautifully. Let me know if you would like me to generate the raw HTML code block for that embed window instead!
Topic is origin, so when
app opens it is "$pageview"
button pressed it is "" if set then it will always overwrite any incoming msg.topic
Schedule is default "Topic 1" or as configured, but on msg is passing through switch it will be changed to buttons msg.topic. However it includes msg.scheduledEvent: TRUE?FALSE
MYGGBETT subscribe by default Topic is empty, but can be configured.
MYGGBETT read passes through incoming msg.topic
But pass through msg from button has topic reset to "ui"
So if need to follow source then copy to another variable!!
Payload = blind status False when open
?? Scheduler sets msg.topic to Topic 2 but on passing through switch msg.topic is ""
So conclude that msg.topic on switch should be empty then can use msg.topic to identify
The problem is that ui_button retains the last msg it received and passes on all of that as well!!!
So need to create a Flow.origin variable to store where the msg originates, from $pageview,