Skip to content

Commit

Permalink
Localize status sensor (#67)
Browse files Browse the repository at this point in the history
* Localize status sensor

* Status Error and nb language added

* Removed commented code
  • Loading branch information
astrandb authored Oct 18, 2020
1 parent 6e012ec commit b41a1e1
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 1 deletion.
2 changes: 1 addition & 1 deletion custom_components/easee/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
],
"units": None,
"convert_units_func": None,
"device_class": None,
"device_class": "easee_status",
"icon": "mdi:ev-station",
},
"total_power": {
Expand Down
2 changes: 2 additions & 0 deletions custom_components/easee/entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from homeassistant.helpers import entity_registry, device_registry
from homeassistant.helpers.entity_registry import async_entries_for_device
from homeassistant.helpers.entity import Entity
from homeassistant.helpers.translation import async_get_translations
from homeassistant.util import dt
from homeassistant.const import DEVICE_CLASS_POWER

Expand Down Expand Up @@ -79,6 +80,7 @@ def __init__(

async def async_added_to_hass(self) -> None:
"""Entity created."""

self.hass.data[DOMAIN]["entities"].append({self._entity_name: self.entity_id})

async def async_will_remove_from_hass(self) -> None:
Expand Down
12 changes: 12 additions & 0 deletions custom_components/easee/translations/sensor.en.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"state": {
"easee_status": {
"STANDBY": "Standby",
"PAUSED": "Paused",
"READY_TO_CHARGE": "Ready to charge",
"CAR_CONNECTED": "Car connected",
"CHARGING": "Charging",
"ERROR": "Error"
}
}
}
12 changes: 12 additions & 0 deletions custom_components/easee/translations/sensor.nb.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"state": {
"easee_status": {
"STANDBY": "Ventemodus",
"PAUSED": "Pause",
"READY_TO_CHARGE": "Klar til lading",
"CAR_CONNECTED": "Bil tilkoblet",
"CHARGING": "Lader",
"ERROR": "Feil"
}
}
}
12 changes: 12 additions & 0 deletions custom_components/easee/translations/sensor.sv.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"state": {
"easee_status": {
"STANDBY": "Redo",
"PAUSED": "Paus",
"READY_TO_CHARGE": "Redo att ladda",
"CAR_CONNECTED": "Bil ansluten",
"CHARGING": "Laddar",
"ERROR": "Fel"
}
}
}

0 comments on commit b41a1e1

Please sign in to comment.