Merge pull request 'chore: rename integration and references in unit tests' (#1) from customise-blueprint into main

Reviewed-on: #1
This commit is contained in:
2021-12-11 12:07:43 +00:00
committed by Alex Berry
27 changed files with 107 additions and 107 deletions

View File

@@ -1,12 +0,0 @@
{
"domain": "integration_blueprint",
"name": "Integration blueprint",
"documentation": "https://github.com/custom-components/integration_blueprint",
"iot_class": "cloud_polling",
"issue_tracker": "https://github.com/custom-components/integration_blueprint/issues",
"version": "0.0.0",
"config_flow": true,
"codeowners": [
"@ludeeus"
]
}

View File

@@ -1,8 +1,8 @@
"""
Custom integration to integrate integration_blueprint with Home Assistant.
Custom integration to integrate octopusenergy with Home Assistant.
For more details about this integration, please refer to
https://github.com/custom-components/integration_blueprint
https://github.com/custom-components/octopusenergy
"""
import asyncio
from datetime import timedelta
@@ -14,7 +14,7 @@ from homeassistant.exceptions import ConfigEntryNotReady
from homeassistant.helpers.aiohttp_client import async_get_clientsession
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed
from .api import IntegrationBlueprintApiClient
from .api import OctopusEnergyApiClient
from .const import (
CONF_PASSWORD,
@@ -44,7 +44,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
password = entry.data.get(CONF_PASSWORD)
session = async_get_clientsession(hass)
client = IntegrationBlueprintApiClient(username, password, session)
client = OctopusEnergyApiClient(username, password, session)
coordinator = BlueprintDataUpdateCoordinator(hass, client=client)
await coordinator.async_refresh()
@@ -69,7 +69,7 @@ class BlueprintDataUpdateCoordinator(DataUpdateCoordinator):
"""Class to manage fetching data from the API."""
def __init__(
self, hass: HomeAssistant, client: IntegrationBlueprintApiClient
self, hass: HomeAssistant, client: OctopusEnergyApiClient
) -> None:
"""Initialize."""
self.api = client

View File

@@ -14,7 +14,7 @@ _LOGGER: logging.Logger = logging.getLogger(__package__)
HEADERS = {"Content-type": "application/json; charset=UTF-8"}
class IntegrationBlueprintApiClient:
class OctopusEnergyApiClient:
def __init__(
self, username: str, password: str, session: aiohttp.ClientSession
) -> None:

View File

@@ -1,4 +1,4 @@
"""Binary sensor platform for integration_blueprint."""
"""Binary sensor platform for octopusenergy."""
from homeassistant.components.binary_sensor import BinarySensorEntity
from .const import (
@@ -7,17 +7,17 @@ from .const import (
DEFAULT_NAME,
DOMAIN,
)
from .entity import IntegrationBlueprintEntity
from .entity import OctopusEnergyEntity
async def async_setup_entry(hass, entry, async_add_devices):
"""Setup binary_sensor platform."""
coordinator = hass.data[DOMAIN][entry.entry_id]
async_add_devices([IntegrationBlueprintBinarySensor(coordinator, entry)])
async_add_devices([OctopusEnergyBinarySensor(coordinator, entry)])
class IntegrationBlueprintBinarySensor(IntegrationBlueprintEntity, BinarySensorEntity):
"""integration_blueprint binary_sensor class."""
class OctopusEnergyBinarySensor(OctopusEnergyEntity, BinarySensorEntity):
"""octopusenergy binary_sensor class."""
@property
def name(self):

View File

@@ -4,7 +4,7 @@ from homeassistant.core import callback
from homeassistant.helpers.aiohttp_client import async_create_clientsession
import voluptuous as vol
from .api import IntegrationBlueprintApiClient
from .api import OctopusEnergyApiClient
from .const import (
CONF_PASSWORD,
CONF_USERNAME,
@@ -73,7 +73,7 @@ class BlueprintFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
"""Return true if credentials is valid."""
try:
session = async_create_clientsession(self.hass)
client = IntegrationBlueprintApiClient(username, password, session)
client = OctopusEnergyApiClient(username, password, session)
await client.async_get_data()
return True
except Exception: # pylint: disable=broad-except

View File

@@ -1,11 +1,11 @@
"""Constants for integration_blueprint."""
"""Constants for octopusenergy."""
# Base component constants
NAME = "Integration blueprint"
DOMAIN = "integration_blueprint"
DOMAIN = "octopusenergy"
DOMAIN_DATA = f"{DOMAIN}_data"
VERSION = "0.0.1"
ATTRIBUTION = "Data provided by http://jsonplaceholder.typicode.com/"
ISSUE_URL = "https://github.com/custom-components/integration_blueprint/issues"
ISSUE_URL = "https://github.com/custom-components/octopusenergy/issues"
# Icons
ICON = "mdi:format-quote-close"

View File

@@ -4,7 +4,7 @@ from homeassistant.helpers.update_coordinator import CoordinatorEntity
from .const import DOMAIN, NAME, VERSION, ATTRIBUTION
class IntegrationBlueprintEntity(CoordinatorEntity):
class OctopusEnergyEntity(CoordinatorEntity):
def __init__(self, coordinator, config_entry):
super().__init__(coordinator)
self.config_entry = config_entry

View File

@@ -0,0 +1,12 @@
{
"domain": "octopusenergy",
"name": "Integration blueprint",
"documentation": "https://github.com/custom-components/octopusenergy",
"iot_class": "cloud_polling",
"issue_tracker": "https://github.com/custom-components/octopusenergy/issues",
"version": "0.0.0",
"config_flow": true,
"codeowners": [
"@ludeeus"
]
}

View File

@@ -1,16 +1,16 @@
"""Sensor platform for integration_blueprint."""
"""Sensor platform for octopusenergy."""
from .const import DEFAULT_NAME, DOMAIN, ICON, SENSOR
from .entity import IntegrationBlueprintEntity
from .entity import OctopusEnergyEntity
async def async_setup_entry(hass, entry, async_add_devices):
"""Setup sensor platform."""
coordinator = hass.data[DOMAIN][entry.entry_id]
async_add_devices([IntegrationBlueprintSensor(coordinator, entry)])
async_add_devices([OctopusEnergySensor(coordinator, entry)])
class IntegrationBlueprintSensor(IntegrationBlueprintEntity):
"""integration_blueprint Sensor class."""
class OctopusEnergySensor(OctopusEnergyEntity):
"""octopusenergy Sensor class."""
@property
def name(self):

View File

@@ -1,18 +1,18 @@
"""Switch platform for integration_blueprint."""
"""Switch platform for octopusenergy."""
from homeassistant.components.switch import SwitchEntity
from .const import DEFAULT_NAME, DOMAIN, ICON, SWITCH
from .entity import IntegrationBlueprintEntity
from .entity import OctopusEnergyEntity
async def async_setup_entry(hass, entry, async_add_devices):
"""Setup sensor platform."""
coordinator = hass.data[DOMAIN][entry.entry_id]
async_add_devices([IntegrationBlueprintBinarySwitch(coordinator, entry)])
async_add_devices([OctopusEnergyBinarySwitch(coordinator, entry)])
class IntegrationBlueprintBinarySwitch(IntegrationBlueprintEntity, SwitchEntity):
"""integration_blueprint switch class."""
class OctopusEnergyBinarySwitch(OctopusEnergyEntity, SwitchEntity):
"""octopusenergy switch class."""
async def async_turn_on(self, **kwargs): # pylint: disable=unused-argument
"""Turn on the switch."""

View File

@@ -3,7 +3,7 @@
"step": {
"user": {
"title": "Blueprint",
"description": "If you need help with the configuration have a look here: https://github.com/custom-components/integration_blueprint",
"description": "If you need help with the configuration have a look here: https://github.com/custom-components/octopusenergy",
"data": {
"username": "Username",
"password": "Password"

View File

@@ -3,7 +3,7 @@
"step": {
"user": {
"title": "Blueprint",
"description": "Si vous avez besoin d'aide pour la configuration, regardez ici: https://github.com/custom-components/integration_blueprint",
"description": "Si vous avez besoin d'aide pour la configuration, regardez ici: https://github.com/custom-components/octopusenergy",
"data": {
"username": "Identifiant",
"password": "Mot de Passe"

View File

@@ -3,7 +3,7 @@
"step": {
"user": {
"title": "Blueprint",
"description": "Hvis du trenger hjep til konfigurasjon ta en titt her: https://github.com/custom-components/integration_blueprint",
"description": "Hvis du trenger hjep til konfigurasjon ta en titt her: https://github.com/custom-components/octopusenergy",
"data": {
"username": "Brukernavn",
"password": "Passord"