Remove obsolete INFORMATION_NEEDED.md and streamline README.md for clarity
- Deleted the INFORMATION_NEEDED.md file as it was no longer necessary for documentation. - Revised README.md to enhance the overview of the home automation system, focusing on how services and CODESYS connectivity work. - Updated project structure in README.md for better organization and clarity, including links to relevant documentation. This update simplifies the documentation and improves the overall user experience for developers and users of the home automation system.
This commit is contained in:
30
docs/integration/state-to-nvl-send-payload.js
Normal file
30
docs/integration/state-to-nvl-send-payload.js
Normal file
@@ -0,0 +1,30 @@
|
||||
// Build the payload for nvl-send from flow.nvlInState.
|
||||
// Redesign: all rooms use struct_room_cmds. Add more names to roomNames when you add rooms.
|
||||
// Wire: HA to NVL / Zigbee to NVL → this function → nvl-send → udp out
|
||||
|
||||
const struct_room_cmds_default = {
|
||||
ha_l1_on: false, ha_l1_off: false, ha_l2_on: false, ha_l2_off: false,
|
||||
ha_l3_on: false, ha_l3_off: false, ha_l4_on: false, ha_l4_off: false,
|
||||
ha_l5_on: false, ha_l5_off: false, ha_l6_on: false, ha_l6_off: false,
|
||||
zigbee_sw1: false, zigbee_sw2: false, zigbee_sw3: false,
|
||||
zigbee_sw4: false, zigbee_sw5: false, zigbee_sw6: false,
|
||||
ha_all_on: false, ha_all_off: false
|
||||
};
|
||||
|
||||
// NVL variable names per room (struct_room_cmds). Add more when you add rooms.
|
||||
const roomNames = ['cmd_livingroom'];
|
||||
|
||||
const state = flow.get('nvlInState') || { rooms: {}, boiler: {} };
|
||||
const rooms = state.rooms || {};
|
||||
const payload = {};
|
||||
|
||||
for (const name of roomNames) {
|
||||
const cmd = rooms[name] || {};
|
||||
payload[name] = { ...struct_room_cmds_default };
|
||||
for (const k of Object.keys(struct_room_cmds_default)) {
|
||||
if (cmd[k] !== undefined) payload[name][k] = !!cmd[k];
|
||||
}
|
||||
}
|
||||
|
||||
msg.payload = payload;
|
||||
return msg;
|
||||
Reference in New Issue
Block a user