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 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.

@project-bot project-bot bot added this to Needs review in Dev Nov 3, 2019
@probot-home-assistant
Copy link

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
Comment on lines 329 to 334

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

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

Copy link
Member

Choose a reason for hiding this comment

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

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

@balloob
Copy link
Member

balloob commented Nov 3, 2019

#27280

@elupus
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
Copy link
Contributor Author

elupus commented Nov 3, 2019

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

@elupus
Copy link
Contributor Author

elupus commented Nov 3, 2019

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

Dev automation moved this from Needs review to Reviewer approved Nov 3, 2019
@balloob
Copy link
Member

balloob commented Nov 3, 2019

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

@elupus
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
Copy link
Member

balloob commented Nov 3, 2019

So what about we implement the architecture issue first ?

@elupus
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
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
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 tasks
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.
@balloob balloob merged commit 4191d9c into home-assistant:dev Dec 3, 2019
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
Development

Successfully merging this pull request may close these issues.

Google Assistant Integration: Unavailable devices are being auto removed in Google Home App
3 participants