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

Added service select_video_output and video_out attribute #18081

Merged
merged 8 commits into from Nov 2, 2018

Conversation

Projects
None yet
6 participants
@leothlon
Contributor

leothlon commented Nov 1, 2018

Description:

Added service to change video hdmi output
service data "video_output" takes a value of:
'no', 'analog', 'yes', 'out', 'out-sub', 'sub', 'hdbaset', 'both', 'up'

Also adds attribute of "video_out" to display current output

Checklist:

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

This comment has been minimized.

homeassistant commented Nov 1, 2018

Hi @leothlon,

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!

@@ -276,6 +301,10 @@ def play_media(self, media_type, media_id, **kwargs):
self.command('preset {}'.format(media_id))


def select_output(self, output):

This comment has been minimized.

@houndci-bot

houndci-bot Nov 1, 2018

too many blank lines (2)

for device in devices:
if service.service == SERVICE_SELECT_VIDEO_OUTPUT:
device.select_output(service.data.get(ATTR_VIDEO_OUTPUT))

This comment has been minimized.

@houndci-bot

houndci-bot Nov 1, 2018

blank line contains whitespace

"""Handle for services."""
entity_ids = service.data.get(ATTR_ENTITY_ID)
devices = [d for d in hosts if d.entity_id in entity_ids]

This comment has been minimized.

@houndci-bot

houndci-bot Nov 1, 2018

blank line contains whitespace

@@ -55,6 +55,10 @@

TIMEOUT_MESSAGE = 'Timeout waiting for response.'

ATTR_VIDEO_OUTPUT = 'video_output'
ONKYO_SELECT_OUTPUT_SCHEMA = vol.Schema({vol.Required(ATTR_ENTITY_ID): cv.entity_ids, vol.Required(ATTR_VIDEO_OUTPUT): vol.In(['no', 'analog', 'yes', 'out', 'out-sub', 'sub', 'hdbaset', 'both', 'up'])})

This comment has been minimized.

@houndci-bot

houndci-bot Nov 1, 2018

line too long (202 > 79 characters)

Show resolved Hide resolved homeassistant/components/media_player/onkyo.py Outdated

@homeassistant homeassistant added cla-signed and removed cla-needed labels Nov 1, 2018

ACCEPTED_VALUES = ['no', 'analog', 'yes', 'out',
'out-sub', 'sub', 'hdbaset', 'both', 'up']
ONKYO_SELECT_OUTPUT_SCHEMA = vol.Schema({vol.Required(ATTR_ENTITY_ID): cv.entity_ids,
vol.Required(ATTR_VIDEO_OUTPUT): vol.In(ACCEPTED_VALUES)})

This comment has been minimized.

@houndci-bot

houndci-bot Nov 1, 2018

line too long (99 > 79 characters)

ATTR_VIDEO_OUTPUT = 'video_output'
ACCEPTED_VALUES = ['no', 'analog', 'yes', 'out',
'out-sub', 'sub', 'hdbaset', 'both', 'up']
ONKYO_SELECT_OUTPUT_SCHEMA = vol.Schema({vol.Required(ATTR_ENTITY_ID): cv.entity_ids,

This comment has been minimized.

@houndci-bot

houndci-bot Nov 1, 2018

line too long (85 > 79 characters)

leothlon added some commits Nov 1, 2018

vol.Required(ATTR_VIDEO_OUTPUT): vol.In(ACCEPTED_VALUES)
})
DOMAIN = 'media_player'
SERVICE_SELECT_VIDEO_OUTPUT = 'select_video_output'

This comment has been minimized.

@balloob

balloob Nov 1, 2018

Member

prefix with platform name.

vol.Required(ATTR_ENTITY_ID): cv.entity_ids,
vol.Required(ATTR_VIDEO_OUTPUT): vol.In(ACCEPTED_VALUES)
})
DOMAIN = 'media_player'

This comment has been minimized.

@balloob

balloob Nov 1, 2018

Member

import domain.

@@ -55,6 +56,16 @@

TIMEOUT_MESSAGE = 'Timeout waiting for response.'

ATTR_VIDEO_OUTPUT = 'video_output'
ACCEPTED_VALUES = ['no', 'analog', 'yes', 'out',

This comment has been minimized.

@balloob

balloob Nov 1, 2018

Member

is this valid for all onkyos?

This comment has been minimized.

@leothlon

leothlon Nov 1, 2018

Contributor

Those are the accepted values according to the onkyo-eiscp library, not all of them would work on all recievers i dont think (for me "out" switches to main and "out-sub" switches to sub, "sub" switches to both. so its not totally clear what to use but rather trial and error, planning to update this in the docs when i get time).

The command would only work for recievers with more than one hdmi-out port ofc.

Other than that i wouldn't really know as i only got one reciever to test with. (onkyo-eiscp said the command is for Japanese models but i got a European one and it works fine).

@balloob

balloob approved these changes Nov 2, 2018

@balloob balloob merged commit 8613694 into home-assistant:dev Nov 2, 2018

5 checks passed

Hound No violations found. Woof!
WIP ready for review
Details
cla-bot Everyone involved has signed the CLA
continuous-integration/travis-ci/pr The Travis CI build passed
Details
coverage/coveralls First build on dev at 93.064%
Details

@wafflebot wafflebot bot removed the in progress label Nov 2, 2018

@balloob

This comment has been minimized.

Member

balloob commented Nov 2, 2018

Please also open a PR for the docs repo.

@leothlon leothlon referenced this pull request Nov 2, 2018

Merged

Added doc for new onkyo_select_hdmi_output service #7334

1 of 1 task complete
@leothlon

This comment has been minimized.

Contributor

leothlon commented Nov 2, 2018

@BryanJacobs

This comment has been minimized.

Contributor

BryanJacobs commented Nov 25, 2018

This commit breaks my Home Assistant.

2018-11-26 08:05:37 ERROR (MainThread) [homeassistant.components.media_player] onkyo: Error on device update!                                                                                                     
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/homeassistant/helpers/entity_platform.py", line 251, in _async_add_entity                                                                                          
    await entity.async_device_update(warning=False)                                                                                                                                                               
  File "/usr/local/lib/python3.6/site-packages/homeassistant/helpers/entity.py", line 349, in async_device_update                                                                                                 
    await self.hass.async_add_executor_job(self.update)                                                                                                                                                           
  File "/usr/local/lib/python3.6/concurrent/futures/thread.py", line 56, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.6/site-packages/homeassistant/components/media_player/onkyo.py", line 223, in update                                                                                               
    self._attributes["video_out"] = ','.join(hdmi_out_raw[1])
TypeError: 'bool' object is not subscriptable
@MartinHjelmare

This comment has been minimized.

Member

MartinHjelmare commented Nov 26, 2018

That's fixed in #18478.

Please don't comment in merged PRs. Open an issue instead.

@home-assistant home-assistant locked as resolved and limited conversation to collaborators Nov 26, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.