Compare commits

103 Commits

Author SHA1 Message Date
Justin Goette 907de1aaab change entity.py to use extra_state_attributes (#66) 2021-12-05 20:07:40 +01:00
Rian Ó Cuinneagáin b7a5860bbf Correct name "Blueprint" ->"Integration blueprint" (#64) 2021-11-18 10:49:40 +01:00
Justin Goette 3a2ced07f2 remove async_timeout.timeout loop arg (#65) 2021-11-18 10:49:24 +01:00
Joakim Sørensen fbf793c4c3 Update README.md
Closes #61
2021-08-29 08:00:26 +02:00
Rod Payne d288b706ef retain user input after an error (#52) 2021-08-15 14:43:31 +02:00
Thibaut 13a80e6af5 Fix typo (#59) 2021-08-02 09:27:33 +02:00
MatthewFlamm cb91d2f547 Use enable_custom_integrations fixture by default (#58) 2021-05-31 09:33:44 +02:00
Ludeeus a11ab703b1 Add iot_class to manifest 2021-05-14 07:17:49 +00:00
Ronnie 93ed8a4c15 Update .gitignore to include .idea (#57)
Update .gitignore to include .idea for those using Py Charm
2021-05-14 08:54:38 +02:00
Ronnie 70330a886d Fix a typo in the readme (#56) 2021-05-03 10:39:30 +02:00
Ronnie 52057dff79 Fix typo in api.py (#55)
passeword -> password
2021-04-12 03:00:37 +02:00
MatthewFlamm 20575023cc Fix testing by bumping pytest-homeassistant-custom-component (#54) 2021-04-06 22:06:36 +02:00
Ludeeus 8637de6b1f Add version 2021-01-30 13:04:58 +00:00
Oncleben31 1033955ee1 Prepare and explain how to step by step debugging (#51) 2021-01-14 11:02:47 +01:00
Raman Gupta e059bc7cc5 Add example tests (#50) 2021-01-13 18:17:25 +01:00
Oncleben31 f85cbb043d Add french translation and strings improvements (#49)
Reusing work done on strings.json done in #37
2021-01-13 12:39:06 +01:00
Oncleben31 75670b7d06 Fix wrong path for link (#48)
For an unknown reason the link was pointing to a one of my repository.
Probably a too quick copy/paste.
2021-01-13 12:31:42 +01:00
Oncleben31 39186e56af Change HACS action (#39) 2020-11-30 12:46:32 +01:00
Joakim Sørensen 8b3b9d380a Rename [blueprint|Blueprint] -> [integration_blueprint|Integration blueprint] (#47) 2020-11-15 00:30:14 +01:00
Joakim Sørensen 668bd9d0bc Remove sampleclient (#45) 2020-11-14 15:27:54 +01:00
Joakim Sørensen bf76923975 Use debian based devcontainer (#44) 2020-11-14 14:28:32 +01:00
Oncleben31 f2b72debbe Fix info.md (#40) 2020-11-14 12:43:02 +01:00
Tobias Efinger 9f9d0e8106 Fix directory name for translations and link to the documentation (#36) 2020-11-14 12:38:52 +01:00
Jean Swart 871f00ebdc Fixed typos (#34) 2020-10-02 09:35:24 +02:00
MatthewFlamm 891cd4c4e0 Use CoordinatorEntity (#33)
Co-authored-by: Joakim Sørensen <hi@ludeeus.dev>
2020-09-19 10:59:47 +02:00
Joakim Sørensen 3c2cd2413d Fixes #32 2020-08-09 17:49:36 +02:00
ludeeus 227bd66972 Move translation files 2020-07-08 07:44:38 +02:00
Erik Seglem 99b07e5a7a Feature/setup cfg (#28)
* Add setup.cfg

* Run black and isort.

* Add blueprint to first party.

* Make const import consistent.
2020-05-14 10:40:21 +02:00
Oncleben31 b22ae5949b Improve README for container dev and library update. (#27) 2020-05-11 10:24:30 +02:00
Oncleben31 411ea16668 Minor updates (#26)
* link correction in README.md and info.md

* Add READMME.md for .devcontainer

* Add automation.yaml file in the configuration

* Complete CONTRIBUTING.md
2020-05-03 09:50:31 +02:00
ludeeus 15c2139381 Update tasks 2020-04-26 12:32:28 +02:00
ludeeus 0cd664e2a6 Update postCreateCommand 2020-04-26 09:46:15 +02:00
Joakim Sørensen 97dd68da95 Adds HACS validation action (#24) 2020-04-23 23:22:27 +02:00
ludeeus a727e061d6 Show how to only allow one instance 2020-04-20 17:54:58 +00:00
Joakim Sørensen a53b0f75a1 Spring cleaning ☀️ (#23)
* Spring cleaning

* Actions

* Fix branches

* Changes for config_flow
2020-04-17 19:42:59 +02:00
Joakim Sørensen d408fbec4a Add hassfest action (#22)
* Add hassfest action

* Fix manifest issue
2020-04-16 23:07:50 +02:00
Chris Soyars 48eb57ef70 Fix various typos in comments (#19) 2019-12-28 22:07:05 +01:00
Giorgio Lasala 0a3a92db07 Typo on README.md (#18) 2019-10-10 16:36:05 +02:00
Kevin Eifinger a7d67066d4 use https for pip install ha@dev (#15) 2019-08-17 12:25:05 +02:00
Ian Richardson 123f34de02 Update README.md 2019-07-26 14:04:20 -05:00
ludeeus 73ff34ff9a Add config_flow "docs" 2019-07-25 09:53:43 +00:00
ludeeus db21a76885 Add support for config_flow configuration 2019-07-25 09:42:40 +00:00
ludeeus 5b045f8c4f Adds "tabnine.tabnine-vscode" to devcontainer 2019-07-24 20:26:52 +02:00
ludeeus 6691cd0df9 adds requirements.txt 2019-07-23 11:18:47 +02:00
ludeeus d156150ef0 Adds integrationhelper 2019-07-23 11:17:19 +02:00
ludeeus 92ae97dc5f remove stalebot 2019-07-20 10:52:46 +00:00
ludeeus 0037bb63fe Add translation example 2019-07-20 10:52:12 +00:00
ludeeus f2a65e77b6 Adds pylint 2019-07-19 08:55:49 +02:00
ludeeus 4701c3cd46 Adds info about devcontainer 2019-07-17 16:40:36 +02:00
ludeeus 8457aefc77 Summer update 😎 2019-07-17 13:03:42 +00:00
Joakim Sørensen 45617d8515 Update README.md 2019-05-15 22:44:36 +02:00
Joakim Sørensen 59463b5f70 Create example.yaml 2019-05-15 22:43:06 +02:00
Joakim Sørensen a3ec139da7 Delete resources.json 2019-05-15 22:42:16 +02:00
Joakim Sørensen 6f7550f085 Update main.workflow 2019-04-21 19:46:03 +02:00
ludeeus 23207e0d53 revert 2019-04-21 19:45:42 +02:00
ludeeus b4796efba9 Updates, updates, more updates, worst commit messge ever! 2019-04-21 19:45:01 +02:00
ludeeus 3bdee78f8e Fixes #9 by renaming the file 2019-04-13 21:16:45 +02:00
ludeeus c33b946cc3 Move manifest to correct dir 2019-04-13 21:15:46 +02:00
Ian Richardson 2ff5a884ce Create manifest.json (#12)
Fixes https://github.com/custom-components/blueprint/issues/10
2019-04-13 20:50:15 +02:00
ludeeus 17b1faf7df Correct typo 2019-03-22 08:54:43 +01:00
Ian Richardson 0f8e201567 cleanup badges/add style (#5)
* shield that supports styling

* badge cleanup

* Change discord ID
2019-03-16 21:11:53 +01:00
Ian Richardson 6d01a5d62c Update const.py (#4) 2019-03-16 19:51:12 +01:00
Ian Richardson 94c21d1eea Update __init__.py (#3)
* Update __init__.py

* Set enabled default to `True`
2019-03-16 19:51:01 +01:00
Ian Richardson 6e2def9513 Update CONTRIBUTING.md (#2) 2019-03-16 19:50:47 +01:00
Ian Richardson f8d10d2612 Update README.md (#1)
* Update README.md

* Update README.md
2019-03-16 19:50:39 +01:00
ludeeus 56d61a8c1f Add switch platform 2019-03-10 15:55:33 +01:00
ludeeus 6ab2f89a30 Fix icon for binary_sensor 2019-03-09 13:21:47 +01:00
ludeeus 551e08ef37 Merge branch 'master' of https://github.com/ludeeus/blueprint 2019-03-09 13:19:21 +01:00
ludeeus 616119eb09 Fix config issues 2019-03-09 13:19:19 +01:00
github-actions[bot] 9e26772a1a Updated package file 2019-03-09 12:02:43 +00:00
ludeeus 775d56196c Black format 2019-03-09 13:01:44 +01:00
github-actions[bot] 44df9faee0 Updated package file 2019-03-09 11:58:47 +00:00
ludeeus f891b56cb2 Merge branch 'master' of https://github.com/ludeeus/blueprint 2019-03-09 12:58:02 +01:00
ludeeus 239ab126fb Update actions 2019-03-09 12:58:00 +01:00
github-actions[bot] 45e8c03424 Updated package file 2019-03-09 11:57:37 +00:00
ludeeus 72f0635833 fix broken actions 2019-03-09 12:55:32 +01:00
ludeeus 3865152f5f Fix links 2019-03-09 12:54:46 +01:00
ludeeus 2010ee4d02 Remove refrences 2019-03-09 12:53:16 +01:00
ludeeus 3cdebc5097 Fix broken link 2019-03-09 12:52:58 +01:00
ludeeus dc7824b765 Adds CONTRIBUTING 2019-03-09 12:52:16 +01:00
ludeeus bac1074a71 Remove switch 2019-03-09 12:36:53 +01:00
ludeeus 20a36692e7 Merge branch 'master' of https://github.com/ludeeus/blueprint 2019-03-09 12:33:15 +01:00
ludeeus 53f2adf129 Add configuration 2019-03-09 12:33:12 +01:00
github-actions[bot] a7c74fdf86 Updated package file 2019-03-08 21:59:19 +00:00
ludeeus 011400bb38 Merge branch 'master' of https://github.com/ludeeus/blueprint 2019-03-08 22:58:36 +01:00
ludeeus 9a4a86bfea add binary_sensor to resources.json 2019-03-08 22:58:34 +01:00
github-actions[bot] 3717319711 Updated package file 2019-03-08 21:54:51 +00:00
ludeeus 01d25d9908 Merge branch 'master' of https://github.com/ludeeus/blueprint 2019-03-08 22:54:11 +01:00
ludeeus 43652bc1c2 Move stuff 2019-03-08 22:54:08 +01:00
github-actions[bot] cd150f816f Updated package file 2019-03-08 21:53:31 +00:00
ludeeus 43e6ba2f25 Merge branch 'master' of https://github.com/ludeeus/blueprint 2019-03-08 22:52:47 +01:00
ludeeus f95c60fc53 Add more descriptions 2019-03-08 22:52:45 +01:00
github-actions[bot] 523126d0a9 Updated package file 2019-03-08 21:42:26 +00:00
ludeeus 2750137017 Fix BinarySensor Class name 2019-03-08 22:41:38 +01:00
github-actions[bot] 2f48db9582 Updated package file 2019-03-08 21:25:37 +00:00
ludeeus 6a043f9e29 Merge branch 'master' of https://github.com/ludeeus/blueprint 2019-03-08 22:24:49 +01:00
ludeeus 6bd7005957 Add binary_sensor 2019-03-08 22:24:47 +01:00
github-actions[bot] 1c072fb5fa Updated package file 2019-03-08 21:13:11 +00:00
ludeeus ce2d663821 minor updates 2019-03-08 22:12:01 +01:00
github-actions[bot] 08fbf028d3 Created package file 2019-03-08 18:25:59 +00:00
ludeeus bf3dab8782 Action commit 2019-03-08 18:25:29 +00:00
ludeeus ad2e54a710 fix action 2019-03-08 19:24:11 +01:00
ludeeus f686660196 init 2019-03-08 19:17:48 +01:00
27 changed files with 107 additions and 107 deletions
+1 -1
View File
@@ -3,7 +3,7 @@ default_config:
logger:
default: info
logs:
custom_components.octopusenergy: debug
custom_components.integration_blueprint: debug
# If you need to debug uncomment the line below (doc: https://www.home-assistant.io/integrations/debugpy/)
# debugpy:
+1 -1
View File
@@ -49,7 +49,7 @@ jobs:
--timeout=9 \
--durations=10 \
-n auto \
--cov custom_components.octopusenergy \
--cov custom_components.integration_blueprint \
-o console_output_style=count \
-p no:sugar \
tests
+1 -1
View File
@@ -52,7 +52,7 @@ jobs:
--timeout=9 \
--durations=10 \
-n auto \
--cov custom_components.octopusenergy \
--cov custom_components.integration_blueprint \
-o console_output_style=count \
-p no:sugar \
tests
+31 -31
View File
@@ -24,21 +24,21 @@ File | Purpose
`.github/ISSUE_TEMPLATE/feature_request.md` | Template for Feature Requests
`.github/ISSUE_TEMPLATE/issue.md` | Template for issues
`.vscode/tasks.json` | Tasks for the devcontainer.
`custom_components/octopusenergy/translations/*` | [Translation files.](https://developers.home-assistant.io/docs/internationalization/custom_integration)
`custom_components/octopusenergy/__init__.py` | The component file for the integration.
`custom_components/octopusenergy/api.py` | This is a sample API client.
`custom_components/octopusenergy/binary_sensor.py` | Binary sensor platform for the integration.
`custom_components/octopusenergy/config_flow.py` | Config flow file, this adds the UI configuration possibilities.
`custom_components/octopusenergy/const.py` | A file to hold shared variables/constants for the entire integration.
`custom_components/octopusenergy/manifest.json` | A [manifest file](https://developers.home-assistant.io/docs/en/creating_integration_manifest.html) for Home Assistant.
`custom_components/octopusenergy/sensor.py` | Sensor platform for the integration.
`custom_components/octopusenergy/switch.py` | Switch sensor platform for the integration.
`custom_components/integration_blueprint/translations/*` | [Translation files.](https://developers.home-assistant.io/docs/internationalization/custom_integration)
`custom_components/integration_blueprint/__init__.py` | The component file for the integration.
`custom_components/integration_blueprint/api.py` | This is a sample API client.
`custom_components/integration_blueprint/binary_sensor.py` | Binary sensor platform for the integration.
`custom_components/integration_blueprint/config_flow.py` | Config flow file, this adds the UI configuration possibilities.
`custom_components/integration_blueprint/const.py` | A file to hold shared variables/constants for the entire integration.
`custom_components/integration_blueprint/manifest.json` | A [manifest file](https://developers.home-assistant.io/docs/en/creating_integration_manifest.html) for Home Assistant.
`custom_components/integration_blueprint/sensor.py` | Sensor platform for the integration.
`custom_components/integration_blueprint/switch.py` | Switch sensor platform for the integration.
`tests/__init__.py` | Makes the `tests` folder a module.
`tests/conftest.py` | Global [fixtures](https://docs.pytest.org/en/stable/fixture.html) used in tests to [patch](https://docs.python.org/3/library/unittest.mock.html#unittest.mock.patch) functions.
`tests/test_api.py` | Tests for `custom_components/octopusenergy/api.py`.
`tests/test_config_flow.py` | Tests for `custom_components/octopusenergy/config_flow.py`.
`tests/test_init.py` | Tests for `custom_components/octopusenergy/__init__.py`.
`tests/test_switch.py` | Tests for `custom_components/octopusenergy/switch.py`.
`tests/test_api.py` | Tests for `custom_components/integration_blueprint/api.py`.
`tests/test_config_flow.py` | Tests for `custom_components/integration_blueprint/config_flow.py`.
`tests/test_init.py` | Tests for `custom_components/integration_blueprint/__init__.py`.
`tests/test_switch.py` | Tests for `custom_components/integration_blueprint/switch.py`.
`CONTRIBUTING.md` | Guidelines on how to contribute.
`example.png` | Screenshot that demonstrate how it might look in the UI.
`info.md` | An example on a info file (used by [hacs][hacs]).
@@ -72,7 +72,7 @@ to ensure Home Assistant update the code of the python library. (example `"requi
README content if this was a published component:
***
# octopusenergy
# integration_blueprint
[![GitHub Release][releases-shield]][releases]
[![GitHub Activity][commits-shield]][commits]
@@ -85,7 +85,7 @@ README content if this was a published component:
[![Discord][discord-shield]][discord]
[![Community Forum][forum-shield]][forum]
_Component to integrate with [octopusenergy][octopusenergy]._
_Component to integrate with [integration_blueprint][integration_blueprint]._
**This component will set up the following platforms.**
@@ -101,8 +101,8 @@ Platform | Description
1. Using the tool of choice open the directory (folder) for your HA configuration (where you find `configuration.yaml`).
2. If you do not have a `custom_components` directory (folder) there, you need to create it.
3. In the `custom_components` directory (folder) create a new folder called `octopusenergy`.
4. Download _all_ the files from the `custom_components/octopusenergy/` directory (folder) in this repository.
3. In the `custom_components` directory (folder) create a new folder called `integration_blueprint`.
4. Download _all_ the files from the `custom_components/integration_blueprint/` directory (folder) in this repository.
5. Place the files you downloaded in the new directory (folder) you created.
6. Restart Home Assistant
7. In the HA UI go to "Configuration" -> "Integrations" click "+" and search for "Integration blueprint"
@@ -110,17 +110,17 @@ Platform | Description
Using your HA configuration directory (folder) as a starting point you should now also have this:
```text
custom_components/octopusenergy/translations/en.json
custom_components/octopusenergy/translations/nb.json
custom_components/octopusenergy/translations/sensor.nb.json
custom_components/octopusenergy/__init__.py
custom_components/octopusenergy/api.py
custom_components/octopusenergy/binary_sensor.py
custom_components/octopusenergy/config_flow.py
custom_components/octopusenergy/const.py
custom_components/octopusenergy/manifest.json
custom_components/octopusenergy/sensor.py
custom_components/octopusenergy/switch.py
custom_components/integration_blueprint/translations/en.json
custom_components/integration_blueprint/translations/nb.json
custom_components/integration_blueprint/translations/sensor.nb.json
custom_components/integration_blueprint/__init__.py
custom_components/integration_blueprint/api.py
custom_components/integration_blueprint/binary_sensor.py
custom_components/integration_blueprint/config_flow.py
custom_components/integration_blueprint/const.py
custom_components/integration_blueprint/manifest.json
custom_components/integration_blueprint/sensor.py
custom_components/integration_blueprint/switch.py
```
## Configuration is done in the UI
@@ -133,11 +133,11 @@ If you want to contribute to this please read the [Contribution guidelines](CONT
***
[octopusenergy]: https://github.com/custom-components/octopusenergy
[integration_blueprint]: https://github.com/custom-components/integration_blueprint
[buymecoffee]: https://www.buymeacoffee.com/ludeeus
[buymecoffeebadge]: https://img.shields.io/badge/buy%20me%20a%20coffee-donate-yellow.svg?style=for-the-badge
[commits-shield]: https://img.shields.io/github/commit-activity/y/custom-components/blueprint.svg?style=for-the-badge
[commits]: https://github.com/custom-components/octopusenergy/commits/master
[commits]: https://github.com/custom-components/integration_blueprint/commits/master
[hacs]: https://github.com/custom-components/hacs
[hacsbadge]: https://img.shields.io/badge/HACS-Custom-orange.svg?style=for-the-badge
[discord]: https://discord.gg/Qa5fW2R
@@ -148,4 +148,4 @@ If you want to contribute to this please read the [Contribution guidelines](CONT
[license-shield]: https://img.shields.io/github/license/custom-components/blueprint.svg?style=for-the-badge
[maintenance-shield]: https://img.shields.io/badge/maintainer-Joakim%20Sørensen%20%40ludeeus-blue.svg?style=for-the-badge
[releases-shield]: https://img.shields.io/github/release/custom-components/blueprint.svg?style=for-the-badge
[releases]: https://github.com/custom-components/octopusenergy/releases
[releases]: https://github.com/custom-components/integration_blueprint/releases
@@ -1,8 +1,8 @@
"""
Custom integration to integrate octopusenergy with Home Assistant.
Custom integration to integrate integration_blueprint with Home Assistant.
For more details about this integration, please refer to
https://github.com/custom-components/octopusenergy
https://github.com/custom-components/integration_blueprint
"""
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 OctopusEnergyApiClient
from .api import IntegrationBlueprintApiClient
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 = OctopusEnergyApiClient(username, password, session)
client = IntegrationBlueprintApiClient(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: OctopusEnergyApiClient
self, hass: HomeAssistant, client: IntegrationBlueprintApiClient
) -> None:
"""Initialize."""
self.api = client
@@ -14,7 +14,7 @@ _LOGGER: logging.Logger = logging.getLogger(__package__)
HEADERS = {"Content-type": "application/json; charset=UTF-8"}
class OctopusEnergyApiClient:
class IntegrationBlueprintApiClient:
def __init__(
self, username: str, password: str, session: aiohttp.ClientSession
) -> None:
@@ -1,4 +1,4 @@
"""Binary sensor platform for octopusenergy."""
"""Binary sensor platform for integration_blueprint."""
from homeassistant.components.binary_sensor import BinarySensorEntity
from .const import (
@@ -7,17 +7,17 @@ from .const import (
DEFAULT_NAME,
DOMAIN,
)
from .entity import OctopusEnergyEntity
from .entity import IntegrationBlueprintEntity
async def async_setup_entry(hass, entry, async_add_devices):
"""Setup binary_sensor platform."""
coordinator = hass.data[DOMAIN][entry.entry_id]
async_add_devices([OctopusEnergyBinarySensor(coordinator, entry)])
async_add_devices([IntegrationBlueprintBinarySensor(coordinator, entry)])
class OctopusEnergyBinarySensor(OctopusEnergyEntity, BinarySensorEntity):
"""octopusenergy binary_sensor class."""
class IntegrationBlueprintBinarySensor(IntegrationBlueprintEntity, BinarySensorEntity):
"""integration_blueprint binary_sensor class."""
@property
def name(self):
@@ -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 OctopusEnergyApiClient
from .api import IntegrationBlueprintApiClient
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 = OctopusEnergyApiClient(username, password, session)
client = IntegrationBlueprintApiClient(username, password, session)
await client.async_get_data()
return True
except Exception: # pylint: disable=broad-except
@@ -1,11 +1,11 @@
"""Constants for octopusenergy."""
"""Constants for integration_blueprint."""
# Base component constants
NAME = "Integration blueprint"
DOMAIN = "octopusenergy"
DOMAIN = "integration_blueprint"
DOMAIN_DATA = f"{DOMAIN}_data"
VERSION = "0.0.1"
ATTRIBUTION = "Data provided by http://jsonplaceholder.typicode.com/"
ISSUE_URL = "https://github.com/custom-components/octopusenergy/issues"
ISSUE_URL = "https://github.com/custom-components/integration_blueprint/issues"
# Icons
ICON = "mdi:format-quote-close"
@@ -4,7 +4,7 @@ from homeassistant.helpers.update_coordinator import CoordinatorEntity
from .const import DOMAIN, NAME, VERSION, ATTRIBUTION
class OctopusEnergyEntity(CoordinatorEntity):
class IntegrationBlueprintEntity(CoordinatorEntity):
def __init__(self, coordinator, config_entry):
super().__init__(coordinator)
self.config_entry = config_entry
@@ -0,0 +1,12 @@
{
"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"
]
}
@@ -1,16 +1,16 @@
"""Sensor platform for octopusenergy."""
"""Sensor platform for integration_blueprint."""
from .const import DEFAULT_NAME, DOMAIN, ICON, SENSOR
from .entity import OctopusEnergyEntity
from .entity import IntegrationBlueprintEntity
async def async_setup_entry(hass, entry, async_add_devices):
"""Setup sensor platform."""
coordinator = hass.data[DOMAIN][entry.entry_id]
async_add_devices([OctopusEnergySensor(coordinator, entry)])
async_add_devices([IntegrationBlueprintSensor(coordinator, entry)])
class OctopusEnergySensor(OctopusEnergyEntity):
"""octopusenergy Sensor class."""
class IntegrationBlueprintSensor(IntegrationBlueprintEntity):
"""integration_blueprint Sensor class."""
@property
def name(self):
@@ -1,18 +1,18 @@
"""Switch platform for octopusenergy."""
"""Switch platform for integration_blueprint."""
from homeassistant.components.switch import SwitchEntity
from .const import DEFAULT_NAME, DOMAIN, ICON, SWITCH
from .entity import OctopusEnergyEntity
from .entity import IntegrationBlueprintEntity
async def async_setup_entry(hass, entry, async_add_devices):
"""Setup sensor platform."""
coordinator = hass.data[DOMAIN][entry.entry_id]
async_add_devices([OctopusEnergyBinarySwitch(coordinator, entry)])
async_add_devices([IntegrationBlueprintBinarySwitch(coordinator, entry)])
class OctopusEnergyBinarySwitch(OctopusEnergyEntity, SwitchEntity):
"""octopusenergy switch class."""
class IntegrationBlueprintBinarySwitch(IntegrationBlueprintEntity, SwitchEntity):
"""integration_blueprint switch class."""
async def async_turn_on(self, **kwargs): # pylint: disable=unused-argument
"""Turn on the switch."""
@@ -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/octopusenergy",
"description": "If you need help with the configuration have a look here: https://github.com/custom-components/integration_blueprint",
"data": {
"username": "Username",
"password": "Password"
@@ -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/octopusenergy",
"description": "Si vous avez besoin d'aide pour la configuration, regardez ici: https://github.com/custom-components/integration_blueprint",
"data": {
"username": "Identifiant",
"password": "Mot de Passe"
@@ -3,7 +3,7 @@
"step": {
"user": {
"title": "Blueprint",
"description": "Hvis du trenger hjep til konfigurasjon ta en titt her: https://github.com/custom-components/octopusenergy",
"description": "Hvis du trenger hjep til konfigurasjon ta en titt her: https://github.com/custom-components/integration_blueprint",
"data": {
"username": "Brukernavn",
"password": "Passord"
@@ -1,12 +0,0 @@
{
"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"
]
}
+8 -8
View File
@@ -9,7 +9,7 @@
[![Discord][discord-shield]][discord]
[![Community Forum][forum-shield]][forum]
_Component to integrate with [octopusenergy][octopusenergy]._
_Component to integrate with [integration_blueprint][integration_blueprint]._
**This component will set up the following platforms.**
@@ -36,11 +36,11 @@ Platform | Description
***
[octopusenergy]: https://github.com/custom-components/octopusenergy
[integration_blueprint]: https://github.com/custom-components/integration_blueprint
[buymecoffee]: https://www.buymeacoffee.com/ludeeus
[buymecoffeebadge]: https://img.shields.io/badge/buy%20me%20a%20coffee-donate-yellow.svg?style=for-the-badge
[commits-shield]: https://img.shields.io/github/commit-activity/y/custom-components/octopusenergy.svg?style=for-the-badge
[commits]: https://github.com/custom-components/octopusenergy/commits/master
[commits-shield]: https://img.shields.io/github/commit-activity/y/custom-components/integration_blueprint.svg?style=for-the-badge
[commits]: https://github.com/custom-components/integration_blueprint/commits/master
[hacs]: https://hacs.xyz
[hacsbadge]: https://img.shields.io/badge/HACS-Custom-orange.svg?style=for-the-badge
[discord]: https://discord.gg/Qa5fW2R
@@ -48,9 +48,9 @@ Platform | Description
[exampleimg]: example.png
[forum-shield]: https://img.shields.io/badge/community-forum-brightgreen.svg?style=for-the-badge
[forum]: https://community.home-assistant.io/
[license]: https://github.com/custom-components/octopusenergy/blob/main/LICENSE
[license-shield]: https://img.shields.io/github/license/custom-components/octopusenergy.svg?style=for-the-badge
[license]: https://github.com/custom-components/integration_blueprint/blob/main/LICENSE
[license-shield]: https://img.shields.io/github/license/custom-components/integration_blueprint.svg?style=for-the-badge
[maintenance-shield]: https://img.shields.io/badge/maintainer-Joakim%20Sørensen%20%40ludeeus-blue.svg?style=for-the-badge
[releases-shield]: https://img.shields.io/github/release/custom-components/octopusenergy.svg?style=for-the-badge
[releases]: https://github.com/custom-components/octopusenergy/releases
[releases-shield]: https://img.shields.io/github/release/custom-components/integration_blueprint.svg?style=for-the-badge
[releases]: https://github.com/custom-components/integration_blueprint/releases
[user_profile]: https://github.com/ludeeus
+1 -1
View File
@@ -31,5 +31,5 @@ not_skip = __init__.py
force_sort_within_sections = true
sections = FUTURE,STDLIB,INBETWEENS,THIRDPARTY,FIRSTPARTY,LOCALFOLDER
default_section = THIRDPARTY
known_first_party = custom_components.octopusenergy, tests
known_first_party = custom_components.integration_blueprint, tests
combine_as_imports = true
+1 -1
View File
@@ -20,5 +20,5 @@ This will install `homeassistant`, `pytest`, and `pytest-homeassistant-custom-co
Command | Description
------- | -----------
`pytest tests/` | This will run all tests in `tests/` and tell you how many passed/failed
`pytest --durations=10 --cov-report term-missing --cov=custom_components.octopusenergy tests` | This tells `pytest` that your target module to test is `custom_components.octopusenergy` so that it can give you a [code coverage](https://en.wikipedia.org/wiki/Code_coverage) summary, including % of code that was executed and the line numbers of missed executions.
`pytest --durations=10 --cov-report term-missing --cov=custom_components.integration_blueprint tests` | This tells `pytest` that your target module to test is `custom_components.integration_blueprint` so that it can give you a [code coverage](https://en.wikipedia.org/wiki/Code_coverage) summary, including % of code that was executed and the line numbers of missed executions.
`pytest tests/test_init.py -k test_setup_unload_and_reload_entry` | Runs the `test_setup_unload_and_reload_entry` test function located in `tests/test_init.py`
+1 -1
View File
@@ -1 +1 @@
"""Tests for octopusenergy integration."""
"""Tests for integration_blueprint integration."""
+3 -3
View File
@@ -1,4 +1,4 @@
"""Global fixtures for octopusenergy integration."""
"""Global fixtures for integration_blueprint integration."""
# Fixtures allow you to replace functions with a Mock object. You can perform
# many options via the Mock to reflect a particular behavior from the original
# function that you want to see without going through the function's actual logic.
@@ -46,7 +46,7 @@ def skip_notifications_fixture():
def bypass_get_data_fixture():
"""Skip calls to get data from API."""
with patch(
"custom_components.octopusenergy.OctopusEnergyApiClient.async_get_data"
"custom_components.integration_blueprint.IntegrationBlueprintApiClient.async_get_data"
):
yield
@@ -57,7 +57,7 @@ def bypass_get_data_fixture():
def error_get_data_fixture():
"""Simulate error when retrieving data from API."""
with patch(
"custom_components.octopusenergy.OctopusEnergyApiClient.async_get_data",
"custom_components.integration_blueprint.IntegrationBlueprintApiClient.async_get_data",
side_effect=Exception,
):
yield
+2 -2
View File
@@ -1,5 +1,5 @@
"""Constants for octopusenergy tests."""
from custom_components.octopusenergy.const import CONF_PASSWORD, CONF_USERNAME
"""Constants for integration_blueprint tests."""
from custom_components.integration_blueprint.const import CONF_PASSWORD, CONF_USERNAME
# Mock config data to be used across multiple tests
MOCK_CONFIG = {CONF_USERNAME: "test_username", CONF_PASSWORD: "test_password"}
+3 -3
View File
@@ -1,17 +1,17 @@
"""Tests for octopusenergy api."""
"""Tests for integration_blueprint api."""
import asyncio
import aiohttp
from homeassistant.helpers.aiohttp_client import async_get_clientsession
from custom_components.octopusenergy.api import OctopusEnergyApiClient
from custom_components.integration_blueprint.api import IntegrationBlueprintApiClient
async def test_api(hass, aioclient_mock, caplog):
"""Test API calls."""
# To test the api submodule, we first create an instance of our API client
api = OctopusEnergyApiClient("test", "test", async_get_clientsession(hass))
api = IntegrationBlueprintApiClient("test", "test", async_get_clientsession(hass))
# Use aioclient_mock which is provided by `pytest_homeassistant_custom_components`
# to mock responses to aiohttp requests. In this case we are telling the mock to
+4 -4
View File
@@ -1,11 +1,11 @@
"""Test octopusenergy config flow."""
"""Test integration_blueprint config flow."""
from unittest.mock import patch
from homeassistant import config_entries, data_entry_flow
import pytest
from pytest_homeassistant_custom_component.common import MockConfigEntry
from custom_components.octopusenergy.const import (
from custom_components.integration_blueprint.const import (
BINARY_SENSOR,
DOMAIN,
PLATFORMS,
@@ -23,10 +23,10 @@ from .const import MOCK_CONFIG
def bypass_setup_fixture():
"""Prevent setup."""
with patch(
"custom_components.octopusenergy.async_setup",
"custom_components.integration_blueprint.async_setup",
return_value=True,
), patch(
"custom_components.octopusenergy.async_setup_entry",
"custom_components.integration_blueprint.async_setup_entry",
return_value=True,
):
yield
+4 -4
View File
@@ -1,15 +1,15 @@
"""Test octopusenergy setup process."""
"""Test integration_blueprint setup process."""
from homeassistant.exceptions import ConfigEntryNotReady
import pytest
from pytest_homeassistant_custom_component.common import MockConfigEntry
from custom_components.octopusenergy import (
from custom_components.integration_blueprint import (
BlueprintDataUpdateCoordinator,
async_reload_entry,
async_setup_entry,
async_unload_entry,
)
from custom_components.octopusenergy.const import DOMAIN
from custom_components.integration_blueprint.const import DOMAIN
from .const import MOCK_CONFIG
@@ -26,7 +26,7 @@ async def test_setup_unload_and_reload_entry(hass, bypass_get_data):
# Set up the entry and assert that the values set during setup are where we expect
# them to be. Because we have patched the BlueprintDataUpdateCoordinator.async_get_data
# call, no code from custom_components/octopusenergy/api.py actually runs.
# call, no code from custom_components/integration_blueprint/api.py actually runs.
assert await async_setup_entry(hass, config_entry)
assert DOMAIN in hass.data and config_entry.entry_id in hass.data[DOMAIN]
assert (
+4 -4
View File
@@ -1,12 +1,12 @@
"""Test octopusenergy switch."""
"""Test integration_blueprint switch."""
from unittest.mock import call, patch
from homeassistant.components.switch import SERVICE_TURN_OFF, SERVICE_TURN_ON
from homeassistant.const import ATTR_ENTITY_ID
from pytest_homeassistant_custom_component.common import MockConfigEntry
from custom_components.octopusenergy import async_setup_entry
from custom_components.octopusenergy.const import DEFAULT_NAME, DOMAIN, SWITCH
from custom_components.integration_blueprint import async_setup_entry
from custom_components.integration_blueprint.const import DEFAULT_NAME, DOMAIN, SWITCH
from .const import MOCK_CONFIG
@@ -21,7 +21,7 @@ async def test_switch_services(hass):
# Functions/objects can be patched directly in test code as well and can be used to test
# additional things, like whether a function was called or what arguments it was called with
with patch(
"custom_components.octopusenergy.OctopusEnergyApiClient.async_set_title"
"custom_components.integration_blueprint.IntegrationBlueprintApiClient.async_set_title"
) as title_func:
await hass.services.async_call(
SWITCH,