IMPORTANT: Thing Status Updates

160 views
Skip to first unread message

Kai Kreuzer

unread,
Apr 22, 2015, 8:23:26 AM4/22/15
to open...@googlegroups.com
Hi all,

There has been an update in Eclipse SmartHome that might potentially break your code in case you did a getThing.setStatus() in order to update a thing status to ONLINE or OFFLINE.

Please note that the status concept has been extended, so that you can now provide more detailed information. You also do not need to do any logging yourself for thing status updates as they are logged at a central place.
Even if your binding compiles alright, you might be interested to update your code to make use of the new possibilities. Please refer to the documentation for more details: https://github.com/eclipse/smarthome/blob/master/docs/sources/architecture/thing-handler.md#updating-the-thing-status

Best regards,
Kai

Chris Jackson

unread,
Apr 23, 2015, 2:26:40 PM4/23/15
to open...@googlegroups.com
Hi Kai,
The doc says that the binding shouldn't set the status to anything other than on/offline and removed. But where exactly does the framework set it to INITIALIZING? I'm looking at the thingUpdated method as I want to set back to initialising in some cases (but not all - it depends on what gets changed) - how do I conditionally change it back and then reinitialise the binding?

I could easily do this within the binding, but if I'm not allowed, then I need to know what methods to call to do this... Or, maybe I should just go to OFFLINE, or ???

Cheers
Chris

Kai Kreuzer

unread,
Apr 23, 2015, 3:26:17 PM4/23/15
to open...@googlegroups.com
Hi Chris,

I assume your use cases are related to a configuration change (i.e. thingUpdated() call), where you need to go back to INITIALIZING?
Good question, actually the framework probably should set the status before calling this method. Would that be ok or do you have other use cases in mind as well?

Regards,
Kai

--
You received this message because you are subscribed to the Google Groups "openhab2" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openhab2+u...@googlegroups.com.
To post to this group, send email to open...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/openhab2/9e08e078-6549-4935-8070-812d4f68ff3c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Chris Jackson

unread,
Apr 23, 2015, 3:36:01 PM4/23/15
to open...@googlegroups.com
Hi Kai,
Yep - that’s correct. First - I’ll apologise for confusion as I’ve posted the ‘other half’ of my problem on the ESH forum…

Due to initialisation time of some networks (zwave, zigbee), I don’t want to have to reinitialise the network if insignificant parameters have changed - e.g. the thing name, or even some timers etc. I basically only want to reinitialise if we change things that directly impact the network - if a parameter can be updated without reinitialisation, then I’d prefer to do this…

So, I would like to be able to decide in my thingUpdated method wether or not I do an update. This has other impacts as the default implementation of thingUpdated internally calls dispose and initialise and I don’t necessarily want to do that, but I suspect I need to call this method so the base class can keep track of the ‘thing’.

I think this needs a bit of a rethink to allow the binding a bit more flexibility when it’s updated?

Cheers
Chris

Kai Kreuzer

unread,
Apr 23, 2015, 3:45:00 PM4/23/15
to open...@googlegroups.com
Hi Chris,

> I think this needs a bit of a rethink to allow the binding a bit more flexibility when it’s updated?

Yes, the default implementation of this method is clearly a quick & dirty one. I fully agree that it should allow more finegrained action, if necessary. So please follow my advice (in the Eclipse forum) and create a Bugzilla issue for it!

Cheers,
Kai
> --
> You received this message because you are subscribed to the Google Groups "openhab2" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to openhab2+u...@googlegroups.com.
> To post to this group, send email to open...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/openhab2/E2CBB706-B340-4DE7-B611-C8D4258A9698%40cd-jackson.com.

Chris Jackson

unread,
Apr 23, 2015, 4:21:31 PM4/23/15
to open...@googlegroups.com
Already done :)

Thanks


Reply all
Reply to author
Forward
0 new messages