Skip to content

Commit

Permalink
Merge pull request #19 from openkfw/translations-state-class-update
Browse files Browse the repository at this point in the history
Translations state class update
  • Loading branch information
mmacai authored Feb 21, 2023
2 parents 31d2615 + 036d5ec commit fc7dfea
Show file tree
Hide file tree
Showing 8 changed files with 54 additions and 61 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## 0.5.0

### Changed

- Moved translations to `strings.json`

### Fixed

- Fixed wrong sensor state classes

## 0.4.0

### Changed
Expand Down
3 changes: 1 addition & 2 deletions configuration.dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ logger:
sensor:
- platform: time_date
display_options:
- 'date_time'

- "date_time"
smartenergy_goecharger:
chargers:
- name: charger1
Expand Down
14 changes: 2 additions & 12 deletions custom_components/smartenergy_goecharger/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,6 @@ class InvalidAuth(HomeAssistantError):
"""Error to indicate there is invalid auth."""


def _get_config_values(data_input: dict) -> dict:
data: dict = {}
config: list[str] = [CONF_NAME, CONF_HOST, CONF_API_TOKEN, CONF_SCAN_INTERVAL]

for config_name in config:
data[config_name] = data_input.get(config_name)

return data


def _get_config_schema(default_values: dict) -> dict:
return vol.Schema(
{
Expand Down Expand Up @@ -127,8 +117,8 @@ async def async_step_user(
if not errors:
return self.async_create_entry(
title=user_input.get(CONF_NAME, ""),
data=_get_config_values(user_input),
options=_get_config_values(user_input),
data=user_input,
options=user_input,
)

return self.async_show_form(
Expand Down
8 changes: 1 addition & 7 deletions custom_components/smartenergy_goecharger/manifest.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,11 @@
{
"domain": "smartenergy_goecharger",
"name": "go-e Charger Cloud",
"version": "0.4.0",
"version": "0.5.0",
"documentation": "https://github.com/openkfw/smartenergy.goecharger",
"issue_tracker": "https://github.com/openkfw/smartenergy.goecharger/issues",
"iot_class": "cloud_polling",
"config_flow": true,
"dependencies": [
"sensor",
"button",
"number",
"select"
],
"codeowners": [
"@openkfw"
],
Expand Down
6 changes: 3 additions & 3 deletions custom_components/smartenergy_goecharger/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@
"name": {"unit": "", "name": "Charger name"},
},
"state_classes": {
CHARGER_MAX_CURRENT: SensorStateClass.TOTAL,
ENERGY_SINCE_CAR_CONNECTED: K_WATT_HOUR,
ENERGY_TOTAL: K_WATT_HOUR,
CHARGER_MAX_CURRENT: SensorStateClass.MEASUREMENT,
ENERGY_SINCE_CAR_CONNECTED: SensorStateClass.TOTAL,
ENERGY_TOTAL: SensorStateClass.TOTAL,
},
"device_classes": {
CHARGER_ACCESS: f"{DOMAIN}__access_control",
Expand Down
36 changes: 36 additions & 0 deletions custom_components/smartenergy_goecharger/strings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"config": {
"error": {
"invalid_host": "[%key:common::config_flow::error::invalid_host%]",
"invalid_auth": "[%key:common::config_flow::error::invalid_auth%]"
},
"step": {
"user": {
"data": {
"name": "[%key:common::config_flow::data::name%]",
"host": "[%key:common::config_flow::data::host%]",
"api_token": "[%key:common::config_flow::data::api_token%]",
"scan_interval": "Scan interval for data updates"
},
"description": "Configure your go-e Charger Cloud car charger."
}
}
},
"options": {
"error": {
"invalid_host": "[%key:common::config_flow::error::invalid_host%]",
"invalid_auth": "[%key:common::config_flow::error::invalid_auth%]"
},
"step": {
"init": {
"data": {
"name": "[%key:common::config_flow::data::name%]",
"host": "[%key:common::config_flow::data::host%]",
"api_token": "[%key:common::config_flow::data::api_token%]",
"scan_interval": "Scan interval for data updates"
},
"description": "Configure your go-e Charger Cloud car charger."
}
}
}
}
36 changes: 0 additions & 36 deletions custom_components/smartenergy_goecharger/translations/en.json

This file was deleted.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ keywords = ["goecharger", "kfw", "homeassistant", "cloud"]
name = "smartenergy.goecharger"
readme = "README.md"
requires-python = ">=3.7"
version = "0.4.0"
version = "0.5.0"

[project.optional-dependencies]
dev = ["black", "pylint", "pytest-homeassistant-custom-component", "Flask", "pre-commit", "isort"]
Expand Down

0 comments on commit fc7dfea

Please sign in to comment.