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: make sure all_rates doesn't have a unit of measure #77

Closed
wants to merge 4 commits into from
Closed
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
49 changes: 32 additions & 17 deletions .github/workflows/pull.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ jobs:
runs-on: "ubuntu-latest"
name: Validate
steps:
- uses: "actions/checkout@v2"
- name: 📥 Checkout the repository
uses: actions/[email protected]

- name: HACS validation
uses: "hacs/action@main"
Expand All @@ -23,29 +24,43 @@ jobs:
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 .
- name: 📥 Checkout the repository
uses: actions/[email protected]
- name: 🛠️ Set up Python
uses: actions/[email protected]
with:
python-version: "3.x"
- run: python3 -m pip install black
- run: black .

tests:
runs-on: "ubuntu-latest"
name: Run tests
strategy:
matrix:
python-version:
# - "3.10"
- "3.11"

steps:
- name: Check out code from GitHub
uses: "actions/checkout@v2"
- name: Setup Python
uses: "actions/setup-python@v1"
- name: 📥 Checkout the repository
uses: actions/checkout@v3.5.3
- name: 🛠️ Set up Python
uses: actions/setup-python@v4.6.1
with:
python-version: "3.8"
- name: Install requirements
run: python3 -m pip install -r requirements_tests.txt
- name: Run tests
fetch-depth: 2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/[email protected]
with:
python-version: ${{ matrix.python-version }}
- name: 📦 Install requirements
run: |
pip install -r requirements_tests.txt
- name: 🏃 Run tests
run: |
pytest \
-qq \
--asyncio-mode=auto \
--timeout=9 \
--durations=10 \
-n auto \
Expand All @@ -54,5 +69,5 @@ jobs:
-p no:sugar \
--cov-report=xml \
tests
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
- name: 📤 Upload coverage to Codecov
uses: codecov/codecov-action@v3.1.1
59 changes: 37 additions & 22 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,12 @@ on:
- dev

jobs:
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 .

validate:
runs-on: "ubuntu-latest"
name: Validate
steps:
- uses: "actions/checkout@v2"
- name: 📥 Checkout the repository
uses: actions/[email protected]

- name: HACS validation
uses: "hacs/action@main"
Expand All @@ -33,22 +23,47 @@ jobs:
- name: Hassfest validation
uses: "home-assistant/actions/hassfest@master"

style:
runs-on: "ubuntu-latest"
name: Check style formatting
steps:
- name: 📥 Checkout the repository
uses: actions/[email protected]
- name: 🛠️ Set up Python
uses: actions/[email protected]
with:
python-version: "3.x"
- run: python3 -m pip install black
- run: black .

tests:
runs-on: "ubuntu-latest"
name: Run tests
strategy:
matrix:
python-version:
# - "3.10"
- "3.11"

steps:
- name: Check out code from GitHub
uses: "actions/checkout@v2"
- name: Setup Python
uses: "actions/setup-python@v1"
- name: 📥 Checkout the repository
uses: actions/[email protected]
- name: 🛠️ Set up Python
uses: actions/[email protected]
with:
fetch-depth: 2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/[email protected]
with:
python-version: "3.8"
- name: Install requirements
run: python3 -m pip install -r requirements_tests.txt
- name: Run tests
python-version: ${{ matrix.python-version }}
- name: 📦 Install requirements
run: |
pip install -r requirements_tests.txt
- name: 🏃 Run tests
run: |
pytest \
-qq \
--asyncio-mode=auto \
--timeout=9 \
--durations=10 \
-n auto \
Expand All @@ -57,5 +72,5 @@ jobs:
-p no:sugar \
--cov-report=xml \
tests
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
- name: 📤 Upload coverage to Codecov
uses: codecov/codecov-action@v3.1.1
2 changes: 1 addition & 1 deletion custom_components/openei/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ def get_sensors(hass, config) -> dict:
for sensor in SENSOR_TYPES:
_sensor = {}
value = getattr(rate, SENSOR_TYPES[sensor].key)
if isinstance(value, tuple):
if isinstance(value, tuple) and sensor != "all_rates":
_sensor[sensor] = value[0]
_sensor[f"{sensor}_uom"] = value[1]
else:
Expand Down
10 changes: 5 additions & 5 deletions custom_components/openei/manifest.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"domain": "openei",
"name": "OpenEI Utility Rates",
"documentation": "https://github.com/firstof9/ha-openei",
"issue_tracker": "https://github.com/firstof9/ha-openei/issues",
"codeowners": ["@firstof9"],
"config_flow": true,
"dependencies": [],
"documentation": "https://github.com/firstof9/ha-openei",
"iot_class": "cloud_polling",
"config_flow": true,
"codeowners": ["@firstof9"],
"requirements": ["python-openei==0.1.22"],
"issue_tracker": "https://github.com/firstof9/ha-openei/issues",
"requirements": ["python-openei==0.1.23"],
"version": "0.1.8"
}
2 changes: 1 addition & 1 deletion requirements_tests.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
-r requirements_dev.txt
python-openei==0.1.22
python-openei==0.1.23
pytest
pytest-cov
pytest-homeassistant-custom-component
Loading