Don't create event entries for lighting4 rfxtrx devices (#115716)
These have no standardized command need to be reworked in the backing library to support exposing as events. Fixes #115545
This commit is contained in:
parent
a25b2168a3
commit
ff4b8fa5e3
2 changed files with 28 additions and 1 deletions
|
@ -15,6 +15,7 @@ from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
|||
from homeassistant.util import slugify
|
||||
|
||||
from . import DeviceTuple, RfxtrxEntity, async_setup_platform_entry
|
||||
from .const import DEVICE_PACKET_TYPE_LIGHTING4
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
@ -27,7 +28,10 @@ async def async_setup_entry(
|
|||
"""Set up config entry."""
|
||||
|
||||
def _supported(event: RFXtrxEvent) -> bool:
|
||||
return isinstance(event, (ControlEvent, SensorEvent))
|
||||
return (
|
||||
isinstance(event, (ControlEvent, SensorEvent))
|
||||
and event.device.packettype != DEVICE_PACKET_TYPE_LIGHTING4
|
||||
)
|
||||
|
||||
def _constructor(
|
||||
event: RFXtrxEvent,
|
||||
|
|
|
@ -10,6 +10,7 @@ from syrupy.assertion import SnapshotAssertion
|
|||
from homeassistant.components.rfxtrx import get_rfx_object
|
||||
from homeassistant.const import Platform
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import entity_registry as er
|
||||
|
||||
from .conftest import setup_rfx_test_cfg
|
||||
|
||||
|
@ -101,3 +102,25 @@ async def test_invalid_event_type(
|
|||
await hass.async_block_till_done()
|
||||
|
||||
assert hass.states.get("event.arc_c1") == state
|
||||
|
||||
|
||||
async def test_ignoring_lighting4(hass: HomeAssistant, rfxtrx) -> None:
|
||||
"""Test with 1 sensor."""
|
||||
entry = await setup_rfx_test_cfg(
|
||||
hass,
|
||||
devices={
|
||||
"0913000022670e013970": {
|
||||
"data_bits": 4,
|
||||
"command_on": 0xE,
|
||||
"command_off": 0x7,
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
registry = er.async_get(hass)
|
||||
entries = [
|
||||
entry
|
||||
for entry in registry.entities.get_entries_for_config_entry_id(entry.entry_id)
|
||||
if entry.domain == Platform.EVENT
|
||||
]
|
||||
assert entries == []
|
||||
|
|
Loading…
Add table
Reference in a new issue