Home Assistant Unofficial Reference 2024.12.1
notify.py
Go to the documentation of this file.
1 """Support for Ecobee Send Message service."""
2 
3 from __future__ import annotations
4 
5 from homeassistant.components.notify import NotifyEntity
6 from homeassistant.config_entries import ConfigEntry
7 from homeassistant.core import HomeAssistant
8 from homeassistant.helpers.entity_platform import AddEntitiesCallback
9 
10 from . import EcobeeData
11 from .const import DOMAIN
12 from .entity import EcobeeBaseEntity
13 
14 
16  hass: HomeAssistant,
17  config_entry: ConfigEntry,
18  async_add_entities: AddEntitiesCallback,
19 ) -> None:
20  """Set up the ecobee thermostat."""
21  data: EcobeeData = hass.data[DOMAIN]
23  EcobeeNotifyEntity(data, index) for index in range(len(data.ecobee.thermostats))
24  )
25 
26 
28  """Implement the notification entity for the Ecobee thermostat."""
29 
30  _attr_name = None
31  _attr_has_entity_name = True
32 
33  def __init__(self, data: EcobeeData, thermostat_index: int) -> None:
34  """Initialize the thermostat."""
35  super().__init__(data, thermostat_index)
36  self._attr_unique_id_attr_unique_id = (
37  f"{self.thermostat["identifier"]}_notify_{thermostat_index}"
38  )
39 
40  def send_message(self, message: str, title: str | None = None) -> None:
41  """Send a message."""
42  self.datadata.ecobee.send_message(self.thermostat_indexthermostat_index, message)
None send_message(self, str message, str|None title=None)
Definition: notify.py:40
None __init__(self, EcobeeData data, int thermostat_index)
Definition: notify.py:33
None async_setup_entry(HomeAssistant hass, ConfigEntry config_entry, AddEntitiesCallback async_add_entities)
Definition: notify.py:19