Skip to content

Commit

Permalink
Bump huawei-solar to 2.1.0a3
Browse files Browse the repository at this point in the history
  • Loading branch information
wlcrs committed May 30, 2022
1 parent 36e3cc6 commit 77a6de9
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
4 changes: 2 additions & 2 deletions manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"config_flow": true,
"documentation": "https://www.home-assistant.io/integrations/huawei_solar",
"issue_tracker": "https://github.com/wlcrs/huawei_solar/issues",
"requirements": ["huawei-solar==2.1.0a2"],
"requirements": ["huawei-solar==2.1.0a3"],
"codeowners": ["@wlcrs"],
"iot_class": "local_polling",
"version": "1.1.0a2"
"version": "1.1.0a3"
}
17 changes: 14 additions & 3 deletions sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -759,12 +759,23 @@ def __init__(
self._attr_device_info = device_info
self._attr_unique_id = f"{device_info['name']}_{description.key}"

@property
def available(self) -> bool:
"""Report if sensor is available"""

# Check whether optimizer is listed in coordinator data
return super().available and self.optimizer_id in self.coordinator.data

@property
def native_value(self):
"""Native sensor value."""
return getattr(
self.coordinator.data[self.optimizer_id], self.entity_description.key
)
if self.optimizer_id in self.coordinator.data:
return getattr(
self.coordinator.data[self.optimizer_id], self.entity_description.key
)

else:
return None


def get_pv_entity_descriptions(count: int) -> list[HuaweiSolarSensorEntityDescription]:
Expand Down

0 comments on commit 77a6de9

Please sign in to comment.