diff --git a/.github/workflows/pytest.yaml b/.github/workflows/pytest.yaml index 685f4c5..43e86f1 100644 --- a/.github/workflows/pytest.yaml +++ b/.github/workflows/pytest.yaml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: [3.8, 3.9] + python-version: ["3.10"] steps: - uses: actions/checkout@v2 @@ -23,10 +23,10 @@ jobs: run: | python -m pip install --upgrade pip - pip install -r requirements_test.txt + pip install --upgrade -r requirements_test.txt - name: Generate coverage report run: | - python -m pytest + python -m pytest --asyncio-mode=auto pip install pytest-cov pytest ./tests/ --cov=custom_components/nfl/ --cov-report=xml - name: Upload coverage to Codecov diff --git a/blueprints/nfl-game-score-lights.yaml b/blueprints/nfl-game-score-lights.yaml index 87a44ae..fb35971 100644 --- a/blueprints/nfl-game-score-lights.yaml +++ b/blueprints/nfl-game-score-lights.yaml @@ -69,7 +69,7 @@ action: sequence: - service: light.turn_on data: - rgb_color: "{{ state_attr(trigger.entity_id, 'team_colors_rbg')[0] if (trigger.id != 'oppo_score') else state_attr(trigger.entity_id, 'opponent_colors_rgb')[0] }}" + rgb_color: "{{ state_attr(trigger.entity_id, 'team_colors_rgb')[0] if (trigger.id != 'oppo_score') else state_attr(trigger.entity_id, 'opponent_colors_rgb')[0] }}" target: entity_id: !input light_targets - delay: @@ -79,7 +79,7 @@ action: milliseconds: 0 - service: light.turn_on data: - rgb_color: "{{ state_attr(trigger.entity_id, 'team_colors_rbg')[1] if (trigger.id != 'oppo_score') else state_attr(trigger.entity_id, 'opponent_colors_rgb')[1] }}" + rgb_color: "{{ state_attr(trigger.entity_id, 'team_colors_rgb')[1] if (trigger.id != 'oppo_score') else state_attr(trigger.entity_id, 'opponent_colors_rgb')[1] }}" target: entity_id: !input light_targets - delay: diff --git a/custom_components/nfl/__init__.py b/custom_components/nfl/__init__.py index e9ab247..564c112 100644 --- a/custom_components/nfl/__init__.py +++ b/custom_components/nfl/__init__.py @@ -63,7 +63,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: COORDINATOR: coordinator, } - hass.config_entries.async_setup_platforms(entry, PLATFORMS) + await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS) return True diff --git a/custom_components/nfl/sensor.py b/custom_components/nfl/sensor.py index 1e4b3fc..ccf2074 100644 --- a/custom_components/nfl/sensor.py +++ b/custom_components/nfl/sensor.py @@ -165,7 +165,7 @@ def extra_state_attributes(self): attrs["team_homeaway"] = self.coordinator.data["team_homeaway"] attrs["team_logo"] = self.coordinator.data["team_logo"] attrs["team_colors"] = self.coordinator.data["team_colors"] - attrs["team_colors_rbg"] = self.team_colors(self.coordinator.data["team_colors"]) + attrs["team_colors_rgb"] = self.team_colors(self.coordinator.data["team_colors"]) attrs["team_score"] = self.coordinator.data["team_score"] attrs["team_win_probability"] = self.coordinator.data["team_win_probability"] attrs["team_timeouts"] = self.coordinator.data["team_timeouts"] diff --git a/requirements_test.txt b/requirements_test.txt index d036146..ec96aac 100644 --- a/requirements_test.txt +++ b/requirements_test.txt @@ -1,6 +1,7 @@ black isort pytest +pytest-asyncio pytest-cov pytest-homeassistant-custom-component arrow diff --git a/tests/conftest.py b/tests/conftest.py index b9a0f15..eeb4024 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,7 +1,8 @@ """Fixtures for tests""" import pytest +import asyncio -pytest_plugins = "pytest_homeassistant_custom_component" +pytest_plugins = ("pytest_homeassistant_custom_component", "pytest_asyncio") @pytest.fixture(autouse=True)