tobof / openhab-addons

The next-generation open Home Automation Bus (openHAB)
Eclipse Public License 2.0
39 stars 30 forks source link

Allow 0 as a valid node id #67

Closed FredericMa closed 7 years ago

FredericMa commented 7 years ago

Hello all,

Since the release of version 2 of the mysensors library it is also possible to have sensors attached to the gateway, making the node id 0 a valid node id. When I try to add sensors that are connected to node 0 (the gataway) i get the error message: "Invalid node id supplied: 0".

This is the complete stacktrace: 2017-02-27 16:17:31.035 [ERROR] [ensors.handler.MySensorsThingHandler] - Failing on create node/child for thing mysensors:power:1e91ebba java.lang.IllegalArgumentException: Invalid node id supplied: 0 at org.openhab.binding.mysensors.internal.sensors.MySensorsNode.<init>(MySensorsNode.java:49)[9:org.openhab.binding.mysensors:2.0.0.201702111243] at org.openhab.binding.mysensors.handler.MySensorsThingHandler.generateNodeFromThing(MySensorsThingHandler.java:319)[9:org.openhab.binding.mysensors:2.0.0.201702111243] at org.openhab.binding.mysensors.handler.MySensorsThingHandler.addIntoGateway(MySensorsThingHandler.java:296)[9:org.openhab.binding.mysensors:2.0.0.201702111243] at org.openhab.binding.mysensors.handler.MySensorsThingHandler.initialize(MySensorsThingHandler.java:86)[9:org.openhab.binding.mysensors:2.0.0.201702111243] at org.eclipse.smarthome.core.thing.internal.ThingManager$9$1.call(ThingManager.java:701)[107:org.eclipse.smarthome.core.thing:0.9.0.201702171712] at org.eclipse.smarthome.core.thing.internal.ThingManager$9$1.call(ThingManager.java:1)[107:org.eclipse.smarthome.core.thing:0.9.0.201702171712] at org.eclipse.smarthome.core.common.SafeMethodCaller$CallableWrapper.call(SafeMethodCaller.java:181)[100:org.eclipse.smarthome.core:0.9.0.201702171712] at java.util.concurrent.FutureTask.run(FutureTask.java:266)[:1.8.0_101] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)[:1.8.0_101] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)[:1.8.0_101] at java.lang.Thread.run(Thread.java:745)[:1.8.0_101] 2017-02-27 16:17:31.036 [ERROR] [ensors.handler.MySensorsThingHandler] - Failed to build sensor for thing: mysensors:power:1e91ebba

Greetings, Frederic

andreacioni commented 7 years ago

Thank you for reporting it. I'll take a look on your issue as soon as possible.

FredericMa commented 7 years ago

A little note: I'm using the refactoring branch to test.

andreacioni commented 7 years ago

If this snapshot resolve your issue I'll push immediately changes to @tobof repo. Let me know 😃

FredericMa commented 7 years ago

I deployed it and the binding successfully connected to the bridge and the sensors were registered correctly so we can call it a success!

Thanks for your quick support!