Skip to content

Commit

Permalink
Merge pull request #6 from azogue/chore/fix-bugs
Browse files Browse the repository at this point in the history
🐛 Fix bugs for new price sensors
  • Loading branch information
azogue committed May 29, 2023
2 parents 4dfd226 + 8310541 commit a400977
Show file tree
Hide file tree
Showing 8 changed files with 308 additions and 298 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.0.263
rev: v0.0.270
hooks:
- id: ruff
args:
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## [v1.1.0](https://github.com/azogue/ha-pvpc-custom/tree/v1.1.0) 🐛 Fixes for new extra price sensors (2023-05-29)

- 🐛 Fix all integration sensors going unavailable when any sensor lacks data for the current day (usually the 'OMIE price')
- 🐛 Fix 'max_price_at' and 'min_price_at' for injection price sensor (were swapped), by updating to [`aiopvpc` v4.2.1](https://github.com/azogue/aiopvpc/releases/tag/v4.2.1), and set 'integration_type' to 'service' in `manifest.json`
- 🎨 pre-commit autoupdate

## [v1.0.0](https://github.com/azogue/ha-pvpc-custom/tree/v1.0.0) ✨ API Token support + extra price sensors (2023-04-02)

Mirror of [official HA-Core integration 'pvpc_hourly_pricing'](https://www.home-assistant.io/integrations/pvpc_hourly_pricing), with proposed changes to
Expand Down
2 changes: 1 addition & 1 deletion custom_components/pvpc_hourly_pricing/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ async def _async_update_data(self) -> EsiosApiData:
if (
not api_data
or not api_data.sensors
or not all(api_data.availability.values())
or not any(api_data.availability.values())
):
raise UpdateFailed
return api_data
5 changes: 3 additions & 2 deletions custom_components/pvpc_hourly_pricing/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@
"codeowners": ["@azogue"],
"config_flow": true,
"documentation": "https://github.com/azogue/ha-pvpc-custom",
"integration_type": "service",
"iot_class": "cloud_polling",
"issue_tracker": "https://github.com/azogue/ha-pvpc-custom/issues",
"loggers": ["aiopvpc"],
"quality_scale": "platinum",
"requirements": ["aiopvpc==4.1.0"],
"version": "1.0.0"
"requirements": ["aiopvpc==4.2.1"],
"version": "1.1.0"
}
7 changes: 7 additions & 0 deletions custom_components/pvpc_hourly_pricing/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,13 @@ def __init__(
)
)

@property
def available(self) -> bool:
"""Return if entity is available."""
return self.coordinator.data.availability.get(
self.entity_description.key, False
)

async def async_added_to_hass(self) -> None:
"""Handle entity which will be added."""
await super().async_added_to_hass()
Expand Down
1 change: 0 additions & 1 deletion hacs.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"name": "Spain electricity hourly pricing (PVPC)",
"content_in_root": false,
"zip_release": false,
"render_readme": true,
"country": "ES",
"homeassistant": "2023.3.0"
Expand Down
579 changes: 288 additions & 291 deletions poetry.lock

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "ha-pvpc-custom"
version = "1.0.0"
version = "1.1.0"
description = "HomeAssistant custom integration for Spain electricity hourly pricing (PVPC)"
authors = ["Eugenio Panadero <eugenio.panadero@gmail.com>"]
license = "MIT"
Expand All @@ -10,7 +10,7 @@ repository = "https://github.com/azogue/ha-pvpc-custom"
[tool.poetry.dependencies]
python = ">=3.10,<3.12"
homeassistant = ">=2023.3.0"
aiopvpc = ">=4.1.0"
aiopvpc = ">=4.2.1"

[tool.poetry.dev-dependencies]
pre-commit = ">=2.2.0"
Expand Down

0 comments on commit a400977

Please sign in to comment.