Skip to content

Commit

Permalink
Add unit translations for NextDNS integration (#131281)
Browse files Browse the repository at this point in the history
* Add unit translations for NextDNS integration

* Use translation keys
  • Loading branch information
bieniu authored Nov 23, 2024
1 parent ea4bbfe commit 50013cf
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 60 deletions.
15 changes: 0 additions & 15 deletions homeassistant/components/nextdns/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ class NextDnsSensorEntityDescription(
coordinator_type=ATTR_STATUS,
entity_category=EntityCategory.DIAGNOSTIC,
translation_key="all_queries",
native_unit_of_measurement="queries",
state_class=SensorStateClass.TOTAL,
value=lambda data: data.all_queries,
),
Expand All @@ -63,7 +62,6 @@ class NextDnsSensorEntityDescription(
coordinator_type=ATTR_STATUS,
entity_category=EntityCategory.DIAGNOSTIC,
translation_key="blocked_queries",
native_unit_of_measurement="queries",
state_class=SensorStateClass.TOTAL,
value=lambda data: data.blocked_queries,
),
Expand All @@ -72,7 +70,6 @@ class NextDnsSensorEntityDescription(
coordinator_type=ATTR_STATUS,
entity_category=EntityCategory.DIAGNOSTIC,
translation_key="relayed_queries",
native_unit_of_measurement="queries",
state_class=SensorStateClass.TOTAL,
value=lambda data: data.relayed_queries,
),
Expand All @@ -91,7 +88,6 @@ class NextDnsSensorEntityDescription(
entity_category=EntityCategory.DIAGNOSTIC,
entity_registry_enabled_default=False,
translation_key="doh_queries",
native_unit_of_measurement="queries",
state_class=SensorStateClass.TOTAL,
value=lambda data: data.doh_queries,
),
Expand All @@ -101,7 +97,6 @@ class NextDnsSensorEntityDescription(
entity_category=EntityCategory.DIAGNOSTIC,
entity_registry_enabled_default=False,
translation_key="doh3_queries",
native_unit_of_measurement="queries",
state_class=SensorStateClass.TOTAL,
value=lambda data: data.doh3_queries,
),
Expand All @@ -111,7 +106,6 @@ class NextDnsSensorEntityDescription(
entity_category=EntityCategory.DIAGNOSTIC,
entity_registry_enabled_default=False,
translation_key="dot_queries",
native_unit_of_measurement="queries",
state_class=SensorStateClass.TOTAL,
value=lambda data: data.dot_queries,
),
Expand All @@ -121,7 +115,6 @@ class NextDnsSensorEntityDescription(
entity_category=EntityCategory.DIAGNOSTIC,
entity_registry_enabled_default=False,
translation_key="doq_queries",
native_unit_of_measurement="queries",
state_class=SensorStateClass.TOTAL,
value=lambda data: data.doq_queries,
),
Expand All @@ -131,7 +124,6 @@ class NextDnsSensorEntityDescription(
entity_category=EntityCategory.DIAGNOSTIC,
entity_registry_enabled_default=False,
translation_key="tcp_queries",
native_unit_of_measurement="queries",
state_class=SensorStateClass.TOTAL,
value=lambda data: data.tcp_queries,
),
Expand All @@ -141,7 +133,6 @@ class NextDnsSensorEntityDescription(
entity_category=EntityCategory.DIAGNOSTIC,
entity_registry_enabled_default=False,
translation_key="udp_queries",
native_unit_of_measurement="queries",
state_class=SensorStateClass.TOTAL,
value=lambda data: data.udp_queries,
),
Expand Down Expand Up @@ -211,7 +202,6 @@ class NextDnsSensorEntityDescription(
entity_category=EntityCategory.DIAGNOSTIC,
entity_registry_enabled_default=False,
translation_key="encrypted_queries",
native_unit_of_measurement="queries",
state_class=SensorStateClass.TOTAL,
value=lambda data: data.encrypted_queries,
),
Expand All @@ -221,7 +211,6 @@ class NextDnsSensorEntityDescription(
entity_category=EntityCategory.DIAGNOSTIC,
entity_registry_enabled_default=False,
translation_key="unencrypted_queries",
native_unit_of_measurement="queries",
state_class=SensorStateClass.TOTAL,
value=lambda data: data.unencrypted_queries,
),
Expand All @@ -241,7 +230,6 @@ class NextDnsSensorEntityDescription(
entity_category=EntityCategory.DIAGNOSTIC,
entity_registry_enabled_default=False,
translation_key="ipv4_queries",
native_unit_of_measurement="queries",
state_class=SensorStateClass.TOTAL,
value=lambda data: data.ipv4_queries,
),
Expand All @@ -251,7 +239,6 @@ class NextDnsSensorEntityDescription(
entity_category=EntityCategory.DIAGNOSTIC,
entity_registry_enabled_default=False,
translation_key="ipv6_queries",
native_unit_of_measurement="queries",
state_class=SensorStateClass.TOTAL,
value=lambda data: data.ipv6_queries,
),
Expand All @@ -271,7 +258,6 @@ class NextDnsSensorEntityDescription(
entity_category=EntityCategory.DIAGNOSTIC,
entity_registry_enabled_default=False,
translation_key="validated_queries",
native_unit_of_measurement="queries",
state_class=SensorStateClass.TOTAL,
value=lambda data: data.validated_queries,
),
Expand All @@ -281,7 +267,6 @@ class NextDnsSensorEntityDescription(
entity_category=EntityCategory.DIAGNOSTIC,
entity_registry_enabled_default=False,
translation_key="not_validated_queries",
native_unit_of_measurement="queries",
state_class=SensorStateClass.TOTAL,
value=lambda data: data.not_validated_queries,
),
Expand Down
45 changes: 30 additions & 15 deletions homeassistant/components/nextdns/strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,76 +48,91 @@
},
"sensor": {
"all_queries": {
"name": "DNS queries"
"name": "DNS queries",
"unit_of_measurement": "queries"
},
"blocked_queries": {
"name": "DNS queries blocked"
"name": "DNS queries blocked",
"unit_of_measurement": "[%key:component::nextdns::entity::sensor::all_queries::unit_of_measurement%]"
},
"blocked_queries_ratio": {
"name": "DNS queries blocked ratio"
},
"doh3_queries": {
"name": "DNS-over-HTTP/3 queries"
"name": "DNS-over-HTTP/3 queries",
"unit_of_measurement": "[%key:component::nextdns::entity::sensor::all_queries::unit_of_measurement%]"
},
"doh3_queries_ratio": {
"name": "DNS-over-HTTP/3 queries ratio"
},
"doh_queries": {
"name": "DNS-over-HTTPS queries"
"name": "DNS-over-HTTPS queries",
"unit_of_measurement": "[%key:component::nextdns::entity::sensor::all_queries::unit_of_measurement%]"
},
"doh_queries_ratio": {
"name": "DNS-over-HTTPS queries ratio"
},
"doq_queries": {
"name": "DNS-over-QUIC queries"
"name": "DNS-over-QUIC queries",
"unit_of_measurement": "[%key:component::nextdns::entity::sensor::all_queries::unit_of_measurement%]"
},
"doq_queries_ratio": {
"name": "DNS-over-QUIC queries ratio"
},
"dot_queries": {
"name": "DNS-over-TLS queries"
"name": "DNS-over-TLS queries",
"unit_of_measurement": "[%key:component::nextdns::entity::sensor::all_queries::unit_of_measurement%]"
},
"dot_queries_ratio": {
"name": "DNS-over-TLS queries ratio"
},
"encrypted_queries": {
"name": "Encrypted queries"
"name": "Encrypted queries",
"unit_of_measurement": "[%key:component::nextdns::entity::sensor::all_queries::unit_of_measurement%]"
},
"encrypted_queries_ratio": {
"name": "Encrypted queries ratio"
},
"ipv4_queries": {
"name": "IPv4 queries"
"name": "IPv4 queries",
"unit_of_measurement": "[%key:component::nextdns::entity::sensor::all_queries::unit_of_measurement%]"
},
"ipv6_queries": {
"name": "IPv6 queries"
"name": "IPv6 queries",
"unit_of_measurement": "[%key:component::nextdns::entity::sensor::all_queries::unit_of_measurement%]"
},
"ipv6_queries_ratio": {
"name": "IPv6 queries ratio"
},
"not_validated_queries": {
"name": "DNSSEC not validated queries"
"name": "DNSSEC not validated queries",
"unit_of_measurement": "[%key:component::nextdns::entity::sensor::all_queries::unit_of_measurement%]"
},
"relayed_queries": {
"name": "DNS queries relayed"
"name": "DNS queries relayed",
"unit_of_measurement": "[%key:component::nextdns::entity::sensor::all_queries::unit_of_measurement%]"
},
"tcp_queries": {
"name": "TCP queries"
"name": "TCP queries",
"unit_of_measurement": "[%key:component::nextdns::entity::sensor::all_queries::unit_of_measurement%]"
},
"tcp_queries_ratio": {
"name": "TCP queries ratio"
},
"udp_queries": {
"name": "UDP queries"
"name": "UDP queries",
"unit_of_measurement": "[%key:component::nextdns::entity::sensor::all_queries::unit_of_measurement%]"
},
"udp_queries_ratio": {
"name": "UDP queries ratio"
},
"unencrypted_queries": {
"name": "Unencrypted queries"
"name": "Unencrypted queries",
"unit_of_measurement": "[%key:component::nextdns::entity::sensor::all_queries::unit_of_measurement%]"
},
"validated_queries": {
"name": "DNSSEC validated queries"
"name": "DNSSEC validated queries",
"unit_of_measurement": "[%key:component::nextdns::entity::sensor::all_queries::unit_of_measurement%]"
},
"validated_queries_ratio": {
"name": "DNSSEC validated queries ratio"
Expand Down
Loading

0 comments on commit 50013cf

Please sign in to comment.