1 """Support for Rheem EcoNet water heaters."""
3 from __future__
import annotations
5 from pyeconet.equipment
import EquipmentType
8 BinarySensorDeviceClass,
10 BinarySensorEntityDescription,
16 from .const
import DOMAIN, EQUIPMENT
17 from .entity
import EcoNetEntity
19 BINARY_SENSOR_TYPES: tuple[BinarySensorEntityDescription, ...] = (
21 key=
"shutoff_valve_open",
23 device_class=BinarySensorDeviceClass.OPENING,
28 device_class=BinarySensorDeviceClass.POWER,
33 device_class=BinarySensorDeviceClass.LOCK,
38 device_class=BinarySensorDeviceClass.SOUND,
44 hass: HomeAssistant, entry: ConfigEntry, async_add_entities: AddEntitiesCallback
46 """Set up EcoNet binary sensor based on a config entry."""
47 equipment = hass.data[DOMAIN][EQUIPMENT][entry.entry_id]
48 all_equipment = equipment[EquipmentType.WATER_HEATER].copy()
49 all_equipment.extend(equipment[EquipmentType.THERMOSTAT].copy())
53 for _equip
in all_equipment
54 for description
in BINARY_SENSOR_TYPES
55 if getattr(_equip, description.key,
None)
is not None
62 """Define a Econet binary sensor."""
65 self, econet_device, description: BinarySensorEntityDescription
72 f
"{econet_device.device_id}_{econet_device.device_name}_{description.name}"
77 """Return true if the binary sensor is on."""
None __init__(self, econet_device, BinarySensorEntityDescription description)
None async_setup_entry(HomeAssistant hass, ConfigEntry entry, AddEntitiesCallback async_add_entities)