Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 9 additions & 45 deletions .github/workflows/pull.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,51 +5,15 @@ on:

jobs:
validate:
runs-on: "ubuntu-latest"
name: Validate
runs-on: ubuntu-latest
steps:
- uses: "actions/checkout@v2"
- uses: actions/checkout@v4

- name: HACS validation
uses: "hacs/action@main"
with:
category: "integration"
ignore: brands

- name: Hassfest validation
uses: "home-assistant/actions/hassfest@master"

style:
runs-on: "ubuntu-latest"
name: Check style formatting
steps:
- uses: "actions/checkout@v2"
- uses: "actions/setup-python@v1"
with:
python-version: "3.x"
- run: python3 -m pip install black
- run: black .

tests:
runs-on: "ubuntu-latest"
name: Run tests
steps:
- name: Check out code from GitHub
uses: "actions/checkout@v2"
- name: Setup Python
uses: "actions/setup-python@v1"
- name: HACS validation
uses: hacs/action@main
with:
python-version: "3.8"
- name: Install requirements
run: python3 -m pip install -r requirements_test.txt
- name: Run tests
run: |
pytest \
-qq \
--timeout=9 \
--durations=10 \
-n auto \
--cov custom_components.integration_blueprint \
-o console_output_style=count \
-p no:sugar \
tests
category: integration
ignore: brands

- name: Hassfest validation
uses: home-assistant/actions/hassfest@master
8 changes: 6 additions & 2 deletions custom_components/tuneblade/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from homeassistant.exceptions import ConfigEntryNotReady
from homeassistant.helpers.aiohttp_client import async_get_clientsession
from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed
from homeassistant.helpers import config_validation as cv

from .tuneblade import TuneBladeApiClient

Expand All @@ -26,6 +27,8 @@
STARTUP_MESSAGE,
)

CONFIG_SCHEMA = cv.config_entry_only_config_schema("tuneblade")

SCAN_INTERVAL = timedelta(seconds=30)

_LOGGER: logging.Logger = logging.getLogger(__package__)
Expand Down Expand Up @@ -68,8 +71,9 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
for platform in PLATFORMS:
if entry.options.get(platform, True):
coordinator.platforms.append(platform)
hass.async_add_job(
hass.config_entries.async_forward_entry_setup(entry, platform)
hass.async_create_background_task(
hass.config_entries.async_forward_entry_setups(entry, [platform]),
name=f"tuneblade: forward {platform}"
)

entry.add_update_listener(async_reload_entry)
Expand Down
10 changes: 5 additions & 5 deletions custom_components/tuneblade/manifest.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"domain": "tuneblade",
"name": "TuneBlade",
"codeowners": ["@spycle"],
"config_flow": true,
"dependencies": [],
"documentation": "https://github.com/spycle/tuneblade",
"iot_class": "local_polling",
"issue_tracker": "https://github.com/spycle/tuneblade/issues",
"version": "0.0.5",
"config_flow": true,
"codeowners": [
"@spycle"
]
"requirements": [],
"version": "0.0.6"
}
9 changes: 5 additions & 4 deletions custom_components/tuneblade/media_player.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""Media Player platform for TuneBlade."""
from homeassistant.components.media_player import MediaPlayerEntity
from homeassistant.components.media_player import MediaPlayerEntityFeature
from homeassistant.components.media_player.const import (
SUPPORT_VOLUME_SET,
SUPPORT_TURN_ON,
Expand All @@ -14,12 +15,12 @@
from .entity import TuneBladeEntity

SUPPORTED_FEATURES = (
SUPPORT_VOLUME_SET
| SUPPORT_TURN_ON
| SUPPORT_TURN_OFF
MediaPlayerEntityFeature.VOLUME_SET
| MediaPlayerEntityFeature.TURN_ON
| MediaPlayerEntityFeature.TURN_OFF
)

SUPPORTED_FEATURES_MASTER = (SUPPORT_VOLUME_SET)
SUPPORTED_FEATURES_MASTER = MediaPlayerEntityFeature.SUPPORT_VOLUME_SET

async def async_setup_entry(hass, entry, async_add_devices):
"""Setup sensor platform."""
Expand Down
4 changes: 0 additions & 4 deletions hacs.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
{
"name": "TuneBlade",
"content_in_root": false,
"domains": [
"media_player",
"switch"
],
"render_readme": true
}