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

Report unavailable entities to google #28501

Merged
merged 2 commits into from Dec 3, 2019

Conversation

@elupus
Copy link
Contributor

elupus commented Nov 3, 2019

Description:

Entities should only removed when removed from HA. Removing a temporarily unavailable entity from google causes it to need to re-configured once it become available again.

Related issue (if applicable): fixes #28268

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.
@probot-home-assistant

This comment has been minimized.

Copy link

probot-home-assistant bot commented Nov 3, 2019

Hey there @home-assistant/cloud, mind taking a look at this pull request as its been labeled with a integration (google_assistant) you are listed as a codeowner for? Thanks!

@elupus elupus changed the title Report unavailable entites to google. Report unavailable entities to google. Nov 3, 2019

def convert(mireds):
if mireds is None:
return None
return color_util.color_temperature_mired_to_kelvin(mireds)

Comment on lines 329 to 334

This comment has been minimized.

Copy link
@elupus

elupus Nov 3, 2019

Author Contributor

Somewhat of a workaround. A better solution might be to let the color util return None when input is None.

This comment has been minimized.

Copy link
@balloob

balloob Nov 3, 2019

Member

Nah, color util shouldn't catch Nones, it should blow up.

@balloob

This comment has been minimized.

Copy link
Member

balloob commented Nov 3, 2019

@elupus

This comment has been minimized.

Copy link
Contributor Author

elupus commented Nov 3, 2019

Hehe. Lol. Yea same pull. I've hopefully fixed the failing tests thou. The color temperature ends up None when unavailable. So we must support that case.

@elupus

This comment has been minimized.

Copy link
Contributor Author

elupus commented Nov 3, 2019

#28228 will break tests on this pull. Needs adjustment once that goes in.

@elupus

This comment has been minimized.

Copy link
Contributor Author

elupus commented Nov 3, 2019

The 3.6 test fail seem unrelated:
tests/components/yessssms/test_notify.py:113

@balloob
balloob approved these changes Nov 3, 2019
Dev automation moved this from Needs review to Reviewer approved Nov 3, 2019
@balloob

This comment has been minimized.

Copy link
Member

balloob commented Nov 3, 2019

Wouldn't we still be hit by home-assistant/architecture#297 ?

@elupus

This comment has been minimized.

Copy link
Contributor Author

elupus commented Nov 3, 2019

Yes, that is why the fix for color conversion is needed. Min/max ends up none. I don't have any light with that synced to cloud, so not sure what GA will do with none values. Now that you say it. Given that it's part of sync call, that trait will likely not work untill next sync.

So this will solve it for normal on/off /brightness lights, but not for color setting ones.

@balloob

This comment has been minimized.

Copy link
Member

balloob commented Nov 3, 2019

So what about we implement the architecture issue first ?

@elupus

This comment has been minimized.

Copy link
Contributor Author

elupus commented Nov 3, 2019

I don't mind that. But this same pull will be valid then too. So not sure why wait. It solves issue for some users now.

Not sure when I'd have to time to look at the arch issue. Personally rather get the disconnect stuff in shape first.

@elupus

This comment has been minimized.

Copy link
Contributor Author

elupus commented Nov 3, 2019

Didn't need rebase. Thought brightness was part of sync, but obviously not. I've tried re-triggering test on 3.6. Will se if starts.

@MartinHjelmare MartinHjelmare changed the title Report unavailable entities to google. Report unavailable entities to google Nov 3, 2019
@balloob

This comment has been minimized.

Copy link
Member

balloob commented Nov 4, 2019

The thing is that min/max mireds will never be None with the approach suggested in architecture. So that fix wouldn't need to come in.

@balloob balloob mentioned this pull request Dec 2, 2019
5 of 5 tasks complete
elupus added 2 commits Nov 3, 2019
Entities should only removed when removed from HA. Removing a temporarily unavailable entity from google causes it to need to re-configured once it become available again.
@elupus elupus force-pushed the elupus:unavailable_entities branch from 228da6d to 6a976db Dec 2, 2019
@balloob balloob merged commit 4191d9c into home-assistant:dev Dec 3, 2019
11 checks passed
11 checks passed
CI #20191202.33 succeeded
Details
CI (FullCheck Mypy) FullCheck Mypy succeeded
Details
CI (FullCheck Pylint) FullCheck Pylint succeeded
Details
CI (Overview CheckFormat) Overview CheckFormat succeeded
Details
CI (Overview Lint) Overview Lint succeeded
Details
CI (Overview Validate) Overview Validate succeeded
Details
CI (Tests PyTest Python36) Tests PyTest Python36 succeeded
Details
CI (Tests PyTest Python37) Tests PyTest Python37 succeeded
Details
cla-bot Everyone involved has signed the CLA
codecov/patch 100% of diff hit (target 94.44%)
Details
codecov/project 94.44% (target 90%)
Details
Dev automation moved this from Reviewer approved to Done Dec 3, 2019
@lock lock bot locked and limited conversation to collaborators Dec 4, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
Dev
  
Done
3 participants
You can’t perform that action at this time.