-
Notifications
You must be signed in to change notification settings - Fork 60
RSDK-4172 - update wifi sensor #393
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
RSDK-4172 - update wifi sensor #393
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good! once published, i'll fwd to the contractor who had some struggles with the old format and see if it helps her. thanks as always for putting such strong efforts into docs!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should move the examples out of your personal gist into something a bit more official. Also, there's a bug in your gist: your main functions don't close parens properly. Also, the main
function doesn't have to be async
since nothing awaitable is happening
"If a validator function is added, it must also be called when registering the resource. The `ResourceCreatorRegistration` should now also have the validator function passed in as the second parameter. \n", | ||
"\n", | ||
"```python\n", | ||
" async def main():\n", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should not have main functions in these files
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was added previously in another PR. The wifi_sensor.py
was changed by @cheukt to have the main function there.
docs/examples/example.ipynb
Outdated
"async def main():\n", | ||
" Registry.register_resource_creator(Sensor.SUBTYPE, MySensor.MODEL, ResourceCreatorRegistration(MySensor.new))\n", | ||
"```\n" | ||
"```\n", | ||
"\n", | ||
"Click [here](https://gist.github.com/purplenicole730/dc3ddd9d53fd5da16c3bde0e0a6a63f4#file-module_step2-py) to see the file with its new `MODEL` variable, creator function, and `main()` function.\n", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again, we shouldn't have main functions here. Especially since in the example linked, it clearly states that the main function will be replaced later. We should show them the proper way to register a resource creator in this example
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is an intermediary step, so we're showing what it looks like right after registering the resource in the registry. @dannenberg requested to have snapshots in the middle of the steps so that a user can easily follow along.
As for the main function, it was originally not here until another PR added a main() function. It does say in the descriptions that whatever is in the main
can also be its own file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Uh oh!
There was an error while loading. Please reload this page.