Skip to content

Commit bb87577

Browse files
committed
review and minor cleanup
1 parent acc8e1c commit bb87577

File tree

5 files changed

+13
-5
lines changed

5 files changed

+13
-5
lines changed

custom_components/span_panel/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"iot_class": "local_polling",
1111
"issue_tracker": "https://github.com/SpanPanel/span/issues",
1212
"requirements": [],
13-
"version": "0.0.13",
13+
"version": "0.0.13-beta",
1414
"zeroconf": [
1515
{
1616
"type": "_span._tcp.local."

custom_components/span_panel/sensor.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,7 @@ def native_value(self) -> str | None:
374374

375375

376376
class SpanPanelStorageBatteryStatus(CoordinatorEntity, SensorEntity):
377+
"""Battery Status"""
377378
_attr_icon = "mdi:battery"
378379

379380
def __init__(

custom_components/span_panel/span_panel.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
SYSTEM_CELLULAR_LINK = "wwanLink"
3434
SYSTEM_WIFI_LINK = "wlanLink"
3535

36+
3637
class SpanPanel:
3738
"""Instance of a Span panel"""
3839

@@ -68,4 +69,4 @@ async def update(self) -> None:
6869
self.storage_battery = await self.api.get_storage_battery_data()
6970

7071
except SpanPanelReturnedEmptyData:
71-
_LOGGER.warn("Span Panel API returned empty result. Ignoring...")
72+
_LOGGER.warn("Span Panel API returned empty result for battery storage. Ignoring...")

custom_components/span_panel/span_panel_api.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
from .span_panel_status import SpanPanelStatus
2222
from .span_panel_storage_battery import SpanPanelStorageBattery
2323

24+
2425
_LOGGER = logging.getLogger(__name__)
2526

2627

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
1+
"""span_panel_storage_battery"""
12
import dataclasses
2-
from typing import Any
3+
from typing import Any, Dict
34

45
@dataclasses.dataclass
56
class SpanPanelStorageBattery:
7+
"""Class to manage the storage battery data."""
68
storage_battery_percentage: int
79

810
@staticmethod
9-
def from_dic(data):
10-
return data
11+
def from_dic(data: Dict[str, Any]) -> "SpanPanelStorageBattery":
12+
"""read the data from the dictionary"""
13+
return SpanPanelStorageBattery(
14+
storage_battery_percentage=int(data.get('storage_battery_percentage', 0))
15+
)

0 commit comments

Comments
 (0)