Skip to content
This repository has been archived by the owner on May 17, 2021. It is now read-only.

Initial Commit of the Autelis Pool Control binding for openHAB #2233

Merged
merged 1 commit into from
May 12, 2015

Conversation

digitaldan
Copy link
Contributor

Signed-off-by: Dan Cunningham dan@digitaldan.com (github: digitaldan)

@buildhive
Copy link

openhab » openhab #2437 SUCCESS
This pull request looks good
(what's this?)

@buildhive
Copy link

openhab » openhab #2438 SUCCESS
This pull request looks good
(what's this?)

@teichsta
Copy link
Member

teichsta commented Mar 5, 2015

@digitaldan thanks a lot for this contribution. Will come back to you once i've finished the Review.

@buildhive
Copy link

openhab » openhab #2445 FAILURE
Looks like there's a problem with this pull request
(what's this?)

@buildhive
Copy link

openhab » openhab #2446 SUCCESS
This pull request looks good
(what's this?)

* run has been executed we only update an item if the value is different then what's in the
* cache. Not sure if there's a better way to do this.
*/
private Map<String, State> cachedItemState;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@teichsta , is there a better way of doing this? Is there a way of looking up an items state somewhere in openHAB. If I forgo the cache and just do a postUpdate I think it still sends it on the bus regardless if the state is the same or not.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general Bindings should be stateless since the Items' state can (potentially) be changed from other instances as well. Hence such caching should be avoided. See also this recent discussion about the usage of the ItemRegistry directly https://groups.google.com/d/msg/openhab/UeexB3MRLBU/HmmxrR4WUvoJ.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @teichsta , that was my first thought as well, but I could not find any external bindings using the itemRegistry so I wasn't sure if that was appropriate or not.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@digitaldan : In general, it is not ok. As I mentioned in the referened thread, whenever you have a "real" update available through polling, you should also send it and not check for differences in the state yourself. So you should normally not need any kind of general state caching. In the referenced thread there were some special situations though, where the use of the ItemRegistry seemed to be the only possible workaround. This does not make using the ItemRegistry a recommended architecture!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem I have then is if we poll every 5 seconds, we will generate an awful lot of noise when nothing has changed, this noise finds its way to connected clients, and in my cause would cause a lot of unnecessary polling by the IOS and Android clients (yes I'm sensitive here). I would prefer then to leave it the way it is for OH 1.x and revisit this in 2.0 when I port the binding if thats OK?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'll double check, I could see the messages being added to the broadcast cache for clients ( just happened to have trace debugging on for the rest binding), so I'm assuming they were being delivered.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So ResourceStateChangeListener.java in the rest binding is listening for state updated events and ignores state changed events, there was some code there but it has been commented out. Should it be the other way around?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so I'm assuming they were being delivered.

So maybe this would be the right place to work on then :-)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually I lied, both updated and changed are broadcasting, I will disable the call to broadcast on update, I'm not sure what the original intention was however.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kaikreuzer see pr #2269, its a one line change, my initial testing proved fine, I will continue to test on my system. Note, this one line change may be a significant improvement to users with "chatty" systems that we have recently addressed in the rest binding.

@buildhive
Copy link

openhab » openhab #2466 SUCCESS
This pull request looks good
(what's this?)

@buildhive
Copy link

openhab » openhab #2467 SUCCESS
This pull request looks good
(what's this?)

@buildhive
Copy link

openhab » openhab #2488 SUCCESS
This pull request looks good
(what's this?)

@buildhive
Copy link

openhab » openhab #2491 SUCCESS
This pull request looks good
(what's this?)

@buildhive
Copy link

openhab » openhab #2664 SUCCESS
This pull request looks good
(what's this?)

@digitaldan
Copy link
Contributor Author

Hi any chance to get this merged? I would like to cross this off my todo list ;-)

@teichsta
Copy link
Member

teichsta commented May 4, 2015

i'll start the review now … so it will be part of the RC2

org.osgi.service.component,
org.osgi.service.event,
org.slf4j
Export-Package: org.openhab.binding.autelis
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove this export unless you really need the package elsewhere

@teichsta
Copy link
Member

teichsta commented May 4, 2015

Hi @digitaldan,

this PR looks quite good already. Please find my review comments inline. Please squash your commits into one once you've incorporated my feedback.

Thanks, Thomas E.-E.

@teichsta teichsta added this to the 1.7.0 milestone May 4, 2015
@digitaldan
Copy link
Contributor Author

@teichsta thanks so much for the thoughtful review, the 1.7 release looks fantastic!

Signed-off-by: Dan Cunningham dan@digitaldan.com (github: digitaldan)
@buildhive
Copy link

openhab » openhab #2898 SUCCESS
This pull request looks good
(what's this?)

@digitaldan
Copy link
Contributor Author

@teichsta this should be good to merge, thanks.

teichsta added a commit that referenced this pull request May 12, 2015
Initial Commit of the Autelis Pool Control binding for openHAB
@teichsta teichsta merged commit 39224d1 into openhab:master May 12, 2015
@teichsta
Copy link
Member

Thanks @digitaldan! I am happy to also link the according Wiki page ;-)

@digitaldan
Copy link
Contributor Author

Thanks @teichsta! I just added the wiki page so I think we are good.

@teichsta
Copy link
Member

yep, thanks!

@digitaldan digitaldan deleted the autelis-binding branch December 12, 2015 18:19
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants