Address late review for NextDNS entity name translations (#90771)
This commit is contained in:
parent
b66a99fe8a
commit
2f22613cf9
3 changed files with 13 additions and 23 deletions
|
@ -43,14 +43,14 @@ SENSORS = (
|
||||||
NextDnsBinarySensorEntityDescription[ConnectionStatus](
|
NextDnsBinarySensorEntityDescription[ConnectionStatus](
|
||||||
key="this_device_nextdns_connection_status",
|
key="this_device_nextdns_connection_status",
|
||||||
entity_category=EntityCategory.DIAGNOSTIC,
|
entity_category=EntityCategory.DIAGNOSTIC,
|
||||||
translation_key="this_device_nextdns_connection_status",
|
translation_key="device_connection_status",
|
||||||
device_class=BinarySensorDeviceClass.CONNECTIVITY,
|
device_class=BinarySensorDeviceClass.CONNECTIVITY,
|
||||||
state=lambda data, _: data.connected,
|
state=lambda data, _: data.connected,
|
||||||
),
|
),
|
||||||
NextDnsBinarySensorEntityDescription[ConnectionStatus](
|
NextDnsBinarySensorEntityDescription[ConnectionStatus](
|
||||||
key="this_device_profile_connection_status",
|
key="this_device_profile_connection_status",
|
||||||
entity_category=EntityCategory.DIAGNOSTIC,
|
entity_category=EntityCategory.DIAGNOSTIC,
|
||||||
translation_key="this_device_profile_connection_status",
|
translation_key="device_profile_connection_status",
|
||||||
device_class=BinarySensorDeviceClass.CONNECTIVITY,
|
device_class=BinarySensorDeviceClass.CONNECTIVITY,
|
||||||
state=lambda data, profile_id: profile_id == data.profile_id,
|
state=lambda data, profile_id: profile_id == data.profile_id,
|
||||||
),
|
),
|
||||||
|
|
|
@ -28,11 +28,11 @@
|
||||||
},
|
},
|
||||||
"entity": {
|
"entity": {
|
||||||
"binary_sensor": {
|
"binary_sensor": {
|
||||||
"this_device_nextdns_connection_status": {
|
"device_connection_status": {
|
||||||
"name": "This device NextDNS connection status"
|
"name": "Device connection status"
|
||||||
},
|
},
|
||||||
"this_device_profile_connection_status": {
|
"device_profile_connection_status": {
|
||||||
"name": "This device profile connection status"
|
"name": "Device profile connection status"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"button": {
|
"button": {
|
||||||
|
|
|
@ -20,26 +20,22 @@ async def test_binary_Sensor(hass: HomeAssistant) -> None:
|
||||||
|
|
||||||
await init_integration(hass)
|
await init_integration(hass)
|
||||||
|
|
||||||
state = hass.states.get(
|
state = hass.states.get("binary_sensor.fake_profile_device_connection_status")
|
||||||
"binary_sensor.fake_profile_this_device_nextdns_connection_status"
|
|
||||||
)
|
|
||||||
assert state
|
assert state
|
||||||
assert state.state == STATE_ON
|
assert state.state == STATE_ON
|
||||||
|
|
||||||
entry = registry.async_get(
|
entry = registry.async_get("binary_sensor.fake_profile_device_connection_status")
|
||||||
"binary_sensor.fake_profile_this_device_nextdns_connection_status"
|
|
||||||
)
|
|
||||||
assert entry
|
assert entry
|
||||||
assert entry.unique_id == "xyz12_this_device_nextdns_connection_status"
|
assert entry.unique_id == "xyz12_this_device_nextdns_connection_status"
|
||||||
|
|
||||||
state = hass.states.get(
|
state = hass.states.get(
|
||||||
"binary_sensor.fake_profile_this_device_profile_connection_status"
|
"binary_sensor.fake_profile_device_profile_connection_status"
|
||||||
)
|
)
|
||||||
assert state
|
assert state
|
||||||
assert state.state == STATE_OFF
|
assert state.state == STATE_OFF
|
||||||
|
|
||||||
entry = registry.async_get(
|
entry = registry.async_get(
|
||||||
"binary_sensor.fake_profile_this_device_profile_connection_status"
|
"binary_sensor.fake_profile_device_profile_connection_status"
|
||||||
)
|
)
|
||||||
assert entry
|
assert entry
|
||||||
assert entry.unique_id == "xyz12_this_device_profile_connection_status"
|
assert entry.unique_id == "xyz12_this_device_profile_connection_status"
|
||||||
|
@ -49,9 +45,7 @@ async def test_availability(hass: HomeAssistant) -> None:
|
||||||
"""Ensure that we mark the entities unavailable correctly when service causes an error."""
|
"""Ensure that we mark the entities unavailable correctly when service causes an error."""
|
||||||
await init_integration(hass)
|
await init_integration(hass)
|
||||||
|
|
||||||
state = hass.states.get(
|
state = hass.states.get("binary_sensor.fake_profile_device_connection_status")
|
||||||
"binary_sensor.fake_profile_this_device_nextdns_connection_status"
|
|
||||||
)
|
|
||||||
assert state
|
assert state
|
||||||
assert state.state != STATE_UNAVAILABLE
|
assert state.state != STATE_UNAVAILABLE
|
||||||
assert state.state == STATE_ON
|
assert state.state == STATE_ON
|
||||||
|
@ -64,9 +58,7 @@ async def test_availability(hass: HomeAssistant) -> None:
|
||||||
async_fire_time_changed(hass, future)
|
async_fire_time_changed(hass, future)
|
||||||
await hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
|
|
||||||
state = hass.states.get(
|
state = hass.states.get("binary_sensor.fake_profile_device_connection_status")
|
||||||
"binary_sensor.fake_profile_this_device_nextdns_connection_status"
|
|
||||||
)
|
|
||||||
assert state
|
assert state
|
||||||
assert state.state == STATE_UNAVAILABLE
|
assert state.state == STATE_UNAVAILABLE
|
||||||
|
|
||||||
|
@ -78,9 +70,7 @@ async def test_availability(hass: HomeAssistant) -> None:
|
||||||
async_fire_time_changed(hass, future)
|
async_fire_time_changed(hass, future)
|
||||||
await hass.async_block_till_done()
|
await hass.async_block_till_done()
|
||||||
|
|
||||||
state = hass.states.get(
|
state = hass.states.get("binary_sensor.fake_profile_device_connection_status")
|
||||||
"binary_sensor.fake_profile_this_device_nextdns_connection_status"
|
|
||||||
)
|
|
||||||
assert state
|
assert state
|
||||||
assert state.state != STATE_UNAVAILABLE
|
assert state.state != STATE_UNAVAILABLE
|
||||||
assert state.state == STATE_ON
|
assert state.state == STATE_ON
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue