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

Add support for vacuum cleaner and traits #15575

Closed
wants to merge 5 commits into from

Conversation

cnrd
Copy link
Contributor

@cnrd cnrd commented Jul 20, 2018

Description:

Add support for vacuum cleaners in Google Assistant.

Added support for StartStopTrait and DockTrait.

Requires #15751 to be merged.

Checklist:

  • The code change is tested and works locally.
  • Local tests pass with tox. Your PR cannot be merged unless tests pass

@frenck
Copy link
Member

frenck commented Jul 21, 2018

I expected docs to be needed for this.
Adding docs-missing label.

@balloob
Copy link
Member

balloob commented Jul 23, 2018

Don't forget tests!

@fabaff fabaff changed the title Google_Assistant: Add support for vacuum cleaner and traits Add support for vacuum cleaner and traits Jul 29, 2018
@arbreng
Copy link
Contributor

arbreng commented Aug 1, 2018

Part of: home-assistant/architecture#29


attrs = self.state.attributes

if attrs[vacuum.ATTR_STATUS] == vacuum.STATE_PAUSED:
Copy link
Contributor

@arbreng arbreng Aug 1, 2018

Choose a reason for hiding this comment

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

To get it working:

if self.state.state == vacuum.STATE_PAUSED:

if attrs[vacuum.ATTR_STATUS] == vacuum.STATE_PAUSED:
response['isPaused'] = True
response['isRunning'] = False
elif attrs[vacuum.ATTR_STATUS] == vacuum.STATE_CLEANING:
Copy link
Contributor

@arbreng arbreng Aug 1, 2018

Choose a reason for hiding this comment

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

To get it working:

elif self.state.state == vacuum.STATE_CLEANING:

response = {}

if domain == vacuum.DOMAIN:
attrs = self.state.attributes
Copy link
Contributor

Choose a reason for hiding this comment

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

To get it working, I replaced the contents of the if block with:

        if self.state.state == vacuum.STATE_DOCKED:
            response['isDocked'] = True
        else:
            response['isDocked'] = False

"""Test if state is supported."""
if domain != vacuum.DOMAIN:
return False

Copy link
Contributor

@arbreng arbreng Aug 1, 2018

Choose a reason for hiding this comment

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

return features & vacuum.SUPPORT_STATE

Probably a good idea to check for SUPPORT_STATE here. That will exclude any platforms that haven't been ported yet

@cnrd
Copy link
Contributor Author

cnrd commented Aug 1, 2018

@arbreng if you want to do the last stretch here and add tests + documentation, feel free to do so, as I'm having a busy week coming up :-) (If you are up for it I can either give you write access to my fork, you can do a PR against my fork and I'll merge it asap or you can take this code and do a new PR).

@arbreng
Copy link
Contributor

arbreng commented Aug 2, 2018

Sure, sounds good to me. I'll be able to finish this Friday, can also add Alexa support

@balloob
Copy link
Member

balloob commented Aug 2, 2018

Alexa needs to be in a different PR please.

service_domain = domain
state = self.state.state

if command == start_stop_command:
Copy link
Member

Choose a reason for hiding this comment

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

if command == COMMAND_STARTSTOP: ?

else:
service = vacuum.SERVICE_STOP

if command == pause_unpause_command:
Copy link
Member

Choose a reason for hiding this comment

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

COMMAND_PAUSEUNPAUSE ?

@sliepie
Copy link

sliepie commented Aug 15, 2018

Can i be of any help with this PR? E.g. docs, tests...

@homeassistant
Copy link
Contributor

Hi @JarnoNijboer,

It seems you haven't yet signed a CLA. Please do so here.

Once you do that we will be able to review and accept this pull request.

Thanks!

@cnrd
Copy link
Contributor Author

cnrd commented Aug 15, 2018

@JarnoNijboer I'm currently very busy, so if you want to move the PR forward by writing tests and docs, feel free to do so. :-)

@BongoEADGC6
Copy link

Working on writing tests for this unsucessfully. Having a fun time reverse engineering.

@BongoEADGC6
Copy link

@balloob is there a good document for how the test system works? Right now it's a lot of trial and error.

@balloob
Copy link
Member

balloob commented Oct 22, 2018

@mariuszluciow
Copy link
Contributor

As mentioned by @dshokouhi here is a similar PR with tests included:
#17657

@cnrd
Copy link
Contributor Author

cnrd commented Oct 25, 2018

#17657 is a more complete implementation of this PR.

@cnrd cnrd closed this Oct 25, 2018
@ghost ghost removed the in progress label Oct 25, 2018
@home-assistant home-assistant locked and limited conversation to collaborators Feb 5, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants