mirror of
https://github.com/home-assistant/core.git
synced 2026-09-24 23:41:48 -05:00
Add generic 10-key LED candle remote to LED Infrared (#178041)
This commit is contained in:
@@ -42,6 +42,14 @@ SUPPORTED_BUTTONS = {
|
||||
"quick",
|
||||
"slow",
|
||||
],
|
||||
LEDIrDeviceType.GENERIC_10_KEY: [
|
||||
"brightness_up",
|
||||
"brightness_down",
|
||||
"timer_2h",
|
||||
"timer_4h",
|
||||
"timer_6h",
|
||||
"timer_8h",
|
||||
],
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -28,8 +28,9 @@ from .const import (
|
||||
)
|
||||
|
||||
DEVICE_NAMES = {
|
||||
LEDIrDeviceType.GENERIC_24_KEY: "24-key remote",
|
||||
LEDIrDeviceType.GENERIC_10_KEY: "10-key remote",
|
||||
LEDIrDeviceType.GENERIC_13_KEY: "13-key remote",
|
||||
LEDIrDeviceType.GENERIC_24_KEY: "24-key remote",
|
||||
LEDIrDeviceType.GENERIC_40_KEY: "40-key remote",
|
||||
LEDIrDeviceType.GENERIC_44_KEY: "44-key remote",
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ CONF_DEVICE_TYPE = "device_type"
|
||||
class LEDIrDeviceType(StrEnum):
|
||||
"""LED Infrared device types."""
|
||||
|
||||
GENERIC_10_KEY = "generic_10_key"
|
||||
GENERIC_13_KEY = "generic_13_key"
|
||||
GENERIC_24_KEY = "generic_24_key"
|
||||
GENERIC_40_KEY = "generic_40_key"
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
"""Base entity for LED Infrared integration."""
|
||||
|
||||
from infrared_protocols.codes.generic.led import (
|
||||
BaseGenericLEDCode,
|
||||
Generic10KeyCode,
|
||||
Generic13KeyCode,
|
||||
Generic24KeyCode,
|
||||
Generic40KeyCode,
|
||||
@@ -13,12 +15,10 @@ from homeassistant.helpers.entity import Entity
|
||||
|
||||
from .const import DOMAIN, LEDIrDeviceType
|
||||
|
||||
CODES: dict[
|
||||
LEDIrDeviceType,
|
||||
type[Generic24KeyCode | Generic13KeyCode | Generic40KeyCode | Generic44KeyCode],
|
||||
] = {
|
||||
LEDIrDeviceType.GENERIC_24_KEY: Generic24KeyCode,
|
||||
CODES: dict[LEDIrDeviceType, type[BaseGenericLEDCode]] = {
|
||||
LEDIrDeviceType.GENERIC_10_KEY: Generic10KeyCode,
|
||||
LEDIrDeviceType.GENERIC_13_KEY: Generic13KeyCode,
|
||||
LEDIrDeviceType.GENERIC_24_KEY: Generic24KeyCode,
|
||||
LEDIrDeviceType.GENERIC_40_KEY: Generic40KeyCode,
|
||||
LEDIrDeviceType.GENERIC_44_KEY: Generic44KeyCode,
|
||||
}
|
||||
|
||||
@@ -34,6 +34,18 @@
|
||||
"timer": {
|
||||
"default": "mdi:timer"
|
||||
},
|
||||
"timer_2h": {
|
||||
"default": "mdi:timer"
|
||||
},
|
||||
"timer_4h": {
|
||||
"default": "mdi:timer"
|
||||
},
|
||||
"timer_6h": {
|
||||
"default": "mdi:timer"
|
||||
},
|
||||
"timer_8h": {
|
||||
"default": "mdi:timer"
|
||||
},
|
||||
"white_brightness_100": {
|
||||
"default": "mdi:lightbulb-on"
|
||||
},
|
||||
@@ -72,6 +84,7 @@
|
||||
"aqua": "mdi:palette",
|
||||
"auto": "mdi:auto-mode",
|
||||
"blue": "mdi:palette",
|
||||
"candle": "mdi:candle",
|
||||
"cyan": "mdi:palette",
|
||||
"dark_cyan": "mdi:palette",
|
||||
"deep_blue": "mdi:palette",
|
||||
@@ -91,6 +104,7 @@
|
||||
"jump3": "mdi:dots-circle",
|
||||
"jump7": "mdi:dots-circle",
|
||||
"lavender_blush": "mdi:palette",
|
||||
"light": "mdi:lightbulb-on",
|
||||
"light_cyan": "mdi:palette",
|
||||
"light_green": "mdi:palette",
|
||||
"magenta": "mdi:palette",
|
||||
|
||||
@@ -54,6 +54,7 @@ SUPPORTED_EFFECTS = {
|
||||
"diy5",
|
||||
"diy6",
|
||||
],
|
||||
LEDIrDeviceType.GENERIC_10_KEY: ["candle", "light"],
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -71,6 +71,18 @@
|
||||
"timer": {
|
||||
"name": "[%key:component::led_infrared::entity::event::received_command::state_attributes::event_type::state::timer%]"
|
||||
},
|
||||
"timer_2h": {
|
||||
"name": "[%key:component::led_infrared::entity::event::received_command::state_attributes::event_type::state::timer_2h%]"
|
||||
},
|
||||
"timer_4h": {
|
||||
"name": "[%key:component::led_infrared::entity::event::received_command::state_attributes::event_type::state::timer_4h%]"
|
||||
},
|
||||
"timer_6h": {
|
||||
"name": "[%key:component::led_infrared::entity::event::received_command::state_attributes::event_type::state::timer_6h%]"
|
||||
},
|
||||
"timer_8h": {
|
||||
"name": "[%key:component::led_infrared::entity::event::received_command::state_attributes::event_type::state::timer_8h%]"
|
||||
},
|
||||
"white_brightness_100": {
|
||||
"name": "[%key:component::led_infrared::entity::event::received_command::state_attributes::event_type::state::white_brightness_100%]"
|
||||
},
|
||||
@@ -109,6 +121,7 @@
|
||||
"blue_up": "Blue up",
|
||||
"brightness_down": "Brightness down",
|
||||
"brightness_up": "Brightness up",
|
||||
"candle": "[%key:component::led_infrared::entity::light::light::state_attributes::effect::state::candle%]",
|
||||
"cyan": "[%key:component::led_infrared::entity::light::light::state_attributes::effect::state::cyan%]",
|
||||
"dark_cyan": "[%key:component::led_infrared::entity::light::light::state_attributes::effect::state::dark_cyan%]",
|
||||
"deep_blue": "[%key:component::led_infrared::entity::light::light::state_attributes::effect::state::deep_blue%]",
|
||||
@@ -130,6 +143,7 @@
|
||||
"jump3": "[%key:component::led_infrared::entity::light::light::state_attributes::effect::state::jump3%]",
|
||||
"jump7": "[%key:component::led_infrared::entity::light::light::state_attributes::effect::state::jump7%]",
|
||||
"lavender_blush": "[%key:component::led_infrared::entity::light::light::state_attributes::effect::state::lavender_blush%]",
|
||||
"light": "[%key:component::led_infrared::entity::light::light::state_attributes::effect::state::light%]",
|
||||
"light_cyan": "[%key:component::led_infrared::entity::light::light::state_attributes::effect::state::light_cyan%]",
|
||||
"light_green": "[%key:component::led_infrared::entity::light::light::state_attributes::effect::state::light_green%]",
|
||||
"magenta": "[%key:component::led_infrared::entity::light::light::state_attributes::effect::state::magenta%]",
|
||||
@@ -158,6 +172,10 @@
|
||||
"smooth": "[%key:component::led_infrared::entity::light::light::state_attributes::effect::state::smooth%]",
|
||||
"strobe": "[%key:component::led_infrared::entity::light::light::state_attributes::effect::state::strobe%]",
|
||||
"timer": "Timer",
|
||||
"timer_2h": "Timer 2h",
|
||||
"timer_4h": "Timer 4h",
|
||||
"timer_6h": "Timer 6h",
|
||||
"timer_8h": "Timer 8h",
|
||||
"tomato": "[%key:component::led_infrared::entity::light::light::state_attributes::effect::state::tomato%]",
|
||||
"turquoise": "[%key:component::led_infrared::entity::light::light::state_attributes::effect::state::turquoise%]",
|
||||
"white": "[%key:component::led_infrared::entity::light::light::state_attributes::effect::state::white%]",
|
||||
@@ -184,6 +202,7 @@
|
||||
"aqua": "Color: Aqua",
|
||||
"auto": "[%key:common::state::auto%]",
|
||||
"blue": "Color: Blue",
|
||||
"candle": "Candle",
|
||||
"cyan": "Color: Cyan",
|
||||
"dark_cyan": "Color: Dark cyan",
|
||||
"deep_blue": "Color: Deep Blue",
|
||||
@@ -203,6 +222,7 @@
|
||||
"jump3": "Jump 3",
|
||||
"jump7": "Jump 7",
|
||||
"lavender_blush": "Color: Lavender Blush",
|
||||
"light": "Steady light",
|
||||
"light_cyan": "Color: Light Cyan",
|
||||
"light_green": "Color: Light green",
|
||||
"magenta": "Color: Magenta",
|
||||
@@ -238,6 +258,7 @@
|
||||
"selector": {
|
||||
"device_type": {
|
||||
"options": {
|
||||
"generic_10_key": "10-key remote control",
|
||||
"generic_13_key": "13-key remote control",
|
||||
"generic_24_key": "24-key remote control",
|
||||
"generic_40_key": "40-key remote control",
|
||||
|
||||
@@ -70,5 +70,9 @@ def mock_infrared_code_to_command() -> Generator[None]:
|
||||
"infrared_protocols.codes.generic.led.Generic44KeyCode.to_command",
|
||||
new=mock_to_command,
|
||||
),
|
||||
patch(
|
||||
"infrared_protocols.codes.generic.led.Generic10KeyCode.to_command",
|
||||
new=mock_to_command,
|
||||
),
|
||||
):
|
||||
yield
|
||||
|
||||
@@ -1,4 +1,304 @@
|
||||
# serializer version: 1
|
||||
# name: test_setup[generic_10_key][button.led_infrared_via_test_ir_emitter_brightness_down-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': list([
|
||||
None,
|
||||
]),
|
||||
'area_id': None,
|
||||
'capabilities': None,
|
||||
'config_entry_id': <ANY>,
|
||||
'config_subentry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'button',
|
||||
'entity_category': None,
|
||||
'entity_id': 'button.led_infrared_via_test_ir_emitter_brightness_down',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
'labels': set({
|
||||
}),
|
||||
'name': None,
|
||||
'object_id_base': 'Brightness down',
|
||||
'options': dict({
|
||||
}),
|
||||
'original_device_class': None,
|
||||
'original_icon': None,
|
||||
'original_name': 'Brightness down',
|
||||
'platform': 'led_infrared',
|
||||
'previous_unique_id': None,
|
||||
'suggested_object_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': 'brightness_down',
|
||||
'unique_id': '1234567890_brightness_down',
|
||||
'unit_of_measurement': None,
|
||||
})
|
||||
# ---
|
||||
# name: test_setup[generic_10_key][button.led_infrared_via_test_ir_emitter_brightness_down-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
<EntityStateAttribute.FRIENDLY_NAME: 'friendly_name'>: 'LED Infrared via Test IR emitter Brightness down',
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'button.led_infrared_via_test_ir_emitter_brightness_down',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': 'unknown',
|
||||
})
|
||||
# ---
|
||||
# name: test_setup[generic_10_key][button.led_infrared_via_test_ir_emitter_brightness_up-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': list([
|
||||
None,
|
||||
]),
|
||||
'area_id': None,
|
||||
'capabilities': None,
|
||||
'config_entry_id': <ANY>,
|
||||
'config_subentry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'button',
|
||||
'entity_category': None,
|
||||
'entity_id': 'button.led_infrared_via_test_ir_emitter_brightness_up',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
'labels': set({
|
||||
}),
|
||||
'name': None,
|
||||
'object_id_base': 'Brightness up',
|
||||
'options': dict({
|
||||
}),
|
||||
'original_device_class': None,
|
||||
'original_icon': None,
|
||||
'original_name': 'Brightness up',
|
||||
'platform': 'led_infrared',
|
||||
'previous_unique_id': None,
|
||||
'suggested_object_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': 'brightness_up',
|
||||
'unique_id': '1234567890_brightness_up',
|
||||
'unit_of_measurement': None,
|
||||
})
|
||||
# ---
|
||||
# name: test_setup[generic_10_key][button.led_infrared_via_test_ir_emitter_brightness_up-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
<EntityStateAttribute.FRIENDLY_NAME: 'friendly_name'>: 'LED Infrared via Test IR emitter Brightness up',
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'button.led_infrared_via_test_ir_emitter_brightness_up',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': 'unknown',
|
||||
})
|
||||
# ---
|
||||
# name: test_setup[generic_10_key][button.led_infrared_via_test_ir_emitter_timer_2h-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': list([
|
||||
None,
|
||||
]),
|
||||
'area_id': None,
|
||||
'capabilities': None,
|
||||
'config_entry_id': <ANY>,
|
||||
'config_subentry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'button',
|
||||
'entity_category': None,
|
||||
'entity_id': 'button.led_infrared_via_test_ir_emitter_timer_2h',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
'labels': set({
|
||||
}),
|
||||
'name': None,
|
||||
'object_id_base': 'Timer 2h',
|
||||
'options': dict({
|
||||
}),
|
||||
'original_device_class': None,
|
||||
'original_icon': None,
|
||||
'original_name': 'Timer 2h',
|
||||
'platform': 'led_infrared',
|
||||
'previous_unique_id': None,
|
||||
'suggested_object_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': 'timer_2h',
|
||||
'unique_id': '1234567890_timer_2h',
|
||||
'unit_of_measurement': None,
|
||||
})
|
||||
# ---
|
||||
# name: test_setup[generic_10_key][button.led_infrared_via_test_ir_emitter_timer_2h-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
<EntityStateAttribute.FRIENDLY_NAME: 'friendly_name'>: 'LED Infrared via Test IR emitter Timer 2h',
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'button.led_infrared_via_test_ir_emitter_timer_2h',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': 'unknown',
|
||||
})
|
||||
# ---
|
||||
# name: test_setup[generic_10_key][button.led_infrared_via_test_ir_emitter_timer_4h-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': list([
|
||||
None,
|
||||
]),
|
||||
'area_id': None,
|
||||
'capabilities': None,
|
||||
'config_entry_id': <ANY>,
|
||||
'config_subentry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'button',
|
||||
'entity_category': None,
|
||||
'entity_id': 'button.led_infrared_via_test_ir_emitter_timer_4h',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
'labels': set({
|
||||
}),
|
||||
'name': None,
|
||||
'object_id_base': 'Timer 4h',
|
||||
'options': dict({
|
||||
}),
|
||||
'original_device_class': None,
|
||||
'original_icon': None,
|
||||
'original_name': 'Timer 4h',
|
||||
'platform': 'led_infrared',
|
||||
'previous_unique_id': None,
|
||||
'suggested_object_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': 'timer_4h',
|
||||
'unique_id': '1234567890_timer_4h',
|
||||
'unit_of_measurement': None,
|
||||
})
|
||||
# ---
|
||||
# name: test_setup[generic_10_key][button.led_infrared_via_test_ir_emitter_timer_4h-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
<EntityStateAttribute.FRIENDLY_NAME: 'friendly_name'>: 'LED Infrared via Test IR emitter Timer 4h',
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'button.led_infrared_via_test_ir_emitter_timer_4h',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': 'unknown',
|
||||
})
|
||||
# ---
|
||||
# name: test_setup[generic_10_key][button.led_infrared_via_test_ir_emitter_timer_6h-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': list([
|
||||
None,
|
||||
]),
|
||||
'area_id': None,
|
||||
'capabilities': None,
|
||||
'config_entry_id': <ANY>,
|
||||
'config_subentry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'button',
|
||||
'entity_category': None,
|
||||
'entity_id': 'button.led_infrared_via_test_ir_emitter_timer_6h',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
'labels': set({
|
||||
}),
|
||||
'name': None,
|
||||
'object_id_base': 'Timer 6h',
|
||||
'options': dict({
|
||||
}),
|
||||
'original_device_class': None,
|
||||
'original_icon': None,
|
||||
'original_name': 'Timer 6h',
|
||||
'platform': 'led_infrared',
|
||||
'previous_unique_id': None,
|
||||
'suggested_object_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': 'timer_6h',
|
||||
'unique_id': '1234567890_timer_6h',
|
||||
'unit_of_measurement': None,
|
||||
})
|
||||
# ---
|
||||
# name: test_setup[generic_10_key][button.led_infrared_via_test_ir_emitter_timer_6h-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
<EntityStateAttribute.FRIENDLY_NAME: 'friendly_name'>: 'LED Infrared via Test IR emitter Timer 6h',
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'button.led_infrared_via_test_ir_emitter_timer_6h',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': 'unknown',
|
||||
})
|
||||
# ---
|
||||
# name: test_setup[generic_10_key][button.led_infrared_via_test_ir_emitter_timer_8h-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': list([
|
||||
None,
|
||||
]),
|
||||
'area_id': None,
|
||||
'capabilities': None,
|
||||
'config_entry_id': <ANY>,
|
||||
'config_subentry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'button',
|
||||
'entity_category': None,
|
||||
'entity_id': 'button.led_infrared_via_test_ir_emitter_timer_8h',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
'labels': set({
|
||||
}),
|
||||
'name': None,
|
||||
'object_id_base': 'Timer 8h',
|
||||
'options': dict({
|
||||
}),
|
||||
'original_device_class': None,
|
||||
'original_icon': None,
|
||||
'original_name': 'Timer 8h',
|
||||
'platform': 'led_infrared',
|
||||
'previous_unique_id': None,
|
||||
'suggested_object_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': 'timer_8h',
|
||||
'unique_id': '1234567890_timer_8h',
|
||||
'unit_of_measurement': None,
|
||||
})
|
||||
# ---
|
||||
# name: test_setup[generic_10_key][button.led_infrared_via_test_ir_emitter_timer_8h-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
<EntityStateAttribute.FRIENDLY_NAME: 'friendly_name'>: 'LED Infrared via Test IR emitter Timer 8h',
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'button.led_infrared_via_test_ir_emitter_timer_8h',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': 'unknown',
|
||||
})
|
||||
# ---
|
||||
# name: test_setup[generic_13_key][button.led_infrared_via_test_ir_emitter_brightness_down-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': list([
|
||||
|
||||
@@ -1,8 +1,36 @@
|
||||
# serializer version: 1
|
||||
# name: test_diagnostics
|
||||
# name: test_diagnostics[generic_10_key]
|
||||
dict({
|
||||
'device_type': 'generic_10_key',
|
||||
'infrared_entity_id': 'infrared.test_ir_emitter',
|
||||
'infrared_receiver_entity_id': 'infrared.test_ir_receiver',
|
||||
})
|
||||
# ---
|
||||
# name: test_diagnostics[generic_13_key]
|
||||
dict({
|
||||
'device_type': 'generic_13_key',
|
||||
'infrared_entity_id': 'infrared.test_ir_emitter',
|
||||
'infrared_receiver_entity_id': 'infrared.test_ir_receiver',
|
||||
})
|
||||
# ---
|
||||
# name: test_diagnostics[generic_24_key]
|
||||
dict({
|
||||
'device_type': 'generic_24_key',
|
||||
'infrared_entity_id': 'infrared.test_ir_emitter',
|
||||
'infrared_receiver_entity_id': 'infrared.test_ir_receiver',
|
||||
})
|
||||
# ---
|
||||
# name: test_diagnostics[generic_40_key]
|
||||
dict({
|
||||
'device_type': 'generic_40_key',
|
||||
'infrared_entity_id': 'infrared.test_ir_emitter',
|
||||
'infrared_receiver_entity_id': 'infrared.test_ir_receiver',
|
||||
})
|
||||
# ---
|
||||
# name: test_diagnostics[generic_44_key]
|
||||
dict({
|
||||
'device_type': 'generic_44_key',
|
||||
'infrared_entity_id': 'infrared.test_ir_emitter',
|
||||
'infrared_receiver_entity_id': 'infrared.test_ir_receiver',
|
||||
})
|
||||
# ---
|
||||
|
||||
@@ -1,4 +1,80 @@
|
||||
# serializer version: 1
|
||||
# name: test_setup[generic_10_key][event.led_infrared_via_test_ir_emitter_received_command-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': list([
|
||||
None,
|
||||
]),
|
||||
'area_id': None,
|
||||
'capabilities': dict({
|
||||
<EventEntityCapabilityAttribute.EVENT_TYPES: 'event_types'>: list([
|
||||
'on',
|
||||
'off',
|
||||
'brightness_up',
|
||||
'brightness_down',
|
||||
'timer_2h',
|
||||
'timer_4h',
|
||||
'timer_6h',
|
||||
'timer_8h',
|
||||
'candle',
|
||||
'light',
|
||||
]),
|
||||
}),
|
||||
'config_entry_id': <ANY>,
|
||||
'config_subentry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'event',
|
||||
'entity_category': None,
|
||||
'entity_id': 'event.led_infrared_via_test_ir_emitter_received_command',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
'labels': set({
|
||||
}),
|
||||
'name': None,
|
||||
'object_id_base': 'Received command',
|
||||
'options': dict({
|
||||
}),
|
||||
'original_device_class': None,
|
||||
'original_icon': None,
|
||||
'original_name': 'Received command',
|
||||
'platform': 'led_infrared',
|
||||
'previous_unique_id': None,
|
||||
'suggested_object_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': 'received_command',
|
||||
'unique_id': '1234567890',
|
||||
'unit_of_measurement': None,
|
||||
})
|
||||
# ---
|
||||
# name: test_setup[generic_10_key][event.led_infrared_via_test_ir_emitter_received_command-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
<EventEntityStateAttribute.EVENT_TYPE: 'event_type'>: None,
|
||||
<EventEntityCapabilityAttribute.EVENT_TYPES: 'event_types'>: list([
|
||||
'on',
|
||||
'off',
|
||||
'brightness_up',
|
||||
'brightness_down',
|
||||
'timer_2h',
|
||||
'timer_4h',
|
||||
'timer_6h',
|
||||
'timer_8h',
|
||||
'candle',
|
||||
'light',
|
||||
]),
|
||||
<EntityStateAttribute.FRIENDLY_NAME: 'friendly_name'>: 'LED Infrared via Test IR emitter Received command',
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'event.led_infrared_via_test_ir_emitter_received_command',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': 'unknown',
|
||||
})
|
||||
# ---
|
||||
# name: test_setup[generic_13_key][event.led_infrared_via_test_ir_emitter_received_command-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': list([
|
||||
|
||||
@@ -1,4 +1,73 @@
|
||||
# serializer version: 1
|
||||
# name: test_setup[generic_10_key][light.led_infrared_via_test_ir_emitter-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': list([
|
||||
None,
|
||||
]),
|
||||
'area_id': None,
|
||||
'capabilities': dict({
|
||||
<LightEntityCapabilityAttribute.EFFECT_LIST: 'effect_list'>: list([
|
||||
'candle',
|
||||
'light',
|
||||
]),
|
||||
<LightEntityCapabilityAttribute.SUPPORTED_COLOR_MODES: 'supported_color_modes'>: list([
|
||||
<ColorMode.ONOFF: 'onoff'>,
|
||||
]),
|
||||
}),
|
||||
'config_entry_id': <ANY>,
|
||||
'config_subentry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'light',
|
||||
'entity_category': None,
|
||||
'entity_id': 'light.led_infrared_via_test_ir_emitter',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
'labels': set({
|
||||
}),
|
||||
'name': None,
|
||||
'object_id_base': None,
|
||||
'options': dict({
|
||||
}),
|
||||
'original_device_class': None,
|
||||
'original_icon': None,
|
||||
'original_name': None,
|
||||
'platform': 'led_infrared',
|
||||
'previous_unique_id': None,
|
||||
'suggested_object_id': None,
|
||||
'supported_features': <LightEntityFeature: 4>,
|
||||
'translation_key': 'light',
|
||||
'unique_id': '1234567890',
|
||||
'unit_of_measurement': None,
|
||||
})
|
||||
# ---
|
||||
# name: test_setup[generic_10_key][light.led_infrared_via_test_ir_emitter-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
<EntityStateAttribute.ASSUMED_STATE: 'assumed_state'>: True,
|
||||
<LightEntityStateAttribute.COLOR_MODE: 'color_mode'>: None,
|
||||
<LightEntityStateAttribute.EFFECT: 'effect'>: None,
|
||||
<LightEntityCapabilityAttribute.EFFECT_LIST: 'effect_list'>: list([
|
||||
'candle',
|
||||
'light',
|
||||
]),
|
||||
<EntityStateAttribute.FRIENDLY_NAME: 'friendly_name'>: 'LED Infrared via Test IR emitter',
|
||||
<LightEntityCapabilityAttribute.SUPPORTED_COLOR_MODES: 'supported_color_modes'>: list([
|
||||
<ColorMode.ONOFF: 'onoff'>,
|
||||
]),
|
||||
<EntityStateAttribute.SUPPORTED_FEATURES: 'supported_features'>: <LightEntityFeature: 4>,
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'light.led_infrared_via_test_ir_emitter',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': 'unknown',
|
||||
})
|
||||
# ---
|
||||
# name: test_setup[generic_13_key][light.led_infrared_via_test_ir_emitter-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': list([
|
||||
|
||||
@@ -4,6 +4,8 @@ from collections.abc import Generator
|
||||
from unittest.mock import patch
|
||||
|
||||
from infrared_protocols.codes.generic.led import (
|
||||
BaseGenericLEDCode,
|
||||
Generic10KeyCode,
|
||||
Generic13KeyCode,
|
||||
Generic24KeyCode,
|
||||
Generic40KeyCode,
|
||||
@@ -42,6 +44,7 @@ def button_only() -> Generator[None]:
|
||||
@pytest.mark.parametrize(
|
||||
"config_entry",
|
||||
[
|
||||
LEDIrDeviceType.GENERIC_10_KEY,
|
||||
LEDIrDeviceType.GENERIC_13_KEY,
|
||||
LEDIrDeviceType.GENERIC_24_KEY,
|
||||
LEDIrDeviceType.GENERIC_40_KEY,
|
||||
@@ -205,6 +208,36 @@ async def test_setup(
|
||||
"slow",
|
||||
[Generic44KeyCode.SLOW],
|
||||
),
|
||||
(
|
||||
LEDIrDeviceType.GENERIC_10_KEY,
|
||||
"brightness_up",
|
||||
[Generic10KeyCode.BRIGHTNESS_UP],
|
||||
),
|
||||
(
|
||||
LEDIrDeviceType.GENERIC_10_KEY,
|
||||
"brightness_down",
|
||||
[Generic10KeyCode.BRIGHTNESS_DOWN],
|
||||
),
|
||||
(
|
||||
LEDIrDeviceType.GENERIC_10_KEY,
|
||||
"timer_2h",
|
||||
[Generic10KeyCode.TIMER_2H],
|
||||
),
|
||||
(
|
||||
LEDIrDeviceType.GENERIC_10_KEY,
|
||||
"timer_4h",
|
||||
[Generic10KeyCode.TIMER_4H],
|
||||
),
|
||||
(
|
||||
LEDIrDeviceType.GENERIC_10_KEY,
|
||||
"timer_6h",
|
||||
[Generic10KeyCode.TIMER_6H],
|
||||
),
|
||||
(
|
||||
LEDIrDeviceType.GENERIC_10_KEY,
|
||||
"timer_8h",
|
||||
[Generic10KeyCode.TIMER_8H],
|
||||
),
|
||||
],
|
||||
)
|
||||
@pytest.mark.usefixtures("infrared_codes")
|
||||
@@ -214,9 +247,7 @@ async def test_button_press(
|
||||
entity_registry: er.EntityRegistry,
|
||||
device_type: LEDIrDeviceType,
|
||||
key: str,
|
||||
expected_codes: list[
|
||||
Generic24KeyCode | Generic13KeyCode | Generic40KeyCode | Generic44KeyCode
|
||||
],
|
||||
expected_codes: list[BaseGenericLEDCode],
|
||||
) -> None:
|
||||
"""Test button press action."""
|
||||
config_entry = MockConfigEntry(
|
||||
|
||||
@@ -22,6 +22,7 @@ from tests.components.infrared import EMITTER_ENTITY_ID, RECEIVER_ENTITY_ID
|
||||
@pytest.mark.parametrize(
|
||||
("device_type", "device_name"),
|
||||
[
|
||||
(LEDIrDeviceType.GENERIC_10_KEY, "10-key remote"),
|
||||
(LEDIrDeviceType.GENERIC_13_KEY, "13-key remote"),
|
||||
(LEDIrDeviceType.GENERIC_24_KEY, "24-key remote"),
|
||||
(LEDIrDeviceType.GENERIC_40_KEY, "40-key remote"),
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
"""Test for diagnostics platform of the LED Infrared integration."""
|
||||
|
||||
import pytest
|
||||
from syrupy.assertion import SnapshotAssertion
|
||||
|
||||
from homeassistant.components.led_infrared.const import LEDIrDeviceType
|
||||
from homeassistant.config_entries import ConfigEntryState
|
||||
from homeassistant.core import HomeAssistant
|
||||
|
||||
@@ -10,6 +12,17 @@ from tests.components.diagnostics import get_diagnostics_for_config_entry
|
||||
from tests.typing import ClientSessionGenerator
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"config_entry",
|
||||
[
|
||||
LEDIrDeviceType.GENERIC_10_KEY,
|
||||
LEDIrDeviceType.GENERIC_13_KEY,
|
||||
LEDIrDeviceType.GENERIC_24_KEY,
|
||||
LEDIrDeviceType.GENERIC_40_KEY,
|
||||
LEDIrDeviceType.GENERIC_44_KEY,
|
||||
],
|
||||
indirect=True,
|
||||
)
|
||||
async def test_diagnostics(
|
||||
hass: HomeAssistant,
|
||||
hass_client: ClientSessionGenerator,
|
||||
|
||||
@@ -4,6 +4,8 @@ from collections.abc import Generator
|
||||
from unittest.mock import patch
|
||||
|
||||
from infrared_protocols.codes.generic.led import (
|
||||
BaseGenericLEDCode,
|
||||
Generic10KeyCode,
|
||||
Generic13KeyCode,
|
||||
Generic24KeyCode,
|
||||
Generic40KeyCode,
|
||||
@@ -46,6 +48,7 @@ def event_only() -> Generator[None]:
|
||||
@pytest.mark.parametrize(
|
||||
"config_entry",
|
||||
[
|
||||
LEDIrDeviceType.GENERIC_10_KEY,
|
||||
LEDIrDeviceType.GENERIC_13_KEY,
|
||||
LEDIrDeviceType.GENERIC_24_KEY,
|
||||
LEDIrDeviceType.GENERIC_40_KEY,
|
||||
@@ -360,6 +363,46 @@ async def test_setup(
|
||||
"on",
|
||||
"light_cyan",
|
||||
),
|
||||
(LEDIrDeviceType.GENERIC_10_KEY, Generic10KeyCode.ON, "on", None),
|
||||
(LEDIrDeviceType.GENERIC_10_KEY, Generic10KeyCode.OFF, "off", None),
|
||||
(LEDIrDeviceType.GENERIC_10_KEY, Generic10KeyCode.CANDLE, "on", "candle"),
|
||||
(LEDIrDeviceType.GENERIC_10_KEY, Generic10KeyCode.LIGHT, "on", "light"),
|
||||
(
|
||||
LEDIrDeviceType.GENERIC_10_KEY,
|
||||
Generic10KeyCode.BRIGHTNESS_UP,
|
||||
STATE_UNKNOWN,
|
||||
None,
|
||||
),
|
||||
(
|
||||
LEDIrDeviceType.GENERIC_10_KEY,
|
||||
Generic10KeyCode.BRIGHTNESS_DOWN,
|
||||
STATE_UNKNOWN,
|
||||
None,
|
||||
),
|
||||
(
|
||||
LEDIrDeviceType.GENERIC_10_KEY,
|
||||
Generic10KeyCode.TIMER_2H,
|
||||
STATE_UNKNOWN,
|
||||
None,
|
||||
),
|
||||
(
|
||||
LEDIrDeviceType.GENERIC_10_KEY,
|
||||
Generic10KeyCode.TIMER_4H,
|
||||
STATE_UNKNOWN,
|
||||
None,
|
||||
),
|
||||
(
|
||||
LEDIrDeviceType.GENERIC_10_KEY,
|
||||
Generic10KeyCode.TIMER_6H,
|
||||
STATE_UNKNOWN,
|
||||
None,
|
||||
),
|
||||
(
|
||||
LEDIrDeviceType.GENERIC_10_KEY,
|
||||
Generic10KeyCode.TIMER_8H,
|
||||
STATE_UNKNOWN,
|
||||
None,
|
||||
),
|
||||
],
|
||||
)
|
||||
@pytest.mark.usefixtures(
|
||||
@@ -370,10 +413,7 @@ async def test_event(
|
||||
hass: HomeAssistant,
|
||||
mock_infrared_receiver_entity: MockInfraredReceiverEntity,
|
||||
device_type: LEDIrDeviceType,
|
||||
command_code: Generic13KeyCode
|
||||
| Generic24KeyCode
|
||||
| Generic40KeyCode
|
||||
| Generic44KeyCode,
|
||||
command_code: BaseGenericLEDCode,
|
||||
expected_light_state: str,
|
||||
expected_light_effect: str | None,
|
||||
) -> None:
|
||||
|
||||
@@ -4,6 +4,8 @@ from collections.abc import Generator
|
||||
from unittest.mock import patch
|
||||
|
||||
from infrared_protocols.codes.generic.led import (
|
||||
BaseGenericLEDCode,
|
||||
Generic10KeyCode,
|
||||
Generic13KeyCode,
|
||||
Generic24KeyCode,
|
||||
Generic40KeyCode,
|
||||
@@ -47,6 +49,7 @@ def light_only() -> Generator[None]:
|
||||
@pytest.mark.parametrize(
|
||||
"config_entry",
|
||||
[
|
||||
LEDIrDeviceType.GENERIC_10_KEY,
|
||||
LEDIrDeviceType.GENERIC_13_KEY,
|
||||
LEDIrDeviceType.GENERIC_24_KEY,
|
||||
LEDIrDeviceType.GENERIC_40_KEY,
|
||||
@@ -609,6 +612,30 @@ async def test_setup(
|
||||
{ATTR_EFFECT: "light_cyan"},
|
||||
[Generic44KeyCode.ON, Generic44KeyCode.LIGHT_CYAN],
|
||||
),
|
||||
(
|
||||
LEDIrDeviceType.GENERIC_10_KEY,
|
||||
SERVICE_TURN_ON,
|
||||
{},
|
||||
[Generic10KeyCode.ON],
|
||||
),
|
||||
(
|
||||
LEDIrDeviceType.GENERIC_10_KEY,
|
||||
SERVICE_TURN_OFF,
|
||||
{},
|
||||
[Generic10KeyCode.OFF],
|
||||
),
|
||||
(
|
||||
LEDIrDeviceType.GENERIC_10_KEY,
|
||||
SERVICE_TURN_ON,
|
||||
{ATTR_EFFECT: "candle"},
|
||||
[Generic10KeyCode.ON, Generic10KeyCode.CANDLE],
|
||||
),
|
||||
(
|
||||
LEDIrDeviceType.GENERIC_10_KEY,
|
||||
SERVICE_TURN_ON,
|
||||
{ATTR_EFFECT: "light"},
|
||||
[Generic10KeyCode.ON, Generic10KeyCode.LIGHT],
|
||||
),
|
||||
],
|
||||
)
|
||||
@pytest.mark.usefixtures("infrared_codes")
|
||||
@@ -618,9 +645,7 @@ async def test_light_actions(
|
||||
device_type: LEDIrDeviceType,
|
||||
service: str,
|
||||
service_data: dict[str, str],
|
||||
expected_codes: list[
|
||||
Generic13KeyCode | Generic24KeyCode | Generic40KeyCode | Generic44KeyCode
|
||||
],
|
||||
expected_codes: list[BaseGenericLEDCode],
|
||||
) -> None:
|
||||
"""Test light actions."""
|
||||
config_entry = MockConfigEntry(
|
||||
|
||||
Reference in New Issue
Block a user