mirror of
https://github.com/home-assistant/core.git
synced 2026-05-08 17:49:37 +01:00
Remove keyboard integration (#155456)
This commit is contained in:
@@ -1,87 +0,0 @@
|
||||
"""Support to emulate keyboard presses on host machine."""
|
||||
|
||||
from pykeyboard import PyKeyboard
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.const import (
|
||||
SERVICE_MEDIA_NEXT_TRACK,
|
||||
SERVICE_MEDIA_PLAY_PAUSE,
|
||||
SERVICE_MEDIA_PREVIOUS_TRACK,
|
||||
SERVICE_VOLUME_DOWN,
|
||||
SERVICE_VOLUME_MUTE,
|
||||
SERVICE_VOLUME_UP,
|
||||
)
|
||||
from homeassistant.core import DOMAIN as HOMEASSISTANT_DOMAIN, HomeAssistant
|
||||
from homeassistant.helpers import config_validation as cv
|
||||
from homeassistant.helpers.issue_registry import IssueSeverity, create_issue
|
||||
from homeassistant.helpers.typing import ConfigType
|
||||
|
||||
DOMAIN = "keyboard"
|
||||
|
||||
TAP_KEY_SCHEMA = vol.Schema({})
|
||||
|
||||
CONFIG_SCHEMA = cv.empty_config_schema(DOMAIN)
|
||||
|
||||
|
||||
def setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
||||
"""Listen for keyboard events."""
|
||||
create_issue(
|
||||
hass,
|
||||
HOMEASSISTANT_DOMAIN,
|
||||
f"deprecated_system_packages_yaml_integration_{DOMAIN}",
|
||||
breaks_in_ha_version="2025.12.0",
|
||||
is_fixable=False,
|
||||
issue_domain=DOMAIN,
|
||||
severity=IssueSeverity.WARNING,
|
||||
translation_key="deprecated_system_packages_yaml_integration",
|
||||
translation_placeholders={
|
||||
"domain": DOMAIN,
|
||||
"integration_title": "Keyboard",
|
||||
},
|
||||
)
|
||||
|
||||
keyboard = PyKeyboard()
|
||||
keyboard.special_key_assignment()
|
||||
|
||||
hass.services.register(
|
||||
DOMAIN,
|
||||
SERVICE_VOLUME_UP,
|
||||
lambda service: keyboard.tap_key(keyboard.volume_up_key),
|
||||
schema=TAP_KEY_SCHEMA,
|
||||
)
|
||||
|
||||
hass.services.register(
|
||||
DOMAIN,
|
||||
SERVICE_VOLUME_DOWN,
|
||||
lambda service: keyboard.tap_key(keyboard.volume_down_key),
|
||||
schema=TAP_KEY_SCHEMA,
|
||||
)
|
||||
|
||||
hass.services.register(
|
||||
DOMAIN,
|
||||
SERVICE_VOLUME_MUTE,
|
||||
lambda service: keyboard.tap_key(keyboard.volume_mute_key),
|
||||
schema=TAP_KEY_SCHEMA,
|
||||
)
|
||||
|
||||
hass.services.register(
|
||||
DOMAIN,
|
||||
SERVICE_MEDIA_PLAY_PAUSE,
|
||||
lambda service: keyboard.tap_key(keyboard.media_play_pause_key),
|
||||
schema=TAP_KEY_SCHEMA,
|
||||
)
|
||||
|
||||
hass.services.register(
|
||||
DOMAIN,
|
||||
SERVICE_MEDIA_NEXT_TRACK,
|
||||
lambda service: keyboard.tap_key(keyboard.media_next_track_key),
|
||||
schema=TAP_KEY_SCHEMA,
|
||||
)
|
||||
|
||||
hass.services.register(
|
||||
DOMAIN,
|
||||
SERVICE_MEDIA_PREVIOUS_TRACK,
|
||||
lambda service: keyboard.tap_key(keyboard.media_prev_track_key),
|
||||
schema=TAP_KEY_SCHEMA,
|
||||
)
|
||||
return True
|
||||
@@ -1,22 +0,0 @@
|
||||
{
|
||||
"services": {
|
||||
"media_next_track": {
|
||||
"service": "mdi:skip-next"
|
||||
},
|
||||
"media_play_pause": {
|
||||
"service": "mdi:play-pause"
|
||||
},
|
||||
"media_prev_track": {
|
||||
"service": "mdi:skip-previous"
|
||||
},
|
||||
"volume_down": {
|
||||
"service": "mdi:volume-low"
|
||||
},
|
||||
"volume_mute": {
|
||||
"service": "mdi:volume-off"
|
||||
},
|
||||
"volume_up": {
|
||||
"service": "mdi:volume-high"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
{
|
||||
"domain": "keyboard",
|
||||
"name": "Keyboard",
|
||||
"codeowners": [],
|
||||
"documentation": "https://www.home-assistant.io/integrations/keyboard",
|
||||
"iot_class": "local_push",
|
||||
"loggers": ["pykeyboard"],
|
||||
"quality_scale": "legacy",
|
||||
"requirements": ["pyuserinput==0.1.11"]
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
volume_up:
|
||||
volume_down:
|
||||
volume_mute:
|
||||
media_play_pause:
|
||||
media_next_track:
|
||||
media_prev_track:
|
||||
@@ -1,28 +0,0 @@
|
||||
{
|
||||
"services": {
|
||||
"media_next_track": {
|
||||
"description": "Simulates a key press of the \"Media Next Track\" button on Home Assistant's host machine.",
|
||||
"name": "Media next track"
|
||||
},
|
||||
"media_play_pause": {
|
||||
"description": "Simulates a key press of the \"Media Play/Pause\" button on Home Assistant's host machine.",
|
||||
"name": "Media play/pause"
|
||||
},
|
||||
"media_prev_track": {
|
||||
"description": "Simulates a key press of the \"Media Previous Track\" button on Home Assistant's host machine.",
|
||||
"name": "Media previous track"
|
||||
},
|
||||
"volume_down": {
|
||||
"description": "Simulates a key press of the \"Volume Down\" button on Home Assistant's host machine.",
|
||||
"name": "Volume down"
|
||||
},
|
||||
"volume_mute": {
|
||||
"description": "Simulates a key press of the \"Volume Mute\" button on Home Assistant's host machine.",
|
||||
"name": "Volume mute"
|
||||
},
|
||||
"volume_up": {
|
||||
"description": "Simulates a key press of the \"Volume Up\" button on Home Assistant's host machine.",
|
||||
"name": "Volume up"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3261,12 +3261,6 @@
|
||||
"integration_type": "virtual",
|
||||
"supported_by": "opower"
|
||||
},
|
||||
"keyboard": {
|
||||
"name": "Keyboard",
|
||||
"integration_type": "hub",
|
||||
"config_flow": false,
|
||||
"iot_class": "local_push"
|
||||
},
|
||||
"keyboard_remote": {
|
||||
"name": "Keyboard Remote",
|
||||
"integration_type": "hub",
|
||||
|
||||
Generated
-3
@@ -2594,9 +2594,6 @@ pytrydan==0.8.0
|
||||
# homeassistant.components.uptimerobot
|
||||
pyuptimerobot==22.2.0
|
||||
|
||||
# homeassistant.components.keyboard
|
||||
# pyuserinput==0.1.11
|
||||
|
||||
# homeassistant.components.vera
|
||||
pyvera==0.3.16
|
||||
|
||||
|
||||
Generated
-3
@@ -2151,9 +2151,6 @@ pytrydan==0.8.0
|
||||
# homeassistant.components.uptimerobot
|
||||
pyuptimerobot==22.2.0
|
||||
|
||||
# homeassistant.components.keyboard
|
||||
# pyuserinput==0.1.11
|
||||
|
||||
# homeassistant.components.vera
|
||||
pyvera==0.3.16
|
||||
|
||||
|
||||
@@ -28,14 +28,12 @@ EXCLUDED_REQUIREMENTS_ALL = {
|
||||
"evdev",
|
||||
"pybluez",
|
||||
"python-lirc",
|
||||
"pyuserinput",
|
||||
}
|
||||
|
||||
# Requirements excluded by EXCLUDED_REQUIREMENTS_ALL which should be included when
|
||||
# building integration wheels for all architectures.
|
||||
INCLUDED_REQUIREMENTS_WHEELS = {
|
||||
"evdev",
|
||||
"pyuserinput",
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
"""Keyboard tests."""
|
||||
@@ -1,27 +0,0 @@
|
||||
"""Keyboard tests."""
|
||||
|
||||
from unittest.mock import Mock, patch
|
||||
|
||||
from homeassistant.core import DOMAIN as HOMEASSISTANT_DOMAIN, HomeAssistant
|
||||
from homeassistant.helpers import issue_registry as ir
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
||||
|
||||
@patch.dict("sys.modules", pykeyboard=Mock())
|
||||
async def test_repair_issue_is_created(
|
||||
hass: HomeAssistant,
|
||||
issue_registry: ir.IssueRegistry,
|
||||
) -> None:
|
||||
"""Test repair issue is created."""
|
||||
from homeassistant.components.keyboard import DOMAIN # noqa: PLC0415
|
||||
|
||||
assert await async_setup_component(
|
||||
hass,
|
||||
DOMAIN,
|
||||
{DOMAIN: {}},
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
assert (
|
||||
HOMEASSISTANT_DOMAIN,
|
||||
f"deprecated_system_packages_yaml_integration_{DOMAIN}",
|
||||
) in issue_registry.issues
|
||||
Reference in New Issue
Block a user