1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 21:06:19 +00:00

Add support for learning new commands (#23888)

* Add support for learning new commands

This update creates a generic service in the 'remote' component to enable remote control platforms to learn new commands.

* Update __init__.py with the proposed changes

- Add 'supported_features' property and a constant related to the 'learn_command' functionality.
- Redefine 'async_learn_command' function as a coroutine.

* Update __init__.py

* Fix assertion error

Adding the 'supported_features' attribute generated an assertion error on the 'Demo Remote' platform. This update fixes this.

* Fix duplicated 'hass' object

This update fixes a typo that occurred at the last update.
This commit is contained in:
Felipe Martins Diel
2019-06-05 06:32:59 -03:00
committed by Pascal Vizeli
parent 408ae44bdd
commit 0ed9e185b2
5 changed files with 116 additions and 16 deletions

View File

@@ -48,5 +48,8 @@ class TestDemoRemote(unittest.TestCase):
common.send_command(self.hass, 'test', entity_id=ENTITY_ID)
self.hass.block_till_done()
state = self.hass.states.get(ENTITY_ID)
assert state.attributes == \
{'friendly_name': 'Remote One', 'last_command_sent': 'test'}
assert state.attributes == {
'friendly_name': 'Remote One',
'last_command_sent': 'test',
'supported_features': 0
}