Skip to content

Disconnect velux on hass stop#26266

Merged
MartinHjelmare merged 15 commits into
home-assistant:devfrom
gibman:master
Sep 17, 2019
Merged

Disconnect velux on hass stop#26266
MartinHjelmare merged 15 commits into
home-assistant:devfrom
gibman:master

Conversation

@gibman
Copy link
Copy Markdown
Contributor

@gibman gibman commented Aug 29, 2019

Description:

Often when rebooting hass the KLF 200 device would not disconnect the previous connection which in turns locks out the use from connecting again.
In these situations one would have to powercycle the klf200 velux device, which could be a problem if not being at home.

Ive set up af listener for EVENT_HOMEASSISTANT_STOP, which would jsutm ake sure to call disconnect on the device.

more info here:
https://community.home-assistant.io/t/velux-component-for-klf-200-doesnt-support-the-new-api-with-firmware-2-0-0-71/75641/67

Pull request with documentation for home-assistant.io (if applicable): home-assistant/home-assistant.io#<home-assistant.io PR number goes here>

Checklist:

  • The code change is tested and works locally.
  • Local tests pass with tox. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • The manifest file has all fields filled out correctly. Update and include derived files by running python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt by running python3 -m script.gen_requirements_all.
  • Untested files have been added to .coveragerc.

If the code does not interact with devices:

  • Tests have been added to verify that the new code works.

gibman added 2 commits August 29, 2019 16:43
…ss device.

disconnect is now being called on the 'EVENT_HOMEASSISTANT_STOP' event
@probot-home-assistant probot-home-assistant Bot added integration: velux merging-to-master This PR is merging into the master branch and should probably change the branch to `dev`. small-pr PRs with less than 30 lines. labels Aug 29, 2019
@gibman
Copy link
Copy Markdown
Contributor Author

gibman commented Aug 29, 2019

So Ive added the "unknown" email to my account .. how do I retrigger the bot in order to re-evaluate?
I tried doing an empty commit along with a dummy comment.
Doesnt seem to cut it...

sigh..

@balloob balloob changed the base branch from master to dev August 30, 2019 03:16
@balloob balloob added cla-recheck and removed cla-error cla-signed merging-to-master This PR is merging into the master branch and should probably change the branch to `dev`. labels Aug 30, 2019
@home-assistant home-assistant deleted a comment from homeassistant Aug 31, 2019
Comment thread homeassistant/components/velux/__init__.py Outdated
Comment thread homeassistant/components/velux/__init__.py Outdated
@MartinHjelmare MartinHjelmare changed the title velux KLF200 device did not disconnect properly when rebooting hass. Disconnect velux on hass stop Aug 31, 2019
Comment thread homeassistant/components/velux/__init__.py Outdated
Comment thread homeassistant/components/velux/__init__.py Outdated
Comment thread homeassistant/components/velux/__init__.py Outdated
Comment thread homeassistant/components/velux/__init__.py Outdated
Comment thread homeassistant/components/velux/__init__.py Outdated
Comment thread homeassistant/components/velux/__init__.py Outdated
Comment thread homeassistant/components/velux/__init__.py Outdated
logger level moved from info to debug
only config[DOMAIN] exposed to module
imports moved to top
Comment thread homeassistant/components/velux/__init__.py Outdated
Copy link
Copy Markdown
Member

@MartinHjelmare MartinHjelmare left a comment

Choose a reason for hiding this comment

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

Good! Can be merged when lint and formatting is fixed and build passes.

@gibman
Copy link
Copy Markdown
Contributor Author

gibman commented Sep 6, 2019

Good! Can be merged when lint and formatting is fixed and build passes.

No idea what to fix here ??
Not too many hints revealed in those error messages :/

@ppetru
Copy link
Copy Markdown
Contributor

ppetru commented Sep 13, 2019

@gibman thanks for the PR, looking forward to having it in a release since it's quite annoying to keep powercycling my KLF 200 :)

I'm not too familiar with the automated checks involved here, but clicking through the details links brought me to this: https://dev.azure.com/home-assistant/Home%20Assistant/_build/results?buildId=8149&view=logs&jobId=2fa2c639-d05e-530d-034e-4fb413fcea4e&j=4e214fed-f310-53fa-0018-b38e7beb405b -- if you expand the "Run flake8" section you get a bunch of lint errors:

homeassistant/components/velux/init.py:27:38: W291 trailing whitespace
homeassistant/components/velux/init.py:50:26: W291 trailing whitespace
homeassistant/components/velux/init.py:52:1: W293 blank line contains whitespace
homeassistant/components/velux/init.py:54:1: D102 Missing docstring in public method
homeassistant/components/velux/init.py:54:5: E303 too many blank lines (2)
homeassistant/components/velux/init.py:59:1: W293 blank line contains whitespace
homeassistant/components/velux/init.py:60:81: W291 trailing whitespace
homeassistant/components/velux/init.py:66:5: E303 too many blank lines (2)
homeassistant/components/velux/init.py:68:49: W291 trailing whitespace
homeassistant/components/velux/init.py:71:1: W391 blank line at end of file
homeassistant/components/velux/init.py:71:1: W293 blank line contains whitespace

This might also be useful for checking locally so that you don't have to wait for the CI robots to point out your errors: https://developers.home-assistant.io/docs/en/development_testing.html#preventing-linter-errors

@MartinHjelmare
Copy link
Copy Markdown
Member

Please run black from the project root and commit the changes, to solve formatting.

black --fast homeassistant

@gibman
Copy link
Copy Markdown
Contributor Author

gibman commented Sep 13, 2019

Please run black from the project root and commit the changes, to solve formatting.

black --fast homeassistant

I think you assume that I know what black is ? :)
I'm merely running notepad++ on a windows box.
I did try to get rid of those annoying trailing whitespaces and the latest commit

regards
gibman

@ppetru
Copy link
Copy Markdown
Contributor

ppetru commented Sep 13, 2019

This might be helpful: https://black.readthedocs.io/en/stable/installation_and_usage.html

@MartinHjelmare
Copy link
Copy Markdown
Member

Black is mentioned in our developer docs:
https://developers.home-assistant.io/docs/en/development_guidelines.html

@MartinHjelmare
Copy link
Copy Markdown
Member

Thanks!

@MartinHjelmare MartinHjelmare merged commit ed13cab into home-assistant:dev Sep 17, 2019
@lock lock Bot locked and limited conversation to collaborators Sep 18, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants