Home Assistant Unofficial Reference 2024.12.1
binary_sensor.py
Go to the documentation of this file.
1 """Support for Aurora Forecast binary sensor."""
2 
3 from __future__ import annotations
4 
5 from homeassistant.components.binary_sensor import BinarySensorEntity
6 from homeassistant.core import HomeAssistant
7 from homeassistant.helpers.entity_platform import AddEntitiesCallback
8 
9 from . import AuroraConfigEntry
10 from .entity import AuroraEntity
11 
12 
14  hass: HomeAssistant,
15  entry: AuroraConfigEntry,
16  async_add_entities: AddEntitiesCallback,
17 ) -> None:
18  """Set up the binary_sensor platform."""
20  [
22  coordinator=entry.runtime_data,
23  translation_key="visibility_alert",
24  )
25  ]
26  )
27 
28 
30  """Implementation of an aurora sensor."""
31 
32  @property
33  def is_on(self) -> bool:
34  """Return true if aurora is visible."""
35  return self.coordinator.data > self.coordinator.threshold
None async_setup_entry(HomeAssistant hass, AuroraConfigEntry entry, AddEntitiesCallback async_add_entities)