Adds integrationhelper

This commit is contained in:
ludeeus 2019-07-23 11:17:19 +02:00
parent 92ae97dc5f
commit d156150ef0
3 changed files with 8 additions and 18 deletions

View File

@ -11,6 +11,10 @@ import voluptuous as vol
import homeassistant.helpers.config_validation as cv import homeassistant.helpers.config_validation as cv
from homeassistant.helpers import discovery from homeassistant.helpers import discovery
from homeassistant.util import Throttle from homeassistant.util import Throttle
from sampleclient.client import Client
from integrationhelper.const import CC_STARTUP_VERSION
from .const import ( from .const import (
CONF_BINARY_SENSOR, CONF_BINARY_SENSOR,
CONF_ENABLED, CONF_ENABLED,
@ -25,7 +29,6 @@ from .const import (
ISSUE_URL, ISSUE_URL,
PLATFORMS, PLATFORMS,
REQUIRED_FILES, REQUIRED_FILES,
STARTUP,
VERSION, VERSION,
) )
@ -74,12 +77,8 @@ CONFIG_SCHEMA = vol.Schema(
async def async_setup(hass, config): async def async_setup(hass, config):
"""Set up this component.""" """Set up this component."""
# Import client from a external python package hosted on PyPi
from sampleclient.client import Client
# Print startup message # Print startup message
startup = STARTUP.format(name=DOMAIN, version=VERSION, issueurl=ISSUE_URL) _LOGGER.info(CC_STARTUP_VERSION.format(name=DOMAIN, version=VERSION, issue_link=ISSUE_URL))
_LOGGER.info(startup)
# Check that all required files are present # Check that all required files are present
file_check = await check_files(hass) file_check = await check_files(hass)
@ -143,7 +142,7 @@ class BlueprintData:
async def check_files(hass): async def check_files(hass):
"""Return bool that indicates if all files are present.""" """Return bool that indicates if all files are present."""
# Verify that the user downloaded all files. # Verify that the user downloaded all files.
base = "{}/custom_components/{}/".format(hass.config.path(), DOMAIN) base = f"{hass.config.path()}/custom_components/{DOMAIN}/"
missing = [] missing = []
for file in REQUIRED_FILES: for file in REQUIRED_FILES:
fullpath = "{}{}".format(base, file) fullpath = "{}{}".format(base, file)

View File

@ -1,7 +1,7 @@
"""Constants for blueprint.""" """Constants for blueprint."""
# Base component constants # Base component constants
DOMAIN = "blueprint" DOMAIN = "blueprint"
DOMAIN_DATA = "{}_data".format(DOMAIN) DOMAIN_DATA = f"{DOMAIN}_data"
VERSION = "0.0.1" VERSION = "0.0.1"
PLATFORMS = ["binary_sensor", "sensor", "switch"] PLATFORMS = ["binary_sensor", "sensor", "switch"]
REQUIRED_FILES = [ REQUIRED_FILES = [
@ -13,15 +13,6 @@ REQUIRED_FILES = [
] ]
ISSUE_URL = "https://github.com/custom-components/blueprint/issues" ISSUE_URL = "https://github.com/custom-components/blueprint/issues"
ATTRIBUTION = "Data from this is provided by blueprint." 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 # Icons
ICON = "mdi:format-quote-close" ICON = "mdi:format-quote-close"

View File

@ -4,5 +4,5 @@
"documentation": "https://github.com/custom-components/blueprint", "documentation": "https://github.com/custom-components/blueprint",
"dependencies": [], "dependencies": [],
"codeowners": ["@ludeeus"], "codeowners": ["@ludeeus"],
"requirements": ["sampleclient==0.0.1"] "requirements": ["sampleclient", "integrationhelper"]
} }