Adds integrationhelper
This commit is contained in:
parent
92ae97dc5f
commit
d156150ef0
@ -11,6 +11,10 @@ import voluptuous as vol
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.helpers import discovery
|
||||
from homeassistant.util import Throttle
|
||||
|
||||
from sampleclient.client import Client
|
||||
from integrationhelper.const import CC_STARTUP_VERSION
|
||||
|
||||
from .const import (
|
||||
CONF_BINARY_SENSOR,
|
||||
CONF_ENABLED,
|
||||
@ -25,7 +29,6 @@ from .const import (
|
||||
ISSUE_URL,
|
||||
PLATFORMS,
|
||||
REQUIRED_FILES,
|
||||
STARTUP,
|
||||
VERSION,
|
||||
)
|
||||
|
||||
@ -74,12 +77,8 @@ CONFIG_SCHEMA = vol.Schema(
|
||||
|
||||
async def async_setup(hass, config):
|
||||
"""Set up this component."""
|
||||
# Import client from a external python package hosted on PyPi
|
||||
from sampleclient.client import Client
|
||||
|
||||
# Print startup message
|
||||
startup = STARTUP.format(name=DOMAIN, version=VERSION, issueurl=ISSUE_URL)
|
||||
_LOGGER.info(startup)
|
||||
_LOGGER.info(CC_STARTUP_VERSION.format(name=DOMAIN, version=VERSION, issue_link=ISSUE_URL))
|
||||
|
||||
# Check that all required files are present
|
||||
file_check = await check_files(hass)
|
||||
@ -143,7 +142,7 @@ class BlueprintData:
|
||||
async def check_files(hass):
|
||||
"""Return bool that indicates if all files are present."""
|
||||
# Verify that the user downloaded all files.
|
||||
base = "{}/custom_components/{}/".format(hass.config.path(), DOMAIN)
|
||||
base = f"{hass.config.path()}/custom_components/{DOMAIN}/"
|
||||
missing = []
|
||||
for file in REQUIRED_FILES:
|
||||
fullpath = "{}{}".format(base, file)
|
||||
|
@ -1,7 +1,7 @@
|
||||
"""Constants for blueprint."""
|
||||
# Base component constants
|
||||
DOMAIN = "blueprint"
|
||||
DOMAIN_DATA = "{}_data".format(DOMAIN)
|
||||
DOMAIN_DATA = f"{DOMAIN}_data"
|
||||
VERSION = "0.0.1"
|
||||
PLATFORMS = ["binary_sensor", "sensor", "switch"]
|
||||
REQUIRED_FILES = [
|
||||
@ -13,15 +13,6 @@ REQUIRED_FILES = [
|
||||
]
|
||||
ISSUE_URL = "https://github.com/custom-components/blueprint/issues"
|
||||
ATTRIBUTION = "Data from this is provided by blueprint."
|
||||
STARTUP = """
|
||||
-------------------------------------------------------------------
|
||||
{name}
|
||||
Version: {version}
|
||||
This is a custom component
|
||||
If you have any issues with this you need to open an issue here:
|
||||
{issueurl}
|
||||
-------------------------------------------------------------------
|
||||
"""
|
||||
|
||||
# Icons
|
||||
ICON = "mdi:format-quote-close"
|
||||
|
@ -4,5 +4,5 @@
|
||||
"documentation": "https://github.com/custom-components/blueprint",
|
||||
"dependencies": [],
|
||||
"codeowners": ["@ludeeus"],
|
||||
"requirements": ["sampleclient==0.0.1"]
|
||||
"requirements": ["sampleclient", "integrationhelper"]
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user