File tree Expand file tree Collapse file tree 5 files changed +13
-5
lines changed
custom_components/span_panel Expand file tree Collapse file tree 5 files changed +13
-5
lines changed Original file line number Diff line number Diff line change 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."
Original file line number Diff line number Diff line change @@ -374,6 +374,7 @@ def native_value(self) -> str | None:
374374
375375
376376class SpanPanelStorageBatteryStatus (CoordinatorEntity , SensorEntity ):
377+ """Battery Status"""
377378 _attr_icon = "mdi:battery"
378379
379380 def __init__ (
Original file line number Diff line number Diff line change 3333SYSTEM_CELLULAR_LINK = "wwanLink"
3434SYSTEM_WIFI_LINK = "wlanLink"
3535
36+
3637class 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..." )
Original file line number Diff line number Diff line change 2121from .span_panel_status import SpanPanelStatus
2222from .span_panel_storage_battery import SpanPanelStorageBattery
2323
24+
2425_LOGGER = logging .getLogger (__name__ )
2526
2627
Original file line number Diff line number Diff line change 1+ """span_panel_storage_battery"""
12import dataclasses
2- from typing import Any
3+ from typing import Any , Dict
34
45@dataclasses .dataclass
56class 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+ )
You can’t perform that action at this time.
0 commit comments