-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Update attribute_observer examples and docs #420
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
8dc2e84
to
2484094
Compare
…w message_listener decorator etc
…er updates to API Ref
2484094
to
251418e
Compare
…s_413 Update attribute_observer examples and docs
Thanks for merging! |
I'm trying to run the example, but hit two snags:
I think the "def" should be "self,raw_imu", shouldn't it?
Is the eventual intent to move to objects with Vehicle? I'm coding up RADIO_STATUS now, so would like to do it the "right" way. |
Hi @mikerob 'm trying to run the example, but hit two snags:
No, this is an argument so it can be whatever you like. However in an example it should probably be attr_name to make it clear what this value will return with. I've pushed a change to #426 for this.
I suspect that the API changed underneath you so that the examples no longer match the docs - the decorator is now
You should not take the example as "exactly" the same way as you implement something that is part of the API - instead you should copy the patterns in the existing init.py :-) The reason the example is different is that
@tcr3dr Depending on strategy discussions we probably should consider if we need to adopt the same sort of pattern for the example as we use internally (if that is possible - not sure you can declare the properly in the same way) even though it might not make so much sense. If only so that when people copy they copy the right thing. The obvious alternative is to write a "how to add an attribute "properly" doc.. |
@hamishwillee I reworked the example until I came up with #437, similar to how internal initialization works. I think that should answer the above questions if you agree. @mikerob Thanks for contributing. Can you open new issues or continue on #437 to continue discussion? I don't mind new issues being opened, I just want to make sure I don't overlook comments submitted into closed issues.
We have to make a judgement call for each attribute, but I imagine there's no reason not to merge it upstream. |
This updates the main examples and API ref for attribute observers and for message listeners. There are a couple of outstanding questions around listeners, and I understand @tcr3dr is going to rename some of the attribute observer methods.
This also updates the migration guide with information about attribute observers and message listeners (the information is "high level" and refers back to the relevant guide sections)
At time of writing it does not