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

Allow using more than one keyboard remote #11061

Merged
merged 3 commits into from
Dec 14, 2017

Conversation

BryanJacobs
Copy link
Contributor

Description:

This sets up one thread per keyboard remote, listening for events.

Various "air mouse" devices expose more than one evdev device. To use buttons that manifest as keyboard keys and buttons that manifest as multimedia keys on the same instance of home-assistant, it's necessary to set up more than one event listener.

Example entry for configuration.yaml (if applicable):

keyboard_remote:
   devices:
     - device_name: somename
     - device_name: someothername

Checklist:

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

  • Documentation added/updated in home-assistant.github.io

    Documentation has not been updated, but this change is backwards compatible. It's safe to merge the code change first.
    

If the code does not interact with devices:

  • [ X ] Local tests with tox run successfully. Your PR cannot be merged unless tests pass
  • Tests have been added to verify that the new code works.
    No tests have been added, as this component appears to be untested already.

This sets up one thread per keyboard remote, listening for events.
@homeassistant
Copy link
Contributor

Hi @BryanJacobs,

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!

@@ -40,7 +41,15 @@
vol.Exclusive(DEVICE_DESCRIPTOR, DEVICE_ID_GROUP): cv.string,
vol.Exclusive(DEVICE_NAME, DEVICE_ID_GROUP): cv.string,
vol.Optional(TYPE, default='key_up'):
vol.All(cv.string, vol.Any('key_up', 'key_down', 'key_hold')),
vol.All(cv.string, vol.Any('key_up', 'key_down', 'key_hold')),
vol.Exclusive(DEVICES, DEVICE_ID_GROUP): vol.All(cv.ensure_list, [
Copy link
Member

Choose a reason for hiding this comment

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

Instead of adding ensure_list here, you can just wrap the whole DOMAIN config as an ensure list. No need to specify the schema twice.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have done so. Be aware this means you can never backwards-compatibly add module-level (not keyboard-level) configuration options in the future.

Copy link
Member

@balloob balloob left a comment

Choose a reason for hiding this comment

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

Instead of adding a new devices key, just wrap the whole config in an ensure list, that way you are backwards compatible and support multiple keyboards.

}),
DOMAIN:
vol.All(cv.ensure_list, [
vol.Exclusive(DEVICE_DESCRIPTOR, DEVICE_ID_GROUP): cv.string,

Choose a reason for hiding this comment

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

SyntaxError: invalid syntax

not config.get(DEVICE_NAME):
_LOGGER.error("No device_descriptor or device_name found")
not config.get(DEVICE_NAME) and\
not config.get(DEVICES):

Choose a reason for hiding this comment

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

undefined name 'DEVICES'

@balloob balloob merged commit 3473ef6 into home-assistant:dev Dec 14, 2017
akatrevorjay added a commit to akatrevorjay/home-assistant that referenced this pull request Dec 15, 2017
…into dev

* 'dev' of https://github.com/home-assistant/home-assistant:
  Disable html5 notify dependency (home-assistant#11135)
  ISY994 sensor improvements (home-assistant#10805)
  Allow using more than one keyboard remote (home-assistant#11061)
  set default utc offset to 0 (home-assistant#11114)
  Add problem device class (home-assistant#11130)
  Always consume the no_throttle keyword argument. (home-assistant#11126)
  Skip HASS emulated Hue bridges from detection. (home-assistant#11128)
  update pyripple (home-assistant#11122)
  Add media position properties (home-assistant#10076)
  Fixed typo in automation.py (home-assistant#11116)
@fabaff fabaff mentioned this pull request Dec 16, 2017
@home-assistant home-assistant locked and limited conversation to collaborators Mar 30, 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.

5 participants