1
0
mirror of https://github.com/home-assistant/core.git synced 2026-05-08 09:38:58 +01:00

Remove lirc integration (#155457)

This commit is contained in:
Robert Resch
2025-10-30 12:57:12 +01:00
committed by GitHub
parent 03a1ffc59b
commit cee5f4e275
9 changed files with 0 additions and 149 deletions
-94
View File
@@ -1,94 +0,0 @@
"""Support for LIRC devices."""
import logging
import threading
import time
import lirc
from homeassistant.const import EVENT_HOMEASSISTANT_START, EVENT_HOMEASSISTANT_STOP
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
_LOGGER = logging.getLogger(__name__)
BUTTON_NAME = "button_name"
DOMAIN = "lirc"
EVENT_IR_COMMAND_RECEIVED = "ir_command_received"
ICON = "mdi:remote"
CONFIG_SCHEMA = cv.empty_config_schema(DOMAIN)
def setup(hass: HomeAssistant, config: ConfigType) -> bool:
"""Set up the LIRC capability."""
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": "LIRC",
},
)
# blocking=True gives unexpected behavior (multiple responses for 1 press)
# also by not blocking, we allow hass to shut down the thread gracefully
# on exit.
lirc.init("home-assistant", blocking=False)
lirc_interface = LircInterface(hass)
def _start_lirc(_event):
lirc_interface.start()
def _stop_lirc(_event):
lirc_interface.stopped.set()
hass.bus.listen_once(EVENT_HOMEASSISTANT_START, _start_lirc)
hass.bus.listen_once(EVENT_HOMEASSISTANT_STOP, _stop_lirc)
return True
class LircInterface(threading.Thread):
"""Interfaces with the lirc daemon to read IR commands.
When using lirc in blocking mode, sometimes repeated commands get produced
in the next read of a command so we use a thread here to just wait
around until a non-empty response is obtained from lirc.
"""
def __init__(self, hass):
"""Construct a LIRC interface object."""
threading.Thread.__init__(self)
self.daemon = True
self.stopped = threading.Event()
self.hass = hass
def run(self):
"""Run the loop of the LIRC interface thread."""
_LOGGER.debug("LIRC interface thread started")
while not self.stopped.is_set():
try:
code = lirc.nextcode() # list; empty if no buttons pressed
except lirc.NextCodeError:
_LOGGER.warning("Error reading next code from LIRC")
code = None
# interpret result from python-lirc
if code:
code = code[0]
_LOGGER.debug("Got new LIRC code %s", code)
self.hass.bus.fire(EVENT_IR_COMMAND_RECEIVED, {BUTTON_NAME: code})
else:
time.sleep(0.2)
lirc.deinit()
_LOGGER.debug("LIRC interface thread stopped")
@@ -1,10 +0,0 @@
{
"domain": "lirc",
"name": "LIRC",
"codeowners": [],
"documentation": "https://www.home-assistant.io/integrations/lirc",
"iot_class": "local_push",
"loggers": ["lirc"],
"quality_scale": "legacy",
"requirements": ["python-lirc==1.2.3"]
}
@@ -3575,12 +3575,6 @@
"integration_type": "virtual",
"supported_by": "motion_blinds"
},
"lirc": {
"name": "LIRC",
"integration_type": "hub",
"config_flow": false,
"iot_class": "local_push"
},
"litejet": {
"name": "LiteJet",
"integration_type": "hub",
-3
View File
@@ -2487,9 +2487,6 @@ python-kasa[speedups]==0.10.2
# homeassistant.components.linkplay
python-linkplay==0.2.12
# homeassistant.components.lirc
# python-lirc==1.2.3
# homeassistant.components.matter
python-matter-server==8.1.0
-3
View File
@@ -2056,9 +2056,6 @@ python-kasa[speedups]==0.10.2
# homeassistant.components.linkplay
python-linkplay==0.2.12
# homeassistant.components.lirc
# python-lirc==1.2.3
# homeassistant.components.matter
python-matter-server==8.1.0
-1
View File
@@ -27,7 +27,6 @@ EXCLUDED_REQUIREMENTS_ALL = {
"bluepy",
"evdev",
"pybluez",
"python-lirc",
}
# Requirements excluded by EXCLUDED_REQUIREMENTS_ALL which should be included when
-2
View File
@@ -571,7 +571,6 @@ INTEGRATIONS_WITHOUT_QUALITY_SCALE_FILE = [
"linksys_smart",
"linode",
"linux_battery",
"lirc",
"litejet",
"livisi",
"llamalab_automate",
@@ -1594,7 +1593,6 @@ INTEGRATIONS_WITHOUT_SCALE = [
"linksys_smart",
"linode",
"linux_battery",
"lirc",
"litejet",
"livisi",
"llamalab_automate",
-1
View File
@@ -1 +0,0 @@
"""LIRC tests."""
-29
View File
@@ -1,29 +0,0 @@
"""Tests for the LIRC."""
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", lirc=Mock())
async def test_repair_issue_is_created(
hass: HomeAssistant,
issue_registry: ir.IssueRegistry,
) -> None:
"""Test repair issue is created."""
from homeassistant.components.lirc 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