Skip to content

Commit

Permalink
πŸ› v2.3.0 (#160)
Browse files Browse the repository at this point in the history
* πŸ› v2.3.0

Signed-off-by: Ludy87 <Ludy87@users.noreply.github.com>

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Signed-off-by: Ludy87 <Ludy87@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
Ludy87 and pre-commit-ci[bot] authored Jan 14, 2024
1 parent 1a9fc0f commit f6e2a4a
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 12 deletions.
6 changes: 3 additions & 3 deletions .github/actions/get_version.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import json
import json # noqa: D100
import sys


def main():
def main(): # noqa: D103
with open("./custom_components/ecotrend_ista/manifest.json") as json_file:
data = json.load(json_file)
print(data["version"])
print(data["version"]) # noqa: T201
return 0


Expand Down
3 changes: 2 additions & 1 deletion custom_components/ecotrend_ista/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

import copy
import logging
from types import MappingProxyType
from typing import Any

from homeassistant import config_entries, core
Expand All @@ -26,7 +27,7 @@

@staticmethod
@core.callback
def login_account(hass: core.HomeAssistant, data: dict, demo: bool = False) -> PyEcotrendIsta:
def login_account(hass: core.HomeAssistant, data: MappingProxyType[str, Any], demo: bool = False) -> PyEcotrendIsta:
"""Log into an Ecotrend-Ista account and return an account instance."""
account = PyEcotrendIsta(
email=data.get(CONF_EMAIL, None),
Expand Down
18 changes: 15 additions & 3 deletions custom_components/ecotrend_ista/coordinator.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,11 @@ def set_controller(self) -> None:
and other necessary configurations.
"""
data = self._entry.data
self.controller = login_account(self.hass, data, self._entry.options.get("dev_demo", False))
self.controller = login_account(
self.hass,
data,
self._entry.options.get("dev_demo", False),
)

async def init(self) -> None:
"""Initialize the controller and perform the login."""
Expand All @@ -79,13 +83,21 @@ async def _async_update_data(self):
try:
await self.init()
_consum_raw: dict[str, Any] = await self.hass.async_add_executor_job(
self.controller.consum_raw, [datetime.datetime.now().year]
self.controller.consum_raw,
[
datetime.datetime.now().year,
datetime.datetime.now().year - 1,
],
)
if not isinstance(_consum_raw, dict):
return self.data
consum_raw: CustomRaw = CustomRaw.from_dict(_consum_raw)

await create_directory_file(self.hass, consum_raw, self.controller.getSupportCode())
await create_directory_file(
self.hass,
consum_raw,
self.controller.getSupportCode(),
)
self.data = consum_raw
self.async_set_updated_data(self.data)
return self.data
Expand Down
4 changes: 2 additions & 2 deletions custom_components/ecotrend_ista/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
"iot_class": "cloud_polling",
"issue_tracker": "https://github.com/Ludy87/ecotrend-ista/issues",
"requirements": [
"pyecotrend_ista==2.2.7",
"pyecotrend_ista==2.3.0",
"pyotp==2.8.0",
"marshmallow-enum==1.5.1"
],
"version": "v2.2.0"
"version": "v2.3.0"
}
8 changes: 7 additions & 1 deletion custom_components/ecotrend_ista/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,13 @@ async def async_setup_entry(

entities: list = []
consum_raw: CustomRaw = CustomRaw.from_dict(
await hass.async_add_executor_job(controller.consum_raw, [datetime.datetime.now().year])
await hass.async_add_executor_job(
controller.consum_raw,
[
datetime.datetime.now().year,
datetime.datetime.now().year - 1,
],
)
)
consum_dict = consum_raw.to_dict()
last_value = consum_dict.get("last_value", None)
Expand Down
4 changes: 2 additions & 2 deletions hacs.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"zip_release": true,
"country": "DE",
"render_readme": true,
"homeassistant": "2023.10.1",
"homeassistant": "2023.12.1",
"hacs": "1.33.0",
"filename": "ecotrend_ista.zip"
}
}
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@ ignore = [

]

[tool.flake8]
max-line-length = 127

[tool.ruff.flake8-pytest-style]
fixture-parentheses = false

Expand Down

0 comments on commit f6e2a4a

Please sign in to comment.