Add HDFury CEC switches (#161391)

This commit is contained in:
Glenn de Haan
2026-01-27 19:13:43 +01:00
committed by GitHub
parent 3e21ac02fc
commit 1022f422c8
6 changed files with 252 additions and 0 deletions

View File

@@ -64,6 +64,18 @@
"autosw": {
"default": "mdi:import"
},
"cec0en": {
"default": "mdi:remote-tv"
},
"cec1en": {
"default": "mdi:remote-tv"
},
"cec2en": {
"default": "mdi:remote-tv"
},
"cec3en": {
"default": "mdi:remote-tv"
},
"htpcmode0": {
"default": "mdi:desktop-classic"
},

View File

@@ -121,6 +121,18 @@
"autosw": {
"name": "Auto switch inputs"
},
"cec0en": {
"name": "CEC RX0"
},
"cec1en": {
"name": "CEC RX1"
},
"cec2en": {
"name": "CEC RX2"
},
"cec3en": {
"name": "CEC RX3"
},
"htpcmode0": {
"name": "HTPC mode RX0"
},

View File

@@ -33,6 +33,30 @@ SWITCHES: tuple[HDFurySwitchEntityDescription, ...] = (
entity_category=EntityCategory.CONFIG,
set_value_fn=lambda client, value: client.set_auto_switch_inputs(value),
),
HDFurySwitchEntityDescription(
key="cec0en",
translation_key="cec0en",
entity_category=EntityCategory.CONFIG,
set_value_fn=lambda client, value: client.set_cec_rx0(value),
),
HDFurySwitchEntityDescription(
key="cec1en",
translation_key="cec1en",
entity_category=EntityCategory.CONFIG,
set_value_fn=lambda client, value: client.set_cec_rx1(value),
),
HDFurySwitchEntityDescription(
key="cec2en",
translation_key="cec2en",
entity_category=EntityCategory.CONFIG,
set_value_fn=lambda client, value: client.set_cec_rx2(value),
),
HDFurySwitchEntityDescription(
key="cec3en",
translation_key="cec3en",
entity_category=EntityCategory.CONFIG,
set_value_fn=lambda client, value: client.set_cec_rx3(value),
),
HDFurySwitchEntityDescription(
key="htpcmode0",
translation_key="htpcmode0",

View File

@@ -86,6 +86,10 @@ def mock_hdfury_client() -> Generator[AsyncMock]:
)
coord_client.get_config = AsyncMock(
return_value={
"cec0en": "1",
"cec1en": "1",
"cec2en": "1",
"cec3en": "1",
"autosw": "1",
"iractive": "1",
"htpcmode0": "0",

View File

@@ -10,6 +10,10 @@
}),
'config': dict({
'autosw': '1',
'cec0en': '1',
'cec1en': '1',
'cec2en': '1',
'cec3en': '1',
'htpcmode0': '0',
'htpcmode1': '0',
'htpcmode2': '0',

View File

@@ -48,6 +48,202 @@
'state': 'on',
})
# ---
# name: test_switch_entities[switch.hdfury_vrroom_02_cec_rx0-entry]
EntityRegistryEntrySnapshot({
'aliases': set({
}),
'area_id': None,
'capabilities': None,
'config_entry_id': <ANY>,
'config_subentry_id': <ANY>,
'device_class': None,
'device_id': <ANY>,
'disabled_by': None,
'domain': 'switch',
'entity_category': <EntityCategory.CONFIG: 'config'>,
'entity_id': 'switch.hdfury_vrroom_02_cec_rx0',
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
'labels': set({
}),
'name': None,
'object_id_base': 'CEC RX0',
'options': dict({
}),
'original_device_class': None,
'original_icon': None,
'original_name': 'CEC RX0',
'platform': 'hdfury',
'previous_unique_id': None,
'suggested_object_id': None,
'supported_features': 0,
'translation_key': 'cec0en',
'unique_id': '000123456789_cec0en',
'unit_of_measurement': None,
})
# ---
# name: test_switch_entities[switch.hdfury_vrroom_02_cec_rx0-state]
StateSnapshot({
'attributes': ReadOnlyDict({
'friendly_name': 'HDFury VRROOM-02 CEC RX0',
}),
'context': <ANY>,
'entity_id': 'switch.hdfury_vrroom_02_cec_rx0',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': 'on',
})
# ---
# name: test_switch_entities[switch.hdfury_vrroom_02_cec_rx1-entry]
EntityRegistryEntrySnapshot({
'aliases': set({
}),
'area_id': None,
'capabilities': None,
'config_entry_id': <ANY>,
'config_subentry_id': <ANY>,
'device_class': None,
'device_id': <ANY>,
'disabled_by': None,
'domain': 'switch',
'entity_category': <EntityCategory.CONFIG: 'config'>,
'entity_id': 'switch.hdfury_vrroom_02_cec_rx1',
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
'labels': set({
}),
'name': None,
'object_id_base': 'CEC RX1',
'options': dict({
}),
'original_device_class': None,
'original_icon': None,
'original_name': 'CEC RX1',
'platform': 'hdfury',
'previous_unique_id': None,
'suggested_object_id': None,
'supported_features': 0,
'translation_key': 'cec1en',
'unique_id': '000123456789_cec1en',
'unit_of_measurement': None,
})
# ---
# name: test_switch_entities[switch.hdfury_vrroom_02_cec_rx1-state]
StateSnapshot({
'attributes': ReadOnlyDict({
'friendly_name': 'HDFury VRROOM-02 CEC RX1',
}),
'context': <ANY>,
'entity_id': 'switch.hdfury_vrroom_02_cec_rx1',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': 'on',
})
# ---
# name: test_switch_entities[switch.hdfury_vrroom_02_cec_rx2-entry]
EntityRegistryEntrySnapshot({
'aliases': set({
}),
'area_id': None,
'capabilities': None,
'config_entry_id': <ANY>,
'config_subentry_id': <ANY>,
'device_class': None,
'device_id': <ANY>,
'disabled_by': None,
'domain': 'switch',
'entity_category': <EntityCategory.CONFIG: 'config'>,
'entity_id': 'switch.hdfury_vrroom_02_cec_rx2',
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
'labels': set({
}),
'name': None,
'object_id_base': 'CEC RX2',
'options': dict({
}),
'original_device_class': None,
'original_icon': None,
'original_name': 'CEC RX2',
'platform': 'hdfury',
'previous_unique_id': None,
'suggested_object_id': None,
'supported_features': 0,
'translation_key': 'cec2en',
'unique_id': '000123456789_cec2en',
'unit_of_measurement': None,
})
# ---
# name: test_switch_entities[switch.hdfury_vrroom_02_cec_rx2-state]
StateSnapshot({
'attributes': ReadOnlyDict({
'friendly_name': 'HDFury VRROOM-02 CEC RX2',
}),
'context': <ANY>,
'entity_id': 'switch.hdfury_vrroom_02_cec_rx2',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': 'on',
})
# ---
# name: test_switch_entities[switch.hdfury_vrroom_02_cec_rx3-entry]
EntityRegistryEntrySnapshot({
'aliases': set({
}),
'area_id': None,
'capabilities': None,
'config_entry_id': <ANY>,
'config_subentry_id': <ANY>,
'device_class': None,
'device_id': <ANY>,
'disabled_by': None,
'domain': 'switch',
'entity_category': <EntityCategory.CONFIG: 'config'>,
'entity_id': 'switch.hdfury_vrroom_02_cec_rx3',
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
'labels': set({
}),
'name': None,
'object_id_base': 'CEC RX3',
'options': dict({
}),
'original_device_class': None,
'original_icon': None,
'original_name': 'CEC RX3',
'platform': 'hdfury',
'previous_unique_id': None,
'suggested_object_id': None,
'supported_features': 0,
'translation_key': 'cec3en',
'unique_id': '000123456789_cec3en',
'unit_of_measurement': None,
})
# ---
# name: test_switch_entities[switch.hdfury_vrroom_02_cec_rx3-state]
StateSnapshot({
'attributes': ReadOnlyDict({
'friendly_name': 'HDFury VRROOM-02 CEC RX3',
}),
'context': <ANY>,
'entity_id': 'switch.hdfury_vrroom_02_cec_rx3',
'last_changed': <ANY>,
'last_reported': <ANY>,
'last_updated': <ANY>,
'state': 'on',
})
# ---
# name: test_switch_entities[switch.hdfury_vrroom_02_htpc_mode_rx0-entry]
EntityRegistryEntrySnapshot({
'aliases': set({