OpenZWave / node-openzwave-shared

OpenZWave addon for Node.js (all versions) including management and security functions
Other
199 stars 113 forks source link

How to put in Learn Mode? #236

Closed ipald closed 5 years ago

ipald commented 6 years ago

Hello all, thank you for your nice work! I would to ask if is possible - and if yes in which way - to put my node-openzwave box in "learn mode" to permit to a secondary controller to add to his z-wave network. Bye

tobiasgraf commented 6 years ago

Hi,

first of all, do you want to add your OZW box into another network or add another controller into the OZW network? For the later you just need to set your OZW into "AddNode" Mode and send the Learnmode command fro the other controller.

zwave.addNode(doSecurity: boolean): Add a new device or controller with/without security. This is usually followed by starting the pair/unpair process on the device (eg. pressing a special inclusion button or quickly pressing the manual operation button three times)

For the first case (add OZW controller into other network) the controller of the other network needs to be in AddNode mode and the Learn mode must be send from OZW. I think the best shot for this is to use the Manager::ReceiveConfiguration() function or zwave.receiveConfiguration() in case of the node binding.

This will send the FUNC_ID_ZW_SET_LEARN_MODE command.

case ControllerCommand_ReceiveConfiguration:
{
    Log::Write( LogLevel_Info, 0, "Receive Configuration" );
    Msg* msg = new Msg( "ControllerCommand_ReceiveConfiguration", 0xff, REQUEST, FUNC_ID_ZW_SET_LEARN_MODE, true );
    msg->Append( 0xff );
    SendMsg( msg, MsgQueue_Command );
    break;
}

Other than that, the FUNC_ID_ZW_SET_LEARN_MODE is not used ... but as the name suggests, this is not intended for your use case and may not work.