initial commit v0.2.1
This commit is contained in:
commit
2b9a10979b
19 files changed
+1665
No files matched your search
@@ -0,0 +1,28 @@
|
||||
"""Read-only simulated ON/OFF demand. It never changes a physical switch."""
|
||||
from homeassistant.components.binary_sensor import BinarySensorEntity
|
||||
from homeassistant.helpers.update_coordinator import CoordinatorEntity
|
||||
|
||||
from .const import DOMAIN
|
||||
|
||||
|
||||
async def async_setup_entry(hass, entry, async_add_entities):
|
||||
coordinator = hass.data[DOMAIN][entry.entry_id]
|
||||
async_add_entities([HeatingMPCProposal(coordinator, entry.entry_id)])
|
||||
|
||||
|
||||
class HeatingMPCProposal(CoordinatorEntity, BinarySensorEntity):
|
||||
_attr_has_entity_name = True
|
||||
_attr_name = "Heating MPC Proposed Heat"
|
||||
_attr_icon = "mdi:fire"
|
||||
|
||||
def __init__(self, coordinator, entry_id):
|
||||
super().__init__(coordinator)
|
||||
self._attr_unique_id = f"{entry_id}_proposal"
|
||||
|
||||
@property
|
||||
def available(self) -> bool:
|
||||
return self.coordinator.last_update_success and self.coordinator.data.get("status") == "ready"
|
||||
|
||||
@property
|
||||
def is_on(self):
|
||||
return self.coordinator.data.get("proposal")
|
||||
Reference in new issue
Block a user