{"action":"created","issue":{"url":"https://api.github.com/repos/openhab/openhab2-addons/issues/693","repository_url":"https://api.github.com/repos/openhab/openhab2-addons","labels_url":"https://api.github.com/repos/openhab/openhab2-addons/issues/693/labels{/name}","comments_url":"https://api.github.com/repos/openhab/openhab2-addons/issues/693/comments","events_url":"https://api.github.com/repos/openhab/openhab2-addons/issues/693/events","html_url":"https://github.com/openhab/openhab2-addons/issues/693","id":137860647,"number":693,"title":"Weird thing status updates on startup","user":{"login":"kaikreuzer","id":3244965,"avatar_url":"https://avatars.githubusercontent.com/u/3244965?v=3","gravatar_id":"","url":"https://api.github.com/users/kaikreuzer","html_url":"https://github.com/kaikreuzer","followers_url":"https://api.github.com/users/kaikreuzer/followers","following_url":"https://api.github.com/users/kaikreuzer/following{/other_user}","gists_url":"https://api.github.com/users/kaikreuzer/gists{/gist_id}","starred_url":"https://api.github.com/users/kaikreuzer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kaikreuzer/subscriptions","organizations_url":"https://api.github.com/users/kaikreuzer/orgs","repos_url":"https://api.github.com/users/kaikreuzer/repos","events_url":"https://api.github.com/users/kaikreuzer/events{/privacy}","received_events_url":"https://api.github.com/users/kaikreuzer/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/openhab/openhab2-addons/labels/bug","name":"bug","color":"fc2929"},{"url":"https://api.github.com/repos/openhab/openhab2-addons/labels/z-wave","name":"z-wave","color":"bfe5bf"}],"state":"open","locked":false,"assignee":{"login":"cdjackson","id":1041475,"avatar_url":"https://avatars.githubusercontent.com/u/1041475?v=3","gravatar_id":"","url":"https://api.github.com/users/cdjackson","html_url":"https://github.com/cdjackson","followers_url":"https://api.github.com/users/cdjackson/followers","following_url":"https://api.github.com/users/cdjackson/following{/other_user}","gists_url":"https://api.github.com/users/cdjackson/gists{/gist_id}","starred_url":"https://api.github.com/users/cdjackson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cdjackson/subscriptions","organizations_url":"https://api.github.com/users/cdjackson/orgs","repos_url":"https://api.github.com/users/cdjackson/repos","events_url":"https://api.github.com/users/cdjackson/events{/privacy}","received_events_url":"https://api.github.com/users/cdjackson/received_events","type":"User","site_admin":false},"milestone":null,"comments":3,"created_at":"2016-03-02T12:23:31Z","updated_at":"2016-03-02T15:05:50Z","closed_at":null,"body":"Adding a Z-Wave stick as a thing, I see the following log:\r\n```\r\n12:18:25.358 [INFO ] [me.event.ThingStatusInfoChangedEvent] - 'zwave:serial_zstick:ad1f4a49' changed from UNINITIALIZED to INITIALIZING\r\n12:18:25.359 [INFO ] [ing.zwave.handler.ZWaveSerialHandler] - Connecting to serial port '/dev/ttyACM1'\r\n12:18:25.363 [INFO ] [me.event.ThingStatusInfoChangedEvent] - 'zwave:serial_zstick:ad1f4a49' changed from INITIALIZING to ONLINE\r\n12:18:25.388 [INFO ] [ing.zwave.handler.ZWaveSerialHandler] - Serial port is initialized\r\n12:18:25.411 [INFO ] [ve.internal.protocol.ZWaveController] - Starting ZWave controller\r\n12:18:25.412 [INFO ] [ve.internal.protocol.ZWaveController] - ZWave timeout is set to 5000ms. Soft reset is false.\r\n12:18:25.445 [INFO ] [me.event.ThingStatusInfoChangedEvent] - 'zwave:serial_zstick:ad1f4a49' changed from ONLINE to INITIALIZING\r\n12:18:26.155 [INFO ] [smarthome.event.ItemAddedEvent      ] - Item 'zwave_serial_zstick_ad1f4a49' has been added.\r\n12:18:26.498 [INFO ] [rthome.event.ItemThingLinkAddedEvent] - Link 'zwave_serial_zstick_ad1f4a49-zwave:serial_zstick:ad1f4a49' has been added.\r\n12:18:26.824 [ERROR] [ve.internal.protocol.ZWaveController] - Exception during ZWave thread: Input 2.\r\njava.lang.NullPointerException\r\n\tat org.openhab.binding.zwave.internal.protocol.SerialMessage.getMessageBuffer(SerialMessage.java:216)\r\n\tat org.openhab.binding.zwave.internal.protocol.ZWaveController$ZWaveInputThread.run(ZWaveController.java:1035)\r\n12:18:31.816 [ERROR] [ocol.ZWaveController$ZWaveSendThread] - NODE 255: Timeout while sending message. Requeueing - 2 attempts left!\r\n12:18:36.829 [ERROR] [ocol.ZWaveController$ZWaveSendThread] - NODE 255: Timeout while sending message. Requeueing - 1 attempts left!\r\n12:18:41.835 [ERROR] [ocol.ZWaveController$ZWaveSendThread] - NODE 255: Timeout while sending message. Requeueing - 0 attempts left!\r\n12:18:46.840 [WARN ] [ocol.ZWaveController$ZWaveSendThread] - NODE 255: Too many retries. Discarding message: Message: class = AddNodeToNetwork (0x4A), type = Request (0x00), payload = 05 \r\n12:18:47.074 [INFO ] [age.SerialApiGetInitDataMessageClass] - NODE 1: Node found\r\n12:18:47.076 [INFO ] [age.SerialApiGetInitDataMessageClass] - NODE 2: Node found\r\n12:18:47.077 [INFO ] [age.SerialApiGetInitDataMessageClass] - NODE 3: Node found\r\n12:18:47.079 [INFO ] [age.SerialApiGetInitDataMessageClass] - ZWave Controller using Controller API\r\n12:18:47.081 [INFO ] [age.SerialApiGetInitDataMessageClass] - ZWave Controller is Primary Controller\r\n12:18:47.082 [INFO ] [age.SerialApiGetInitDataMessageClass] - ------------Number of Nodes Found Registered to ZWave Controller------------\r\n12:18:47.084 [INFO ] [age.SerialApiGetInitDataMessageClass] - # Nodes = 3\r\n12:18:47.085 [INFO ] [age.SerialApiGetInitDataMessageClass] - ----------------------------------------------------------------------------\r\n12:18:47.098 [INFO ] [me.event.ThingStatusInfoChangedEvent] - 'zwave:serial_zstick:ad1f4a49' changed from INITIALIZING to ONLINE\r\n```\r\n\r\nFirst of all, the NPE looks like a bug and must be avoided.\r\nThen, the status transitions are: INITIALIZING -> ONLINE -> INITIALIZING -> ONLINE\r\nNote that a binding should never set the status to INITIALIZING itself; if should only switch to ONLINE once it is ready. So I would expect it to be INITIALIZING -> ONLINE only.\r\n"},"comment":{"url":"https://api.github.com/repos/openhab/openhab2-addons/issues/comments/191277679","html_url":"https://github.com/openhab/openhab2-addons/issues/693#issuecomment-191277679","issue_url":"https://api.github.com/repos/openhab/openhab2-addons/issues/693","id":191277679,"user":{"login":"cdjackson","id":1041475,"avatar_url":"https://avatars.githubusercontent.com/u/1041475?v=3","gravatar_id":"","url":"https://api.github.com/users/cdjackson","html_url":"https://github.com/cdjackson","followers_url":"https://api.github.com/users/cdjackson/followers","following_url":"https://api.github.com/users/cdjackson/following{/other_user}","gists_url":"https://api.github.com/users/cdjackson/gists{/gist_id}","starred_url":"https://api.github.com/users/cdjackson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cdjackson/subscriptions","organizations_url":"https://api.github.com/users/cdjackson/orgs","repos_url":"https://api.github.com/users/cdjackson/repos","events_url":"https://api.github.com/users/cdjackson/events{/privacy}","received_events_url":"https://api.github.com/users/cdjackson/received_events","type":"User","site_admin":false},"created_at":"2016-03-02T15:05:50Z","updated_at":"2016-03-02T15:05:50Z","body":"> \n> Can't a few null checks harden the code so that no NPE bubbles up?\n> \nOf course, but where? The binding is very big, and the question is what message was it processing that threw the exception. We have dozens of command classes, and each command class supports multiple commands, so there’s a huge place to look. In general, I agree that we should protect against NPE (etc), but if I’ve missed one, I need to know where to look :)\n\n> Atm, my controller does not come online again because of #694 <https://github.com/openhab/openhab2-addons/issues/694> during its initialization, so I cannot reproduce the NPE from above right now…\n> \n\nI’ll push a fix for this now.\n> \n\n"}}