Add support for config_flow configuration

This commit is contained in:
ludeeus
2019-07-25 09:42:40 +00:00
parent 5b045f8c4f
commit db21a76885
8 changed files with 292 additions and 8 deletions

View File

@ -1,6 +1,12 @@
"""Binary sensor platform for blueprint."""
from homeassistant.components.binary_sensor import BinarySensorDevice
from .const import ATTRIBUTION, BINARY_SENSOR_DEVICE_CLASS, DEFAULT_NAME, DOMAIN_DATA
from .const import (
ATTRIBUTION,
BINARY_SENSOR_DEVICE_CLASS,
DEFAULT_NAME,
DOMAIN_DATA,
DOMAIN,
)
async def async_setup_platform(
@ -10,6 +16,11 @@ async def async_setup_platform(
async_add_entities([BlueprintBinarySensor(hass, discovery_info)], True)
async def async_setup_entry(hass, config_entry, async_add_devices):
"""Setup sensor platform."""
async_add_devices([BlueprintBinarySensor(hass, {})], True)
class BlueprintBinarySensor(BinarySensorDevice):
"""blueprint binary_sensor class."""
@ -38,6 +49,21 @@ class BlueprintBinarySensor(BinarySensorDevice):
self.attr["time"] = str(updated.get("time"))
self.attr["static"] = updated.get("static")
@property
def unique_id(self):
"""Return a unique ID to use for this binary_sensor."""
return (
"0919a0cd-745c-48fd"
) # Don't had code this, use something from the device/service.
@property
def device_info(self):
return {
"identifiers": {(DOMAIN, self.unique_id)},
"name": self.name,
"manufacturer": "Blueprint",
}
@property
def name(self):
"""Return the name of the binary_sensor."""