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,6 @@
"""Switch platform for blueprint."""
from homeassistant.components.switch import SwitchDevice
from .const import ATTRIBUTION, DEFAULT_NAME, DOMAIN_DATA, ICON
from .const import ATTRIBUTION, DEFAULT_NAME, DOMAIN_DATA, ICON, DOMAIN
async def async_setup_platform(
@ -10,6 +10,11 @@ async def async_setup_platform(
async_add_entities([BlueprintBinarySwitch(hass, discovery_info)], True)
async def async_setup_entry(hass, config_entry, async_add_devices):
"""Setup sensor platform."""
async_add_devices([BlueprintBinarySwitch(hass, {})], True)
class BlueprintBinarySwitch(SwitchDevice):
"""blueprint switch class."""
@ -43,6 +48,21 @@ class BlueprintBinarySwitch(SwitchDevice):
"""Turn off the switch."""
await self.hass.data[DOMAIN_DATA]["client"].client.change_something(False)
@property
def unique_id(self):
"""Return a unique ID to use for this switch."""
return (
"0818a0cd-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 switch."""