-
Notifications
You must be signed in to change notification settings - Fork 67
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 #146 from magico13/v8
V0.8
- Loading branch information
Showing
7 changed files
with
535 additions
and
184 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
.vscode | ||
.vs | ||
**/__pycache__ | ||
/dist | ||
/build | ||
|
Large diffs are not rendered by default.
Oops, something went wrong.
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,74 @@ | ||
import logging | ||
from typing import Any, Mapping | ||
|
||
from homeassistant.helpers.update_coordinator import ( | ||
CoordinatorEntity, | ||
) | ||
|
||
from .const import DOMAIN | ||
|
||
from pyemvue import pyemvue | ||
from pyemvue.device import VueDevice | ||
|
||
_LOGGER = logging.getLogger(__name__) | ||
|
||
|
||
class EmporiaChargerEntity(CoordinatorEntity): | ||
"""Emporia Charger Entity""" | ||
|
||
def __init__( | ||
self, | ||
coordinator, | ||
vue: pyemvue.PyEmVue, | ||
device: VueDevice, | ||
units: str, | ||
device_class: str, | ||
enabled_default=True, | ||
): | ||
super().__init__(coordinator) | ||
self._coordinator = coordinator | ||
self._device = device | ||
self._vue = vue | ||
self._enabled_default = enabled_default | ||
|
||
self._attr_unit_of_measurement = units | ||
self._attr_device_class = device_class | ||
self._attr_name = device.device_name | ||
|
||
@property | ||
def entity_registry_enabled_default(self): | ||
return self._enabled_default | ||
|
||
@property | ||
def extra_state_attributes(self) -> Mapping[str, Any]: | ||
data = self._coordinator.data[self._device.device_gid] | ||
if data: | ||
return { | ||
"charging_rate": data.charging_rate, | ||
"max_charging_rate": data.max_charging_rate, | ||
"status": data.status, | ||
"message": data.message, | ||
"fault_text": data.fault_text, | ||
} | ||
return None | ||
|
||
@property | ||
def unique_id(self) -> str: | ||
"""Unique ID for the charger""" | ||
return f"charger.emporia_vue.{self._device.device_gid}" | ||
|
||
@property | ||
def device_info(self): | ||
"""Return the device information.""" | ||
return { | ||
"identifiers": {(DOMAIN, "{0}-1,2,3".format(self._device.device_gid))}, | ||
"name": self._device.device_name + "-1,2,3", | ||
"model": self._device.model, | ||
"sw_version": self._device.firmware, | ||
"manufacturer": "Emporia", | ||
} | ||
|
||
@property | ||
def available(self): | ||
"""Return True if entity is available.""" | ||
return self._device |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
set_charger_current: | ||
# Service name as shown in UI | ||
name: Set Charger Current | ||
# Description of the service | ||
description: Sets the charging current for an EVSE/Charger. | ||
# If the service accepts entity IDs, target allows the user to specify entities by entity, device, or area. If `target` is specified, `entity_id` should not be defined in the `fields` map. By default it shows only targets matching entities from the same domain as the service, but if further customization is required, target supports the entity, device, and area selectors (https://www.home-assistant.io/docs/blueprint/selectors/). Entity selector parameters will automatically be applied to device and area, and device selector parameters will automatically be applied to area. | ||
target: | ||
entity: | ||
manufacturer: Emporia | ||
device_class: outlet | ||
multiple: false | ||
device: | ||
manufacturer: Emporia | ||
model: VVDN01 | ||
multiple: false | ||
# Different fields that your service accepts | ||
fields: | ||
# Key of the field | ||
current: | ||
# Field name as shown in UI | ||
name: Charging Current | ||
# Description of the field | ||
description: The desired charging current in Amps. | ||
# Whether or not field is required (default = false) | ||
required: true | ||
# Advanced fields are only shown when the advanced mode is enabled for the user (default = false) | ||
advanced: false | ||
# Example value that can be passed for this field | ||
example: 6 | ||
# The default field value | ||
default: 6 | ||
# Selector (https://www.home-assistant.io/docs/blueprint/selectors/) to control the input UI for this field | ||
selector: | ||
number: | ||
min: 6 | ||
max: 48 |
Oops, something went wrong.