Rename [blueprint|Blueprint] -> [integration_blueprint|Integration blueprint] (#47)

This commit is contained in:
Joakim Sørensen
2020-11-15 00:30:14 +01:00
committed by GitHub
parent 668bd9d0bc
commit 8b3b9d380a
19 changed files with 309 additions and 307 deletions

View File

@ -0,0 +1,35 @@
"""Binary sensor platform for integration_blueprint."""
from homeassistant.components.binary_sensor import BinarySensorEntity
from .const import (
BINARY_SENSOR,
BINARY_SENSOR_DEVICE_CLASS,
DEFAULT_NAME,
DOMAIN,
)
from .entity import IntegrationBlueprintEntity
async def async_setup_entry(hass, entry, async_add_devices):
"""Setup binary_sensor platform."""
coordinator = hass.data[DOMAIN][entry.entry_id]
async_add_devices([IntegrationBlueprintBinarySensor(coordinator, entry)])
class IntegrationBlueprintBinarySensor(IntegrationBlueprintEntity, BinarySensorEntity):
"""integration_blueprint binary_sensor class."""
@property
def name(self):
"""Return the name of the binary_sensor."""
return f"{DEFAULT_NAME}_{BINARY_SENSOR}"
@property
def device_class(self):
"""Return the class of this binary_sensor."""
return BINARY_SENSOR_DEVICE_CLASS
@property
def is_on(self):
"""Return true if the binary_sensor is on."""
return self.coordinator.data.get("title", "") == "foo"