Skip to content

Support fan/vacuum/media_player as Switch in HomeKit#13805

Closed
Yonsm wants to merge 2 commits intohome-assistant:devfrom
Yonsm:homekit_fan_vacuum_mediaplayer
Closed

Support fan/vacuum/media_player as Switch in HomeKit#13805
Yonsm wants to merge 2 commits intohome-assistant:devfrom
Yonsm:homekit_fan_vacuum_mediaplayer

Conversation

@Yonsm
Copy link
Copy Markdown

@Yonsm Yonsm commented Apr 10, 2018

Description:

Support fan/vacuum/media_player as Switch in HomeKit.

Pull request in home-assistant.github.io with documentation (if applicable): home-assistant/home-assistant.github.io#NA If @cdce8p consider this PR is acceptable, I'll update the document in home-assistant.github.io

Checklist:

  • The code change is tested and works locally.
  • Local tests pass with tox.

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

If the code does not interact with devices:

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

Copy link
Copy Markdown
Member

@cdce8p cdce8p left a comment

Choose a reason for hiding this comment

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

I will explain it later.

@cdce8p
Copy link
Copy Markdown
Member

cdce8p commented Apr 10, 2018

I really like the idea of adding those types. However if we just use type_switch we are making it us to easy which would come back to harm us.

All of those domains support additional features, that are in part already supported by HomeKit.
@Yonsm If you want to move forward with it, please create separate type files for each and take a look at the services.json file. As an example for the fan domain, the Fanv2 service might be a good idea. Additionally that would allow for individual categories.

I'm closing this PR. Each new type should go in a new PR to make reviewing it easier.

@cdce8p cdce8p closed this Apr 10, 2018
@Yonsm
Copy link
Copy Markdown
Author

Yonsm commented Apr 11, 2018

Yes, I agree with you. This PR is a temporary and simple support at this moment. Looking forward to support Fanv2/AirPurifier with full feature., maybe I can do it later.

For domain vacuum and media_player, there is no corresponding service in HomeKit. Do you regard them as Switch?

@cdce8p
Copy link
Copy Markdown
Member

cdce8p commented Apr 11, 2018

For media_player the speaker Service would be a good addition.
For vacuum I believe there is a fan speed setting. So adding the Fanv2 service might be an idea in addition to a normal switch.

If you want, I can open a PR later this week for the media_player domain so you see what I mean.

@cdce8p
Copy link
Copy Markdown
Member

cdce8p commented Apr 13, 2018

@Yonsm I've done a bit of testing and it seems like HomeKit is quite restrictive about what it supports. Originally I thought that I could add the speaker service with the chars mute and volume to support more than just on off, but it turned out that those are only support / intended for IP-cameras to use currently (see homebridge/homebridge#1326 for more information).

Their are a few hacks around it, e.g. adding the fan service to control the volume, but I don't think we should go that way.

As a result I would follow the solution you suggested earlier to add the media_player as a switch. The only question being if we would like to map it to something else than on / off, like homebridge is doing it: resume / pause or play / stop.

For the vacuum I would suggest we use this PR and add it as a switch with turn on / turn off.

What's your opinion on it?

@Yonsm Yonsm deleted the homekit_fan_vacuum_mediaplayer branch April 28, 2018 11:37
@cdce8p cdce8p mentioned this pull request May 6, 2018
8 tasks
@home-assistant home-assistant locked and limited conversation to collaborators Sep 5, 2018
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.

4 participants