Skip to content

Commit

Permalink
Adds integrationhelper
Browse files Browse the repository at this point in the history
  • Loading branch information
ludeeus committed Jul 23, 2019
1 parent 92ae97d commit d156150
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 18 deletions.
13 changes: 6 additions & 7 deletions custom_components/blueprint/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@
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,
Expand All @@ -25,7 +29,6 @@
ISSUE_URL,
PLATFORMS,
REQUIRED_FILES,
STARTUP,
VERSION,
)

Expand Down Expand Up @@ -74,12 +77,8 @@

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)
Expand Down Expand Up @@ -143,7 +142,7 @@ async def update_data(self):
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)
Expand Down
11 changes: 1 addition & 10 deletions custom_components/blueprint/const.py
Original file line number Diff line number Diff line change
@@ -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 = [
Expand All @@ -13,15 +13,6 @@
]
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"
Expand Down
2 changes: 1 addition & 1 deletion custom_components/blueprint/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
"documentation": "https://github.com/custom-components/blueprint",
"dependencies": [],
"codeowners": ["@ludeeus"],
"requirements": ["sampleclient==0.0.1"]
"requirements": ["sampleclient", "integrationhelper"]
}

0 comments on commit d156150

Please sign in to comment.