diff --git a/.github/workflows/pull.yml b/.github/workflows/pull.yml index d895c86..f491de7 100644 --- a/.github/workflows/pull.yml +++ b/.github/workflows/pull.yml @@ -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 diff --git a/custom_components/tuneblade/__init__.py b/custom_components/tuneblade/__init__.py index b6b35f4..d4ff5b0 100644 --- a/custom_components/tuneblade/__init__.py +++ b/custom_components/tuneblade/__init__.py @@ -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 @@ -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__) @@ -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) diff --git a/custom_components/tuneblade/manifest.json b/custom_components/tuneblade/manifest.json index 420d2fd..1b17fa3 100644 --- a/custom_components/tuneblade/manifest.json +++ b/custom_components/tuneblade/manifest.json @@ -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" } diff --git a/custom_components/tuneblade/media_player.py b/custom_components/tuneblade/media_player.py index 28111db..f160cd9 100644 --- a/custom_components/tuneblade/media_player.py +++ b/custom_components/tuneblade/media_player.py @@ -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, @@ -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.""" diff --git a/hacs.json b/hacs.json index bdbe86b..18e5078 100644 --- a/hacs.json +++ b/hacs.json @@ -1,9 +1,5 @@ { "name": "TuneBlade", "content_in_root": false, - "domains": [ - "media_player", - "switch" - ], "render_readme": true }