Skip to content

Commit 5e8805d

Browse files
authored
Merge pull request #42 from D34DC3N73R/D34DC3N73R-async_patch
Fix async, fix team_colors_"RGB"
2 parents b51cc3b + 0025d13 commit 5e8805d

File tree

6 files changed

+10
-8
lines changed

6 files changed

+10
-8
lines changed

.github/workflows/pytest.yaml

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
runs-on: ubuntu-latest
1212
strategy:
1313
matrix:
14-
python-version: [3.8, 3.9]
14+
python-version: ["3.10"]
1515

1616
steps:
1717
- uses: actions/checkout@v2
@@ -23,10 +23,10 @@ jobs:
2323
run: |
2424
2525
python -m pip install --upgrade pip
26-
pip install -r requirements_test.txt
26+
pip install --upgrade -r requirements_test.txt
2727
- name: Generate coverage report
2828
run: |
29-
python -m pytest
29+
python -m pytest --asyncio-mode=auto
3030
pip install pytest-cov
3131
pytest ./tests/ --cov=custom_components/nfl/ --cov-report=xml
3232
- name: Upload coverage to Codecov

blueprints/nfl-game-score-lights.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ action:
6969
sequence:
7070
- service: light.turn_on
7171
data:
72-
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] }}"
72+
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] }}"
7373
target:
7474
entity_id: !input light_targets
7575
- delay:
@@ -79,7 +79,7 @@ action:
7979
milliseconds: 0
8080
- service: light.turn_on
8181
data:
82-
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] }}"
82+
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] }}"
8383
target:
8484
entity_id: !input light_targets
8585
- delay:

custom_components/nfl/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
6363
COORDINATOR: coordinator,
6464
}
6565

66-
hass.config_entries.async_setup_platforms(entry, PLATFORMS)
66+
await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
6767
return True
6868

6969

custom_components/nfl/sensor.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ def extra_state_attributes(self):
165165
attrs["team_homeaway"] = self.coordinator.data["team_homeaway"]
166166
attrs["team_logo"] = self.coordinator.data["team_logo"]
167167
attrs["team_colors"] = self.coordinator.data["team_colors"]
168-
attrs["team_colors_rbg"] = self.team_colors(self.coordinator.data["team_colors"])
168+
attrs["team_colors_rgb"] = self.team_colors(self.coordinator.data["team_colors"])
169169
attrs["team_score"] = self.coordinator.data["team_score"]
170170
attrs["team_win_probability"] = self.coordinator.data["team_win_probability"]
171171
attrs["team_timeouts"] = self.coordinator.data["team_timeouts"]

requirements_test.txt

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
black
22
isort
33
pytest
4+
pytest-asyncio
45
pytest-cov
56
pytest-homeassistant-custom-component
67
arrow

tests/conftest.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
"""Fixtures for tests"""
22
import pytest
3+
import asyncio
34

4-
pytest_plugins = "pytest_homeassistant_custom_component"
5+
pytest_plugins = ("pytest_homeassistant_custom_component", "pytest_asyncio")
56

67

78
@pytest.fixture(autouse=True)

0 commit comments

Comments
 (0)