Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix async, fix team_colors_"RGB" #42

Merged
merged 5 commits into from
May 9, 2023
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
6 changes: 3 additions & 3 deletions .github/workflows/pytest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions blueprints/nfl-game-score-lights.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion custom_components/nfl/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
2 changes: 1 addition & 1 deletion custom_components/nfl/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down
1 change: 1 addition & 0 deletions requirements_test.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
black
isort
pytest
pytest-asyncio
pytest-cov
pytest-homeassistant-custom-component
arrow
3 changes: 2 additions & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
@@ -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)
Expand Down