-
-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from tijsverkoyen/more-data
Station and Device entities
- Loading branch information
Showing
6 changed files
with
270 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
66 changes: 66 additions & 0 deletions
66
custom_components/fusion_solar/fusion_solar/station_attribute_entity.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
from homeassistant.helpers.entity import Entity, EntityCategory | ||
|
||
|
||
class FusionSolarAttributeEntity(Entity): | ||
"""Base class for all FusionSolarAttributeEntity entities.""" | ||
|
||
def __init__( | ||
self, | ||
unique_id, | ||
name, | ||
value, | ||
device_info=None | ||
): | ||
"""Initialize the entity""" | ||
self._unique_id = unique_id | ||
self._name = name | ||
self._value = value | ||
self._device_info = device_info | ||
|
||
@property | ||
def unique_id(self) -> str: | ||
return self._unique_id | ||
|
||
@property | ||
def name(self): | ||
return self._name | ||
|
||
@property | ||
def state(self): | ||
return self._value | ||
|
||
@property | ||
def device_info(self) -> dict: | ||
return self._device_info | ||
|
||
@property | ||
def entity_category(self) -> str: | ||
return EntityCategory.DIAGNOSTIC | ||
|
||
@property | ||
def should_poll(self) -> bool: | ||
return False | ||
|
||
|
||
class FusionSolarCapacityEntity(FusionSolarAttributeEntity): | ||
_attr_icon = 'mdi:lightning-bolt' | ||
|
||
|
||
class FusionSolarContactPersonEntity(FusionSolarAttributeEntity): | ||
_attr_icon = 'mdi:account' | ||
|
||
|
||
class FusionSolarContactPersonPhoneEntity(FusionSolarAttributeEntity): | ||
_attr_icon = 'mdi:card-account-phone' | ||
|
||
|
||
class FusionSolarAddressEntity(FusionSolarAttributeEntity): | ||
_attr_icon = 'mdi:map-marker' | ||
|
||
|
||
class FusionSolarLatitudeEntity(FusionSolarAttributeEntity): | ||
_attr_icon = 'mdi:latitude' | ||
|
||
|
||
class FusionSolarLongitudeEntity(FusionSolarAttributeEntity): | ||
_attr_icon = 'mdi:longitude' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters