From 12ea579e0d4364ce257240599c69d16144fce13d Mon Sep 17 00:00:00 2001 From: Dominic Griesel Date: Tue, 13 Aug 2024 14:00:57 +0200 Subject: [PATCH 1/2] chore: update function type definitions --- packages/serial/src/message/Constants.ts | 77 +++++++++++++++--------- 1 file changed, 48 insertions(+), 29 deletions(-) diff --git a/packages/serial/src/message/Constants.ts b/packages/serial/src/message/Constants.ts index 5d67fe47d312..33ec684cc658 100644 --- a/packages/serial/src/message/Constants.ts +++ b/packages/serial/src/message/Constants.ts @@ -33,7 +33,7 @@ export enum FunctionType { SetRFReceiveMode = 0x10, // Power the RF section of the stick down/up UNKNOWN_FUNC_SET_SLEEP_MODE = 0x11, // Set the CPU into sleep mode - FUNC_ID_ZW_SEND_NODE_INFORMATION = 0x12, // Send Node Information Frame of the stick + SendNodeInformation = 0x12, // Send Node Information Frame of the stick to a node SendData = 0x13, // Send data SendDataMulticast = 0x14, // Send data using multicast @@ -72,10 +72,15 @@ export enum FunctionType { UNKNOWN_FUNC_RTC_TIMER_DELETE = 0x35, // ?? UNKNOWN_FUNC_RTC_TIMER_CALL = 0x36, // ?? - UNKNOWN_FUNC_ClearNetworkStats = 0x39, - UNKNOWN_FUNC_GetNetworkStats = 0x3a, + ClearTxTimers = 0x37, // Reset the Z-Wave module's internal TX timers + GetTxTimers = 0x38, // Request the Z-Wave module's internal TX timers + + ClearNetworkStats = 0x39, // Clear the current Network Statistics collected by the Z-Wave API Module + GetNetworkStats = 0x3a, // Request the current Network Statistics from the Z-Wave API Module + GetBackgroundRSSI = 0x3b, // request the most recent background RSSI levels detected - UNKNOWN_FUNC_RemoveNodeIdFromNetwork = 0x3f, + SetListenBeforeTalkThreshold = 0x3c, // Set the RSSI threshold above which the stick will not transmit + RemoveSpecificNodeIdFromNetwork = 0x3f, // Trigger removal of a specific node that desires exclusion from the network FUNC_ID_ZW_SET_LEARN_NODE_STATE = 0x40, // Not implemented @@ -93,25 +98,26 @@ export enum FunctionType { AddNodeToNetwork = 0x4a, // Control the addnode (or addcontroller) process...start, stop, etc. RemoveNodeFromNetwork = 0x4b, // Control the removenode (or removecontroller) process...start, stop, etc. - FUNC_ID_ZW_CREATE_NEW_PRIMARY = 0x4c, // Control the createnewprimary process...start, stop, etc. - FUNC_ID_ZW_CONTROLLER_CHANGE = 0x4d, // Control the transferprimary process...start, stop, etc. + AddControllerAndAssignPrimary = 0x4c, // Include a controller node and assign it the primary controller role. ONLY use from a secondary controller that is SUC. + AddPrimaryController = 0x4d, // Include a controller node and assign it the primary controller role. AssignPriorityReturnRoute = 0x4f, // Assign a priority route between two nodes - FUNC_ID_ZW_SET_LEARN_MODE = 0x50, // Put a controller into learn mode for replication/ receipt of configuration info + SetLearnMode = 0x50, // Put a controller into learn mode for replication/ receipt of configuration info AssignSUCReturnRoute = 0x51, // Assign a return route to the SUC FUNC_ID_ZW_ENABLE_SUC = 0x52, // Make a controller a Static Update Controller - FUNC_ID_ZW_REQUEST_NETWORK_UPDATE = 0x53, // Network update for a SUC(?) + RequestNetworkUpdate = 0x53, // Request an Automatic Controller Update from the SUC SetSUCNodeId = 0x54, // Configure a static/bridge controller to be a SUC/SIS node (or not) DeleteSUCReturnRoute = 0x55, // Remove return routes to the SUC GetSUCNodeId = 0x56, // Try to retrieve a Static Update Controller node id (zero if no SUC present) - UNKNOWN_FUNC_SEND_SUC_ID = 0x57, + SendSUCNodeId = 0x57, // Send the SUC/SIS Node ID from the primary controller to another controller AssignPrioritySUCReturnRoute = 0x58, // Assign a priority route from a node to the SUC UNKNOWN_FUNC_REDISCOVERY_NEEDED = 0x59, FUNC_ID_ZW_REQUEST_NODE_NEIGHBOR_UPDATE_OPTIONS = 0x5a, // Allow options for request node neighbor update - FUNC_ID_ZW_EXPLORE_REQUEST_INCLUSION = 0x5e, // supports NWI + ExploreRequestInclusion = 0x5e, // Initiate network wide inclusion while in learn mode + ExploreRequestExclusion = 0x5f, // Initiate network wide exclusion while in learn mode RequestNodeInfo = 0x60, // Get info (supported command classes) for the specified node @@ -122,6 +128,8 @@ export enum FunctionType { UNKNOWN_FUNC_UNKNOWN_0x66 = 0x66, // ?? UNKNOWN_FUNC_UNKNOWN_0x67 = 0x67, // ?? + RequestProtocolCCEncryption = 0x68, // Used by the Z-Wave API module to request encryption of a Z-Wave protocol frame + UNKNOWN_FUNC_TIMER_START = 0x70, // ?? UNKNOWN_FUNC_TIMER_RESTART = 0x71, // ?? UNKNOWN_FUNC_TIMER_CANCEL = 0x72, // ?? @@ -136,36 +144,34 @@ export enum FunctionType { UNKNOWN_FUNC_StoreNodeInfo = 0x83, // ?? UNKNOWN_FUNC_StoreHomeId = 0x84, // ?? - UNKNOWN_FUNC_LOCK_ROUTE_RESPONSE = 0x90, // ?? + LockUnlockLastRoute = 0x90, // Lock or unlock all last working routes UNKNOWN_FUNC_SEND_DATA_ROUTE_DEMO = 0x91, // ?? GetPriorityRoute = 0x92, // Get the route that is used as the first routing attempty when transmitting to a node SetPriorityRoute = 0x93, // Set the route that shall be used as the first routing attempty when transmitting to a node UNKNOWN_FUNC_SERIAL_API_TEST = 0x95, // ?? UNKNOWN_FUNC_UNKNOWN_0x98 = 0x98, // ?? - FUNC_ID_SERIAL_API_SLAVE_NODE_INFO = 0xa0, // Set application virtual slave node information + VirtualNodeSetNodeInfo = 0xa0, // Set node info of virtual nodes owned by the Z-Wave API module FUNC_ID_APPLICATION_SLAVE_COMMAND_HANDLER = 0xa1, // Slave command handler - FUNC_ID_ZW_SEND_SLAVE_NODE_INFO = 0xa2, // Send a slave node information message + VirtualNodeSendNodeInfo = 0xa2, // Send the NIF of a virtual node owned by the Z-Wave API module FUNC_ID_ZW_SEND_SLAVE_DATA = 0xa3, // Send data from slave - FUNC_ID_ZW_SET_SLAVE_LEARN_MODE = 0xa4, // Enter slave learn mode - FUNC_ID_ZW_GET_VIRTUAL_NODES = 0xa5, // Return all virtual nodes - FUNC_ID_ZW_IS_VIRTUAL_NODE = 0xa6, // Virtual node test + VirtualNodeSetLearnMode = 0xa4, // Put a virtual node into learn mode + GetVirtualNodes = 0xa5, // Return all virtual nodes + IsVirtualNode = 0xa6, // Test if a given node ID is a virtual node BridgeApplicationCommand = 0xa8, // A message from another node using the Bridge API SendDataBridge = 0xa9, // Send data (Bridge API) SendDataMulticastBridge = 0xab, // Send data using multicast (Bridge API) - UNKNOWN_FUNC_UNKNOWN_0xB4 = 0xb4, // ?? - EnableWatchdog500 = 0xb6, // Enable Watchdog (500 series and older) DisableWatchdog500 = 0xb7, // Disable Watchdog (500 series and older) KickWatchdog500 = 0xb8, // Kick Watchdog (500 series and older) UNKNOWN_FUNC_UNKNOWN_0xB9 = 0xb9, // ?? UNKNOWN_FUNC_RF_POWERLEVEL_GET = 0xba, // Get RF Power level - UNKNOWN_FUNC_GET_LIBRARY_TYPE = 0xbd, + GetLibrary = 0xbd, // Request the Z-Wave library type running on the Z-Wave module SendTestFrame = 0xbe, // Sends a NOP Power frame to the given node - UNKNOWN_FUNC_GET_PROTOCOL_STATUS = 0xbf, + GetProtocolStatus = 0xbf, // Request the current status of the protocol running on the Z-Wave module FUNC_ID_ZW_SET_PROMISCUOUS_MODE = 0xd0, // Set controller into promiscuous mode to listen to all messages FUNC_ID_PROMISCUOUS_APPLICATION_COMMAND_HANDLER = 0xd1, @@ -173,7 +179,8 @@ export enum FunctionType { StartWatchdog = 0xd2, // Start Hardware Watchdog (700 series and newer) StopWatchdog = 0xd3, // Stop Hardware Watchdog (700 series and newer) - UNKNOWN_FUNC_UNKNOWN_0xD4 = 0xd4, // ?? + SetMaximumRoutingAttempts = 0xd4, // Set the maximum number of source routing attempts + SetMaxSmartStartInclusionRequestInterval = 0xd6, // Set the maximum interval between SmartStart inclusion requests Shutdown = 0xd9, // Instruct the Z-Wave API to shut down in order to safely remove the power @@ -183,14 +190,26 @@ export enum FunctionType { SetLongRangeChannel = 0xdc, SetLongRangeShadowNodeIDs = 0xdd, - UNKNOWN_FUNC_UNKNOWN_0xEF = 0xef, // ?? - - // Special commands for Z-Wave.me sticks - UNKNOWN_FUNC_ZMEFreqChange = 0xf2, - UNKNOWN_FUNC_ZMERestore = 0xf3, - UNKNOWN_FUNC_ZMEBootloaderFlash = 0xf4, - UNKNOWN_FUNC_ZMECapabilities = 0xf5, - UNKNOWN_FUNC_ZMESerialAPIOptions = 0xf8, + // Proprietary commands: + Proprietary_DE = 0xDE, + Proprietary_DF = 0xDF, + Proprietary_E7 = 0xE7, + Proprietary_E8 = 0xE8, + Proprietary_F0 = 0xF0, + Proprietary_F1 = 0xF1, + Proprietary_F2 = 0xF2, + Proprietary_F3 = 0xF3, + Proprietary_F4 = 0xF4, + Proprietary_F5 = 0xF5, + Proprietary_F6 = 0xF6, + Proprietary_F7 = 0xF7, + Proprietary_F8 = 0xF8, + Proprietary_F9 = 0xF9, + Proprietary_FA = 0xFA, + Proprietary_FB = 0xFB, + Proprietary_FC = 0xFC, + Proprietary_FD = 0xFD, + Proprietary_FE = 0xFE, } export enum ZnifferFunctionType { From 326945f5a5f72adf9935cd76891280ef5969451a Mon Sep 17 00:00:00 2001 From: Dominic Griesel Date: Tue, 13 Aug 2024 14:36:05 +0200 Subject: [PATCH 2/2] fix: build --- packages/zwave-js/src/lib/controller/Controller.ts | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/packages/zwave-js/src/lib/controller/Controller.ts b/packages/zwave-js/src/lib/controller/Controller.ts index 7b7036b4558d..04b8b425027e 100644 --- a/packages/zwave-js/src/lib/controller/Controller.ts +++ b/packages/zwave-js/src/lib/controller/Controller.ts @@ -1644,15 +1644,7 @@ export class ZWaveController } } - // if it's a bridge controller, request the virtual nodes - if ( - this.type === ZWaveLibraryTypes["Bridge Controller"] - && this.isFunctionSupported( - FunctionType.FUNC_ID_ZW_GET_VIRTUAL_NODES, - ) - ) { - // TODO: send FUNC_ID_ZW_GET_VIRTUAL_NODES message - } + // TODO: if it's a bridge controller, request the virtual nodes if ( this.type !== ZWaveLibraryTypes["Bridge Controller"]