Skip to content
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

Execute hc login on first run #95

Merged
merged 12 commits into from
Oct 7, 2024

Conversation

saveriol
Copy link
Contributor

@saveriol saveriol commented Sep 25, 2024

This PR aims to execute hc-login.py directly on first run of home assistant add-on. Two new text inputs has been added to HA addon configuration (HC email & password) and will be passed to hc-login.py.

Resolves:

Notable changes

  • bashio is used instead of jq to parse options in run.sh. I don't know if jq is used elsewhere, if not we will need to remove it in dockerfile (bashio is recommended in HA addons documentation)
  • now the addon_config is mapped also, and in configuration will use this path by default instead of /share/ which I currently left there but I think we will need to remove it any time soon. Use addon_config is best practice on HA addons for a use case like this one. Also, this is included in add-on backups unlike /share/.
  • hc-login.py does not print devices.json on stdout, instead an arg for the filename has beed added to the script so that the errors will be printed on stdout (and so, in the addon logs) instead of the file. Also, now it prints the discovered devices' names and hostnames in stdout so they can be seen in addon's logs.

@saveriol saveriol marked this pull request as draft September 25, 2024 15:12
@saveriol saveriol marked this pull request as ready for review September 25, 2024 15:14
@saveriol saveriol marked this pull request as draft September 26, 2024 07:31
@saveriol saveriol marked this pull request as ready for review September 26, 2024 07:33
@pmagyar
Copy link
Contributor

pmagyar commented Oct 4, 2024

Looks good to me. Maybe you really can remove jq from the docker file. My search result said, that we does not use it elsewhere.
The step to bashio is also great. Thanks for that!

@pmagyar pmagyar requested a review from Meatballs1 October 4, 2024 13:36
Copy link
Collaborator

@Meatballs1 Meatballs1 left a comment

Choose a reason for hiding this comment

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

Haven't had a chance to test yet, would be good practice to validate the checksum on the dependency download in docker

Dockerfile Show resolved Hide resolved
@saveriol
Copy link
Contributor Author

saveriol commented Oct 4, 2024

Maybe you really can remove jq from the docker file. My search result said, that we does not use it elsewhere.

I just checked and it's used in bashio. So we need to keep it.

@pmagyar pmagyar merged commit 6fe5376 into hcpy2-0:main Oct 7, 2024
2 checks passed
@pmagyar pmagyar mentioned this pull request Oct 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants