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 Kodi keypress event #93321
Add Kodi keypress event #93321
Conversation
Hey there @OnFreund, @cgtobi, mind taking a look at this pull request as it has been labeled with an integration ( Code owner commandsCode owners of
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the event kodi_keypress
is a good idea, but I'm not sure it's suitable for a device trigger because the device trigger needs to be combined with manual YAML configuration for a useable trigger.
Other integrations which map keypresses to device triggers typically know which keypresses to expect and can thus expose a device trigger for each key.
@emontnemery in this case I don't think there is a way to know which keys are overwritten from the KODI API. |
@starkillerOG yes, I would suggest to merge only the event for now 👍 |
@emontnemery I have removed the device trigger and only the event is now left in this PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks @starkillerOG 👍
Breaking change
Proposed change
Add event for Kodi keypresses which can be configured in the kodi keymap XML or using the Kodi GUI with the Keymap Editor add-on
A example of the Kodi keymap configuration using xml which will overwrite the volume_up/volume_down buttons and instead send notifications to HomeAssistant which will fire the event that can be used in automations to control the volume of for example a AV receiver:
The
"KodiLivingroom"
can be set to any value and will be present in the event data as the"sender"
The
"OnKeyPress"
is needed to identify the event in HomeAssistant, do not change this.The
{"key":"volume_up"}
can contain any json which will be present in the event data under the"data"
key, normally this is used to identitfy which key was pressed.For possible keyboard key names see: https://kodi.wiki/view/List_of_keynames
For other actions see: https://kodi.wiki/view/Keymap#Keynames
For the example abbove, when the volume up key is pressed, a event in Home Assistant will be fired that looks like:
A example of a automation to turn up/down the volume of a receiver:
Type of change
Additional information
Checklist
black --fast homeassistant tests
)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest
.requirements_all.txt
.Updated by running
python3 -m script.gen_requirements_all
..coveragerc
.To help with the load of incoming pull requests: