- Updated documentation to clarify the mapping of Zigbee buttons to specific (room, light) pairs using `switchBindings`. - Improved the Zigbee to NVL function to support both single-device and multi-device payloads, enhancing flexibility in handling actions. - Revised the room configuration to include detailed switch bindings and fallback mechanisms for device identification, streamlining the integration process. This update improves the usability and functionality of the Zigbee integration within Node-RED, facilitating better control of lighting systems.
35 lines
1.0 KiB
Markdown
35 lines
1.0 KiB
Markdown
# Load room-config.js at Node-RED startup (fix "require is not defined")
|
|
|
|
Function nodes cannot use `require()`. Load the config in **settings.js** instead.
|
|
|
|
1. **On the Node-RED server**, edit:
|
|
```bash
|
|
nano /root/.node-red/settings.js
|
|
```
|
|
|
|
2. **Find** the block that looks like:
|
|
```javascript
|
|
functionGlobalContext: {
|
|
// os:require('os'),
|
|
},
|
|
```
|
|
|
|
3. **Add** the room config so it becomes:
|
|
```javascript
|
|
functionGlobalContext: {
|
|
roomConfig: require('/root/.node-red/room-config.js'),
|
|
// os:require('os'),
|
|
},
|
|
```
|
|
(Use the correct path to your `room-config.js` if different.)
|
|
|
|
4. **Save**, then **restart Node-RED**:
|
|
```bash
|
|
systemctl restart node-red
|
|
```
|
|
or however you run Node-RED.
|
|
|
|
5. In your flows, **remove or disconnect** the "Load room config" Function node (or leave it unused). All nodes that use `global.get('roomConfig')` will get the config automatically.
|
|
|
|
**When you change room-config.js:** upload the file to the server, then restart Node-RED to reload it.
|