Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update translations and device_state to use lower key text #38

Merged
merged 7 commits into from
Jul 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 0 additions & 22 deletions .github/workflows/cron.yaml

This file was deleted.

17 changes: 0 additions & 17 deletions .github/workflows/hacs_action.yaml

This file was deleted.

15 changes: 12 additions & 3 deletions .github/workflows/hassfest.yaml
Original file line number Diff line number Diff line change
@@ -1,15 +1,24 @@
# yamllint disable rule:truthy
name: Validate with hassfest
name: Hassfest and HACS validation

on:
push:
pull_request:
branches:
- "*"
schedule:
- cron: "0 0 * * *"

jobs:
validate:
runs-on: "ubuntu-latest"
name: Validate
steps:
- uses: "actions/checkout@v2"
- uses: home-assistant/actions/hassfest@master

- name: HACS validation
uses: "hacs/action@main"
with:
category: "integration"

- name: Hassfest validation
uses: "home-assistant/actions/hassfest@master"
2 changes: 1 addition & 1 deletion .github/workflows/pytest.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This workflow will install dependencies, create coverage tests
# and run Pytest with coverage reporting
name: pytest-coverage
name: Pytest and coverage
# yamllint disable-line rule:truthy
on:
pull_request:
Expand Down
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ Platform | Description
`siren` | Represents Elro Connects alarms as a siren. Turn the siren `ON` to test it. Turn it `OFF` to silence the (test) alarm.

The `device_state` sensor can have of the following states:
- `FAULT`
- `SILENCE`
- `TEST ALARM`
- `FIRE ALARM`
- `ALARM`
- `NORMAL`
- `UNKNOWN`
- `OFFLINE`
- `fault`
- `silence`
- `test_alarm`
- `fire_alarm`
- `alarm`
- `normal`
- `unknown`
- `offline`

Note that the sensors are polled about every 15 seconds. So it might take some time before an alarm state will be propagated. If an unknown state is found that is not supported yet, the hexadecimal code will be assigned as state. Please open an issue [here](https://github.com/jbouwh/lib-elro-connects/issues/new) if a new state needs to be supported.

Expand Down
2 changes: 1 addition & 1 deletion custom_components/elro_connects/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
"iot_class": "local_polling",
"issue_tracker": "https://github.com/jbouwh/ha-elro-connects/issues",
"requirements": ["lib-elro-connects==0.5.4.1"],
"version": "0.2.0"
"version": "0.2.1"
}
15 changes: 9 additions & 6 deletions custom_components/elro_connects/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
)

from homeassistant.components.sensor import (
SensorDeviceClass,
SensorEntity,
SensorEntityDescription,
SensorStateClass,
Expand All @@ -20,6 +21,7 @@
from homeassistant.const import PERCENTAGE
from homeassistant.core import HomeAssistant
from homeassistant.helpers.entity_platform import AddEntitiesCallback
from homeassistant.util import slugify
from homeassistant.util.percentage import ranged_value_to_percentage

from .device import ElroConnectsEntity, ElroConnectsK1
Expand All @@ -38,16 +40,16 @@ class ElroSensorDescription(SensorEntityDescription):
SENSOR_TYPES = {
ATTR_BATTERY_LEVEL: ElroSensorDescription(
key=ATTR_BATTERY_LEVEL,
translation_key=ATTR_BATTERY_LEVEL,
device_class="battery",
translation_key="battery",
device_class=SensorDeviceClass.BATTERY,
state_class=SensorStateClass.MEASUREMENT,
native_unit_of_measurement=PERCENTAGE,
maximum_value=100,
),
ATTR_SIGNAL: ElroSensorDescription(
key=ATTR_SIGNAL,
translation_key=ATTR_SIGNAL,
device_class="power_factor",
translation_key="signal",
device_class=SensorDeviceClass.POWER_FACTOR,
state_class=SensorStateClass.MEASUREMENT,
native_unit_of_measurement=PERCENTAGE,
icon="mdi:signal",
Expand All @@ -56,7 +58,8 @@ class ElroSensorDescription(SensorEntityDescription):
),
ATTR_DEVICE_STATE: ElroSensorDescription(
key=ATTR_DEVICE_STATE,
translation_key=ATTR_DEVICE_STATE,
translation_key="device_state",
device_class=SensorDeviceClass.ENUM,
icon="mdi:state-machine",
maximum_value=None,
),
Expand Down Expand Up @@ -115,5 +118,5 @@ def native_value(self) -> int | float | None:
if max_value := self.entity_description.maximum_value:
value = ranged_value_to_percentage((1, max_value), raw_value)
else:
value = raw_value
value = slugify(raw_value)
return value if max_value is None or raw_value <= max_value else None
16 changes: 8 additions & 8 deletions custom_components/elro_connects/strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,14 @@
"device_state": {
"name": "Device state",
"state": {
"NORMAL": "Normal",
"ALARM": "Alarm",
"FIRE ALARM": "Fire alarm",
"TEST ALARM": "Test alarm",
"FAULT": "Fault",
"SILENCE": "Silence",
"UNKNOWN": "Unknown",
"OFFLINE": "Offline"
"normal": "Normal",
"alarm": "Alarm",
"fire_alarm": "Fire alarm",
"test_alarm": "Test alarm",
"fault": "Fault",
"silence": "Silence",
"unknown": "Unknown",
"offline": "Offline"
}
},
"battery": {
Expand Down
16 changes: 8 additions & 8 deletions custom_components/elro_connects/translations/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,14 @@
"device_state": {
"name": "Device state",
"state": {
"NORMAL": "Normal",
"ALARM": "Alarm",
"FIRE ALARM": "Feueralarm",
"TEST ALARM": "Testalarm",
"FAULT": "Fehler",
"SILENCE": "Stille",
"UNKNOWN": "Unbekannt",
"OFFLINE": "Offline"
"normal": "Normal",
"alarm": "Alarm",
"fire_alarm": "Feueralarm",
"test_alarm": "Testalarm",
"fault": "Fehler",
"silence": "Stille",
"unknown": "Unbekannt",
"offline": "Offline"
}
},
"battery": {
Expand Down
16 changes: 8 additions & 8 deletions custom_components/elro_connects/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,14 @@
"device_state": {
"name": "Device state",
"state": {
"NORMAL": "Normal",
"ALARM": "Alarm",
"FIRE ALARM": "Fire alarm",
"TEST ALARM": "Test alarm",
"FAULT": "Fault",
"SILENCE": "Silence",
"UNKNOWN": "Unknown",
"OFFLINE": "Offline"
"normal": "Normal",
"alarm": "Alarm",
"fire_alarm": "Fire alarm",
"test_alarm": "Test alarm",
"fault": "Fault",
"silence": "Silence",
"unknown": "Unknown",
"offline": "Offline"
}
},
"battery": {
Expand Down
16 changes: 8 additions & 8 deletions custom_components/elro_connects/translations/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,14 @@
"device_state": {
"name": "Device state",
"state": {
"NORMAL": "Normal",
"ALARM": "Alarma",
"FIRE ALARM": "Alarma de incendio",
"TEST ALARM": "Prueba de alarma",
"FAULT": "Falla",
"SILENCE": "Silencio",
"UNKNOWN": "Desconocido",
"OFFLINE": "Sin conexión"
"normal": "Normal",
"alarm": "Alarma",
"fire_alarm": "Alarma de incendio",
"test_alarm": "Prueba de alarma",
"fault": "Falla",
"silence": "Silencio",
"unknown": "Desconocido",
"offline": "Sin conexión"
}
},
"battery": {
Expand Down
16 changes: 8 additions & 8 deletions custom_components/elro_connects/translations/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,14 @@
"device_state": {
"name": "Device state",
"state": {
"NORMAL": "Normal",
"ALARM": "Alarme",
"FIRE ALARM": "Alarme incendie",
"TEST ALARM": "Tester l'alarme",
"FAULT": "Défaut",
"SILENCE": "Silence",
"UNKNOWN": "Inconnu",
"OFFLINE": "Hors ligne"
"normal": "Normal",
"alarm": "Alarme",
"fire_alarm": "Alarme incendie",
"test_alarm": "Tester l'alarme",
"fault": "Défaut",
"silence": "Silence",
"unknown": "Inconnu",
"offline": "Hors ligne"
}
},
"battery": {
Expand Down
16 changes: 8 additions & 8 deletions custom_components/elro_connects/translations/nl.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,14 @@
"device_state": {
"name": "Status",
"state": {
"NORMAL": "Normaal",
"ALARM": "Alarm",
"FIRE ALARM": "Brandalarm",
"TEST ALARM": "Testalarm",
"FAULT": "Fout",
"SILENCE": "Stilte",
"UNKNOWN": "Onbekend",
"OFFLINE": "Offline"
"normal": "Normaal",
"alarm": "Alarm",
"fire_alarm": "Brandalarm",
"test_alarm": "Testalarm",
"fault": "Fout",
"silence": "Stilte",
"unknown": "Onbekend",
"offline": "Offline"
}
},
"battery": {
Expand Down
16 changes: 8 additions & 8 deletions custom_components/elro_connects/translations/pt.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,14 @@
"device_state": {
"name": "Device state",
"state": {
"NORMAL": "Normal",
"ALARM": "Alarme",
"FIRE ALARM": "Alarme de incêndio",
"TEST ALARM": "Testar alarme",
"FAULT": "Falha",
"SILENCE": "Silêncio",
"UNKNOWN": "Desconhecido",
"OFFLINE": "Offline"
"normal": "Normal",
"alarm": "Alarme",
"fire_alarm": "Alarme de incêndio",
"test_alarm": "Testar alarme",
"fault": "Falha",
"silence": "Silêncio",
"unknown": "Desconhecido",
"offline": "Offline"
}
},
"battery": {
Expand Down
16 changes: 8 additions & 8 deletions custom_components/elro_connects/translations/uk.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,14 @@
"device_state": {
"name": "Device state",
"state": {
"NORMAL": "Звичайний",
"ALARM": "Будильник",
"FIRE ALARM": "Пожежна тривога",
"TEST ALARM": "Тестовий тривога",
"FAULT": "Несправність",
"SILENCE": "Тиша",
"UNKNOWN": "Невідомо",
"OFFLINE": "Офлайн"
"normal": "Звичайний",
"alarm": "Будильник",
"fire_alarm": "Пожежна тривога",
"test_alarm": "Тестовий тривога",
"fault": "Несправність",
"silence": "Тиша",
"unknown": "Невідомо",
"offline": "Офлайн"
}
},
"battery": {
Expand Down
16 changes: 8 additions & 8 deletions info.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ Platform | Description
`siren` | Represents Elro Connects alarms as a siren. Turn the siren `ON` to test it. Turn it `OFF` to silence the (test) alarm.

The `device_state` sensor can have of the following states:
- `FAULT`
- `SILENCE`
- `TEST ALARM`
- `FIRE ALARM`
- `ALARM`
- `NORMAL`
- `UNKNOWN`
- `OFFLINE`
- `fault`
- `silence`
- `test_alarm`
- `fire_alarm`
- `alarm`
- `normal`
- `unknown`
- `offline`

Note that the sensors are polled about every 15 seconds. So it might take some time before an alarm state will be propagated. If an unknown state is found that is not supported yet, the hexadecimal code will be assigned as state. Please open an issue [here](https://github.com/jbouwh/lib-elro-connects/issues/new) if a new state needs to be supported.

Expand Down
2 changes: 1 addition & 1 deletion version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.2.0
0.2.1
Loading