1
0
mirror of https://github.com/home-assistant/core.git synced 2026-02-15 07:36:16 +00:00

Create cable unplugged entity only for Shelly Flood Gen4 (#161053)

This commit is contained in:
Maciej Bieniek
2026-01-17 16:58:23 +01:00
committed by GitHub
parent fa29d8180f
commit 6ba16ee9e9
2 changed files with 10 additions and 4 deletions

View File

@@ -5,7 +5,7 @@ from __future__ import annotations
from dataclasses import dataclass
from typing import Final, cast
from aioshelly.const import RPC_GENERATIONS
from aioshelly.const import MODEL_FLOOD_G4, RPC_GENERATIONS
from homeassistant.components.binary_sensor import (
DOMAIN as BINARY_SENSOR_PLATFORM,
@@ -335,6 +335,7 @@ RPC_SENSORS: Final = {
device_class=BinarySensorDeviceClass.PROBLEM,
entity_category=EntityCategory.DIAGNOSTIC,
supported=lambda status: status.get("alarm") is not None,
models={MODEL_FLOOD_G4},
),
"presence_num_objects": RpcBinarySensorDescription(
key="presence",

View File

@@ -3,7 +3,12 @@
from copy import deepcopy
from unittest.mock import Mock
from aioshelly.const import MODEL_BLU_GATEWAY_G3, MODEL_MOTION, MODEL_PLUS_SMOKE
from aioshelly.const import (
MODEL_BLU_GATEWAY_G3,
MODEL_FLOOD_G4,
MODEL_MOTION,
MODEL_PLUS_SMOKE,
)
from freezegun.api import FrozenDateTimeFactory
import pytest
from syrupy.assertion import SnapshotAssertion
@@ -612,7 +617,7 @@ async def test_rpc_flood_entities(
snapshot: SnapshotAssertion,
) -> None:
"""Test RPC flood sensor entities."""
await init_integration(hass, 4)
await init_integration(hass, 4, model=MODEL_FLOOD_G4)
for entity in ("flood", "mute", "cable_unplugged"):
entity_id = f"{BINARY_SENSOR_DOMAIN}.test_name_kitchen_{entity}"
@@ -630,7 +635,7 @@ async def test_rpc_flood_cable_unplugged(
monkeypatch: pytest.MonkeyPatch,
) -> None:
"""Test RPC flood cable unplugged entity."""
await init_integration(hass, 4)
await init_integration(hass, 4, model=MODEL_FLOOD_G4)
entity_id = f"{BINARY_SENSOR_DOMAIN}.test_name_kitchen_cable_unplugged"