# Living Room flow – current analysis Analysis of the **Living Room** tab as pulled from Node-RED (root@10.20.30.12) on the current flows. --- ## Tab | Property | Value | |----------|--------| | **Tab id** | `7de41d810b04d992` | | **Label** | Living Room | | **Nodes** | 12 | --- ## Nodes (in flow order) ### 1. Inputs | Node | Type | Config | Out → |------|------|--------|------ | **(unnamed)** | **trigger-state** | Server: `29eb84a2708d96e0`. Entity: **`input_boolean.living_room_new`**. 2 outputs (allowed, blocked). | → HA to NVL | | **(unnamed)** | **zigbee2mqtt-in** | Server: `4e20fc347c658518`. **Friendly name: Office Switch (TS0042)**. | → Zigbee to NVL | ### 2. HA → NVL path | Node | Type | Role | Out → |------|------|------|------ | **HA to NVL** | function | ROOM_NAME = `cmd_livingroom`. Reads `msg.topic` / payload, sets `ha_lN_on` / `ha_lN_off` in `flow.nvlInState.rooms.cmd_livingroom`, outputs `buildAndSend`. | → NVL SEND | ### 3. Zigbee → NVL path | Node | Type | Role | Out → |------|------|------|------ | **Zigbee to NVL** | function | ROOM_NAME = `cmd_livingroom`. Maps action (e.g. `1_single`) to `zigbee_swN`, sets state, `zigbeeClear`, `buildAndSend`. | → 80ms, NVL SEND | | **80ms** | delay | 80 ms. | → Clear zigbee edge | | **Clear zigbee edge** | function | Clears `zigbee_swN` in state, sets `buildAndSend`. | → NVL SEND | ### 4. NVL send path | Node | Type | Role | Out → |------|------|------|------ | **NVL SEND** | function | Builds payload from `flow.nvlInState` (roomNames with `cmd_livingroom`), struct_room_cmds. | → link out 26 | **link out 26** → (cross-tab) → Flow 1 **to UDP** → **udp out** (PLC). ### 5. PLC → HA sync path (in Living Room tab) | Node | Type | Role | Out → |------|------|------|------ | **link in 14** | link in | Receives from **Flow 1** “from PLC states” link out (after nvl-receive). | → NVL to HA Sync | | **NVL to HA Sync** | function | Compares PLC light state to last; outputs only on change. Output 1 = turn_on msgs, Output 2 = turn_off msgs (`payload.action` + `payload.target.entity_id`). | → two api-call-service nodes | | **(unnamed)** | **api-call-service** | Action: **`input_boolean.turn_on`**. Entity: **`input_boolean.living_room_new`**. | — | | **(unnamed)** | **api-call-service** | Action: **`input_boolean.turn_off`**. Entity: **`input_boolean.living_room_new`**. | — | --- ## Flow diagram (current) ``` [trigger-state] [zigbee2mqtt-in] input_boolean.living_room_new Office Switch (TS0042) | | v v HA to NVL <------------------------ Zigbee to NVL | | | +---> 80ms --> Clear zigbee edge | | | +------------------------------------+--------------+ | v NVL SEND --> link out 26 --------> (Flow 1: to UDP --> PLC) (Flow 1: udp in --> nvl-receive --> "from PLC states" link out) | v link in 14 --> NVL to HA Sync --> Output 1 --> api-call-service (turn_on) --> Output 2 --> api-call-service (turn_off) ``` --- ## Notes 1. **Zigbee device** in this tab is **Office Switch (TS0042)**; commands still go to **cmd_livingroom** (living room NVL). If the switch is physically in the office, you may want a separate room/flow or map it to another room in Zigbee to NVL. 2. **NVL SEND** matches the redesign: single list of rooms (`roomNames`), only **cmd_livingroom** for now; link out 26 sends to Flow 1 → UDP. 3. **PLC → HA** sync is in the Living Room tab: **link in 14** gets PLC state from Flow 1, **NVL to HA Sync** outputs only on change, two **api-call-service** nodes with fixed **`input_boolean.turn_on`** / **`input_boolean.turn_off`** and **`input_boolean.living_room_new`**. With “Block Input Overrides” off, the sync’s `msg.payload` would override; if it’s on, the fixed entity is used (which matches the single current entity). 4. **Flows file** in the repo has been updated from this pull: `docs/integration/nodered-flows.json`.