-
Notifications
You must be signed in to change notification settings - Fork 265
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
Add ability to restart/rebuild addon from vscode #58
Conversation
Update: I'm slightly less happy with this than I was. Since creating the PR I've realised that the template repo is probably intended for a collection of add-ons, not just one. If you have just one addon it works well, but if you have more then one, there's not an easy way to configure which one to start/rebuild. Perhaps it makes more sense to define the slug explicitly for the example addon, then let the developer duplicate that section of |
While there is only 1 addon here, that's generally not the case for an actual repository. |
@ludeeus I tried this and it works, but when I call the function I have to manually type the addon directory name in to make it run. I have updated the PR with this now. Can you think of any improvements? |
93968d6
to
bc2821a
Compare
e63a15d
to
45e1834
Compare
@ludeeus If I understood you correctly, this should be ready now. |
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.
Looking good, we have "direct" access to the ha
CLI, so lets use that 👍
Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍 |
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.
Thanks 👍
Working from within vscode, it is helpful to have the ability to immediately run the code you have just edited, and watch the output. Shortening this iteration cycle makes a big difference to productivity.
Currently it seems the normal method is to start and stop addons via the web UI, and view logs in a non-live way via the web-based log view.
This PR adds two 'tasks' to the vscode command palette within the development environment:
The grep is needed to get the slug name of the addon which is configured by the user in
config.yaml
Note that it is necessary for HA to be running (e.g. via first running 'Start Home Assistant') before triggering either of the above two tasks from the palette.
Also note that this PR makes no difference to the way the addon operates. It's just to help vscode users during development.
In both cases it is possible to use vscode's built-in 'Tasks: Restart Running Task' which effectively stops and restarts the addon.
The end result is that
ctrl-shift-p,<enter>,<enter>
without leaving vscode is enough to iterate.