Skip to content

Commit 66bd9d6

Browse files
committed
mappings for 4 main stat boxes
1 parent 6de9285 commit 66bd9d6

21 files changed

Lines changed: 135 additions & 136 deletions

README.md

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -254,23 +254,23 @@ If you're unsure what your AdGuard device ID is, here are several ways to find i
254254

255255
## Configuration Options
256256

257-
| Name | Type | Default | Description |
258-
| ------------------ | --------------- | ------------ | ------------------------------------------------------------------ |
259-
| device_id | string or array | **Required** | The ID(s) of your AdGuard device(s) in Home Assistant |
260-
| title | string | AdGuard | Custom title for the card header |
257+
| Name | Type | Default | Description |
258+
| ------------------ | --------------- | ---------------- | ------------------------------------------------------------------ |
259+
| device_id | string or array | **Required** | The ID(s) of your AdGuard device(s) in Home Assistant |
260+
| title | string | AdGuard | Custom title for the card header |
261261
| icon | string | mdi:shield-check | Custom icon for the card header |
262-
| badge | object | _none_ | Configure actions for the card icon/badge |
263-
| pause_durations | array | [60,300,900] | Durations for pause buttons (supports numbers, strings with units) |
264-
| stats | object | _none_ | Configure actions for statistics tiles |
265-
| info | object | _none_ | Configure actions for additional info items |
266-
| controls | object | _none_ | Configure actions for control buttons |
267-
| exclude_sections | list | _none_ | Sections of entities to exclude. See below. |
268-
| exclude_entities | list | _none_ | Entities to remove from the card. |
269-
| entity_order | list | _none_ | Custom order for switch, button, sensor entities or dividers. |
270-
| collapsed_sections | list | _none_ | Sections to be initially collapsed. See below. |
271-
| switch_spacing | string | flex | Layout style for switches: flex, space-around, space-between |
272-
| chart | object | _none_ | Chart configuration options. See below. |
273-
| features | list | See below | Optional flags to toggle different features |
262+
| badge | object | _none_ | Configure actions for the card icon/badge |
263+
| pause_durations | array | [60,300,900] | Durations for pause buttons (supports numbers, strings with units) |
264+
| stats | object | _none_ | Configure actions for statistics tiles |
265+
| info | object | _none_ | Configure actions for additional info items |
266+
| controls | object | _none_ | Configure actions for control buttons |
267+
| exclude_sections | list | _none_ | Sections of entities to exclude. See below. |
268+
| exclude_entities | list | _none_ | Entities to remove from the card. |
269+
| entity_order | list | _none_ | Custom order for switch, button, sensor entities or dividers. |
270+
| collapsed_sections | list | _none_ | Sections to be initially collapsed. See below. |
271+
| switch_spacing | string | flex | Layout style for switches: flex, space-around, space-between |
272+
| chart | object | _none_ | Chart configuration options. See below. |
273+
| features | list | See below | Optional flags to toggle different features |
274274

275275
### Action Configuration
276276

@@ -576,8 +576,8 @@ device_id: adguard_device_1
576576
switch_spacing: 'space-around'
577577
entity_order:
578578
- button.adguard_action_refresh_data
579-
- sensor.adguard_dns_queries_today
580-
- sensor.adguard_ads_blocked_today
579+
- sensor.adguard_dns_queries
580+
- sensor.adguard_dns_queries_blocked
581581
- switch.adguard
582582
```
583583

@@ -589,8 +589,8 @@ device_id: adguard_device_1
589589
entity_order:
590590
- button.adguard_action_refresh_data
591591
- divider
592-
- sensor.adguard_dns_queries_today
593-
- sensor.adguard_ads_blocked_today
592+
- sensor.adguard_dns_queries
593+
- sensor.adguard_dns_queries_blocked
594594
- divider
595595
- switch.adguard
596596
```

src/common/get-stats.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export const getDashboardStats = (
1010
): DashboardStatConfig[][] => [
1111
[
1212
{
13-
sensorKey: 'dns_queries_today',
13+
sensorKey: 'dns_queries',
1414
title: 'card.stats.total_queries',
1515
footer: {
1616
key: 'card.stats.active_clients',
@@ -21,7 +21,7 @@ export const getDashboardStats = (
2121
icon: 'mdi:earth',
2222
},
2323
{
24-
sensorKey: 'ads_blocked_today',
24+
sensorKey: 'dns_queries_blocked',
2525
title: 'card.stats.queries_blocked',
2626
footer: 'card.stats.list_blocked_queries',
2727
className: 'blocked-box',
@@ -30,18 +30,18 @@ export const getDashboardStats = (
3030
],
3131
[
3232
{
33-
sensorKey: 'ads_percentage_blocked_today',
33+
sensorKey: 'dns_queries_blocked_ratio',
3434
title: 'card.stats.percentage_blocked',
3535
footer: 'card.stats.list_all_queries',
3636
className: 'percentage-box',
3737
icon: 'mdi:chart-pie',
3838
},
3939
{
40-
sensorKey: 'domains_blocked',
41-
title: 'card.stats.domains_on_lists',
42-
footer: 'card.stats.manage_lists',
40+
sensorKey: 'average_processing_speed',
41+
title: 'card.stats.average_processing_speed',
42+
footer: 'card.stats.processing_speed_info',
4343
className: 'domains-box',
44-
icon: 'mdi:format-list-bulleted',
44+
icon: 'mdi:speedometer',
4545
},
4646
],
4747
];

src/common/map-entities.ts

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { EntityInformation, AdGuardDevice } from '@type/types';
1+
import type { AdGuardDevice, EntityInformation } from '@type/types';
22

33
/**
44
* Maps entities to the AdGuard device object based on their translation keys.
@@ -11,10 +11,12 @@ export const mapEntitiesByTranslationKey = (
1111
device: AdGuardDevice,
1212
) => {
1313
const keyToPropertyMap = {
14-
dns_queries_today: 'dns_queries_today',
15-
domains_blocked: 'domains_blocked',
16-
ads_percentage_blocked_today: 'ads_percentage_blocked_today',
17-
ads_blocked_today: 'ads_blocked_today',
14+
dns_queries: 'dns_queries',
15+
dns_queries_blocked: 'dns_queries_blocked',
16+
dns_queries_blocked_ratio: 'dns_queries_blocked_ratio',
17+
average_processing_speed: 'average_processing_speed',
18+
19+
// not vetted yet
1820
dns_unique_clients: 'dns_unique_clients',
1921
remaining_until_blocking_mode: 'remaining_until_blocking_mode',
2022
action_refresh_data: 'action_refresh_data',
@@ -24,11 +26,11 @@ export const mapEntitiesByTranslationKey = (
2426
action_ftl_purge_diagnosis_messages: 'purge_diagnosis_messages',
2527

2628
// backwards compatibility for HA integration
27-
dns_queries: 'dns_queries_today',
28-
ads_blocked: 'ads_blocked_today',
29-
percent_ads_blocked: 'ads_percentage_blocked_today',
30-
ads_percentage_today: 'ads_percentage_blocked_today',
31-
domains_being_blocked: 'domains_blocked',
29+
// dns_queries: 'dns_queries',
30+
// ads_blocked: 'dns_queries_blocked',
31+
// percent_ads_blocked: 'dns_queries_blocked_ratio',
32+
// ads_percentage_today: 'dns_queries_blocked_ratio',
33+
// domains_being_blocked: 'domains_blocked',
3234
};
3335

3436
const key = entity.translation_key;

src/translations/bg.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
"list_blocked_queries": "Списък с блокирани заявки",
88
"percentage_blocked": "Процент блокирани",
99
"list_all_queries": "Списък с всички заявки",
10-
"domains_on_lists": "Списък с домейни",
11-
"manage_lists": "Управление на списъци"
10+
"average_processing_speed": "Средна Скорост на Обработка",
11+
"processing_speed_info": "Средно време за обработка на заявки"
1212
},
1313
"sections": {
1414
"pause": "Пауза на блокирането на реклами",

src/translations/de.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
"list_blocked_queries": "Blockierte Anfragen anzeigen",
88
"percentage_blocked": "Prozentual blockiert",
99
"list_all_queries": "Alle Anfragen anzeigen",
10-
"domains_on_lists": "Domains auf Listen",
11-
"manage_lists": "Listen verwalten"
10+
"average_processing_speed": "Durchschnittliche Verarbeitungsgeschwindigkeit",
11+
"processing_speed_info": "Durchschnittliche Abfrageverarbeitungszeit"
1212
},
1313
"sections": {
1414
"pause": "Werbeblockierung pausieren",

src/translations/el.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
"list_blocked_queries": "Λίστα αποκλεισμένων ερωτημάτων",
88
"percentage_blocked": "Ποσοστό που αποκλείστηκε",
99
"list_all_queries": "Λίστα όλων των ερωτημάτων",
10-
"domains_on_lists": "Τομείς στις Λίστες",
11-
"manage_lists": "Διαχείριση Λιστών"
10+
"average_processing_speed": "Μέση Ταχύτητα Επεξεργασίας",
11+
"processing_speed_info": "Μέσος χρόνος επεξεργασίας ερωτημάτων"
1212
},
1313
"sections": {
1414
"pause": "Παύση Αποκλεισμού Διαφημίσεων",

src/translations/en.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
"list_blocked_queries": "List blocked queries",
88
"percentage_blocked": "Percentage Blocked",
99
"list_all_queries": "List all queries",
10-
"domains_on_lists": "Domains on Lists",
11-
"manage_lists": "Manage lists"
10+
"average_processing_speed": "Average Processing Speed",
11+
"processing_speed_info": "Average query processing time"
1212
},
1313
"sections": {
1414
"pause": "Pause Ad-Blocking",

src/translations/es.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
"list_blocked_queries": "Listar peticiones bloqueadas",
88
"percentage_blocked": "Porcentaje bloqueos",
99
"list_all_queries": "Listar todas las peticiones",
10-
"domains_on_lists": "Dominios bloqueados",
11-
"manage_lists": "Gestionar listas"
10+
"average_processing_speed": "Velocidad de Procesamiento Promedio",
11+
"processing_speed_info": "Tiempo promedio de procesamiento de consultas"
1212
},
1313
"sections": {
1414
"pause": "Pausar Bloqueo de Anuncios",

src/translations/fr.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
"list_blocked_queries": "Liste des requêtes bloquées",
88
"percentage_blocked": "Pourcentage bloqué",
99
"list_all_queries": "Liste de toutes les requêtes",
10-
"domains_on_lists": "Domaines listés",
11-
"manage_lists": "Gérer les listes"
10+
"average_processing_speed": "Vitesse de Traitement Moyenne",
11+
"processing_speed_info": "Temps moyen de traitement des requêtes"
1212
},
1313
"sections": {
1414
"pause": "Pause du bloqueur de pubs",

src/translations/it.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
"list_blocked_queries": "Elenco richieste bloccate",
88
"percentage_blocked": "Percentuale bloccate",
99
"list_all_queries": "Elenca tutte le richieste",
10-
"domains_on_lists": "Domini in elenco",
11-
"manage_lists": "Gestisci le liste"
10+
"average_processing_speed": "Velocità di Elaborazione Media",
11+
"processing_speed_info": "Tempo medio di elaborazione delle richieste"
1212
},
1313
"sections": {
1414
"pause": "Metti in pausa gli Ad-Blocking",

0 commit comments

Comments
 (0)