Closed amelora closed 6 years ago
Hi, @amelora. Thank you for pointing out a typo. About the second question with the null value of a dimmer variable - this might be because you don't have a device with id 4 on your ZWave controller. Check which devices are already included into your ZWave network and use their ids. Also, you can try to use a test program (https://github.com/genielabs/zwave-lib-dotnet/blob/master/Test.ZWave/Program.cs) and run ListNodes command to see which nodes are available to the controller.
@Bounz I have the same problem with the example code from the home page. But my node id definitely exists. (Also the other test program works fine!)
Shouldn't the example code call controller.Connect() somewhere and wait until the controller is ready? Because it doesn't call Connect() anywhere... I don't think this can ever have worked.
Shouldn't the example code call controller.Connect() somewhere
Yes, you are right, it's necessary to call controller.Connect()
, as it's done in test program where you open connection using the +
menu item.
Fixed the sample in this PR https://github.com/genielabs/zwave-lib-dotnet/pull/30
I tried the example code from the home page and experienced two issues:
1- There is a typo error in the following code in the line "SwitchMultiLevel.Set(dimmer, 50);". The "L" must be lowercase.
2- The real issue: On my computer the variable "dimmer" (line 14) is not initialized. For some reason it keeps the "null" value. So the next line (SwitchMultilevel.Set(dimmer, 50);) throw a NullReferenceException.
I've double checked my port and node numbers and they are correct.