mirror of
https://github.com/home-assistant/core.git
synced 2025-07-28 15:47:12 +00:00
Z-Wave JS: Simplify strings for RSSI sensors (#148936)
This commit is contained in:
parent
17920b6ec3
commit
a96e38871f
@ -421,7 +421,7 @@ ENTITY_DESCRIPTION_CONTROLLER_STATISTICS_LIST = [
|
|||||||
),
|
),
|
||||||
ZWaveJSStatisticsSensorEntityDescription(
|
ZWaveJSStatisticsSensorEntityDescription(
|
||||||
key="background_rssi.channel_0.average",
|
key="background_rssi.channel_0.average",
|
||||||
translation_key="average_background_rssi",
|
translation_key="avg_signal_noise",
|
||||||
translation_placeholders={"channel": "0"},
|
translation_placeholders={"channel": "0"},
|
||||||
native_unit_of_measurement=SIGNAL_STRENGTH_DECIBELS_MILLIWATT,
|
native_unit_of_measurement=SIGNAL_STRENGTH_DECIBELS_MILLIWATT,
|
||||||
device_class=SensorDeviceClass.SIGNAL_STRENGTH,
|
device_class=SensorDeviceClass.SIGNAL_STRENGTH,
|
||||||
@ -429,7 +429,7 @@ ENTITY_DESCRIPTION_CONTROLLER_STATISTICS_LIST = [
|
|||||||
),
|
),
|
||||||
ZWaveJSStatisticsSensorEntityDescription(
|
ZWaveJSStatisticsSensorEntityDescription(
|
||||||
key="background_rssi.channel_0.current",
|
key="background_rssi.channel_0.current",
|
||||||
translation_key="current_background_rssi",
|
translation_key="signal_noise",
|
||||||
translation_placeholders={"channel": "0"},
|
translation_placeholders={"channel": "0"},
|
||||||
native_unit_of_measurement=SIGNAL_STRENGTH_DECIBELS_MILLIWATT,
|
native_unit_of_measurement=SIGNAL_STRENGTH_DECIBELS_MILLIWATT,
|
||||||
device_class=SensorDeviceClass.SIGNAL_STRENGTH,
|
device_class=SensorDeviceClass.SIGNAL_STRENGTH,
|
||||||
@ -438,7 +438,7 @@ ENTITY_DESCRIPTION_CONTROLLER_STATISTICS_LIST = [
|
|||||||
),
|
),
|
||||||
ZWaveJSStatisticsSensorEntityDescription(
|
ZWaveJSStatisticsSensorEntityDescription(
|
||||||
key="background_rssi.channel_1.average",
|
key="background_rssi.channel_1.average",
|
||||||
translation_key="average_background_rssi",
|
translation_key="avg_signal_noise",
|
||||||
translation_placeholders={"channel": "1"},
|
translation_placeholders={"channel": "1"},
|
||||||
native_unit_of_measurement=SIGNAL_STRENGTH_DECIBELS_MILLIWATT,
|
native_unit_of_measurement=SIGNAL_STRENGTH_DECIBELS_MILLIWATT,
|
||||||
device_class=SensorDeviceClass.SIGNAL_STRENGTH,
|
device_class=SensorDeviceClass.SIGNAL_STRENGTH,
|
||||||
@ -446,7 +446,7 @@ ENTITY_DESCRIPTION_CONTROLLER_STATISTICS_LIST = [
|
|||||||
),
|
),
|
||||||
ZWaveJSStatisticsSensorEntityDescription(
|
ZWaveJSStatisticsSensorEntityDescription(
|
||||||
key="background_rssi.channel_1.current",
|
key="background_rssi.channel_1.current",
|
||||||
translation_key="current_background_rssi",
|
translation_key="signal_noise",
|
||||||
translation_placeholders={"channel": "1"},
|
translation_placeholders={"channel": "1"},
|
||||||
native_unit_of_measurement=SIGNAL_STRENGTH_DECIBELS_MILLIWATT,
|
native_unit_of_measurement=SIGNAL_STRENGTH_DECIBELS_MILLIWATT,
|
||||||
device_class=SensorDeviceClass.SIGNAL_STRENGTH,
|
device_class=SensorDeviceClass.SIGNAL_STRENGTH,
|
||||||
@ -455,7 +455,7 @@ ENTITY_DESCRIPTION_CONTROLLER_STATISTICS_LIST = [
|
|||||||
),
|
),
|
||||||
ZWaveJSStatisticsSensorEntityDescription(
|
ZWaveJSStatisticsSensorEntityDescription(
|
||||||
key="background_rssi.channel_2.average",
|
key="background_rssi.channel_2.average",
|
||||||
translation_key="average_background_rssi",
|
translation_key="avg_signal_noise",
|
||||||
translation_placeholders={"channel": "2"},
|
translation_placeholders={"channel": "2"},
|
||||||
native_unit_of_measurement=SIGNAL_STRENGTH_DECIBELS_MILLIWATT,
|
native_unit_of_measurement=SIGNAL_STRENGTH_DECIBELS_MILLIWATT,
|
||||||
device_class=SensorDeviceClass.SIGNAL_STRENGTH,
|
device_class=SensorDeviceClass.SIGNAL_STRENGTH,
|
||||||
@ -463,7 +463,7 @@ ENTITY_DESCRIPTION_CONTROLLER_STATISTICS_LIST = [
|
|||||||
),
|
),
|
||||||
ZWaveJSStatisticsSensorEntityDescription(
|
ZWaveJSStatisticsSensorEntityDescription(
|
||||||
key="background_rssi.channel_2.current",
|
key="background_rssi.channel_2.current",
|
||||||
translation_key="current_background_rssi",
|
translation_key="signal_noise",
|
||||||
translation_placeholders={"channel": "2"},
|
translation_placeholders={"channel": "2"},
|
||||||
native_unit_of_measurement=SIGNAL_STRENGTH_DECIBELS_MILLIWATT,
|
native_unit_of_measurement=SIGNAL_STRENGTH_DECIBELS_MILLIWATT,
|
||||||
device_class=SensorDeviceClass.SIGNAL_STRENGTH,
|
device_class=SensorDeviceClass.SIGNAL_STRENGTH,
|
||||||
@ -472,7 +472,7 @@ ENTITY_DESCRIPTION_CONTROLLER_STATISTICS_LIST = [
|
|||||||
),
|
),
|
||||||
ZWaveJSStatisticsSensorEntityDescription(
|
ZWaveJSStatisticsSensorEntityDescription(
|
||||||
key="background_rssi.channel_3.average",
|
key="background_rssi.channel_3.average",
|
||||||
translation_key="average_background_rssi",
|
translation_key="avg_signal_noise",
|
||||||
translation_placeholders={"channel": "3"},
|
translation_placeholders={"channel": "3"},
|
||||||
native_unit_of_measurement=SIGNAL_STRENGTH_DECIBELS_MILLIWATT,
|
native_unit_of_measurement=SIGNAL_STRENGTH_DECIBELS_MILLIWATT,
|
||||||
device_class=SensorDeviceClass.SIGNAL_STRENGTH,
|
device_class=SensorDeviceClass.SIGNAL_STRENGTH,
|
||||||
@ -480,7 +480,7 @@ ENTITY_DESCRIPTION_CONTROLLER_STATISTICS_LIST = [
|
|||||||
),
|
),
|
||||||
ZWaveJSStatisticsSensorEntityDescription(
|
ZWaveJSStatisticsSensorEntityDescription(
|
||||||
key="background_rssi.channel_3.current",
|
key="background_rssi.channel_3.current",
|
||||||
translation_key="current_background_rssi",
|
translation_key="signal_noise",
|
||||||
translation_placeholders={"channel": "3"},
|
translation_placeholders={"channel": "3"},
|
||||||
native_unit_of_measurement=SIGNAL_STRENGTH_DECIBELS_MILLIWATT,
|
native_unit_of_measurement=SIGNAL_STRENGTH_DECIBELS_MILLIWATT,
|
||||||
device_class=SensorDeviceClass.SIGNAL_STRENGTH,
|
device_class=SensorDeviceClass.SIGNAL_STRENGTH,
|
||||||
@ -549,7 +549,7 @@ ENTITY_DESCRIPTION_NODE_STATISTICS_LIST = [
|
|||||||
),
|
),
|
||||||
ZWaveJSStatisticsSensorEntityDescription(
|
ZWaveJSStatisticsSensorEntityDescription(
|
||||||
key="rssi",
|
key="rssi",
|
||||||
translation_key="rssi",
|
translation_key="signal_strength",
|
||||||
native_unit_of_measurement=SIGNAL_STRENGTH_DECIBELS_MILLIWATT,
|
native_unit_of_measurement=SIGNAL_STRENGTH_DECIBELS_MILLIWATT,
|
||||||
device_class=SensorDeviceClass.SIGNAL_STRENGTH,
|
device_class=SensorDeviceClass.SIGNAL_STRENGTH,
|
||||||
state_class=SensorStateClass.MEASUREMENT,
|
state_class=SensorStateClass.MEASUREMENT,
|
||||||
|
@ -199,8 +199,8 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"sensor": {
|
"sensor": {
|
||||||
"average_background_rssi": {
|
"avg_signal_noise": {
|
||||||
"name": "Average background RSSI (channel {channel})"
|
"name": "Avg. signal noise (channel {channel})"
|
||||||
},
|
},
|
||||||
"can": {
|
"can": {
|
||||||
"name": "Collisions"
|
"name": "Collisions"
|
||||||
@ -216,9 +216,6 @@
|
|||||||
"unresponsive": "Unresponsive"
|
"unresponsive": "Unresponsive"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"current_background_rssi": {
|
|
||||||
"name": "Current background RSSI (channel {channel})"
|
|
||||||
},
|
|
||||||
"last_seen": {
|
"last_seen": {
|
||||||
"name": "Last seen"
|
"name": "Last seen"
|
||||||
},
|
},
|
||||||
@ -238,12 +235,15 @@
|
|||||||
"unknown": "Unknown"
|
"unknown": "Unknown"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"rssi": {
|
|
||||||
"name": "RSSI"
|
|
||||||
},
|
|
||||||
"rtt": {
|
"rtt": {
|
||||||
"name": "Round trip time"
|
"name": "Round trip time"
|
||||||
},
|
},
|
||||||
|
"signal_noise": {
|
||||||
|
"name": "Signal noise (channel {channel})"
|
||||||
|
},
|
||||||
|
"signal_strength": {
|
||||||
|
"name": "Signal strength"
|
||||||
|
},
|
||||||
"successful_commands": {
|
"successful_commands": {
|
||||||
"name": "Successful commands ({direction})"
|
"name": "Successful commands ({direction})"
|
||||||
},
|
},
|
||||||
|
@ -796,14 +796,14 @@ CONTROLLER_STATISTICS_SUFFIXES = {
|
|||||||
}
|
}
|
||||||
# controller statistics with initial state of unknown
|
# controller statistics with initial state of unknown
|
||||||
CONTROLLER_STATISTICS_SUFFIXES_UNKNOWN = {
|
CONTROLLER_STATISTICS_SUFFIXES_UNKNOWN = {
|
||||||
"current_background_rssi_channel_0": -1,
|
"signal_noise_channel_0": -1,
|
||||||
"average_background_rssi_channel_0": -2,
|
"avg_signal_noise_channel_0": -2,
|
||||||
"current_background_rssi_channel_1": -3,
|
"signal_noise_channel_1": -3,
|
||||||
"average_background_rssi_channel_1": -4,
|
"avg_signal_noise_channel_1": -4,
|
||||||
"current_background_rssi_channel_2": -5,
|
"signal_noise_channel_2": -5,
|
||||||
"average_background_rssi_channel_2": -6,
|
"avg_signal_noise_channel_2": -6,
|
||||||
"current_background_rssi_channel_3": STATE_UNKNOWN,
|
"signal_noise_channel_3": STATE_UNKNOWN,
|
||||||
"average_background_rssi_channel_3": STATE_UNKNOWN,
|
"avg_signal_noise_channel_3": STATE_UNKNOWN,
|
||||||
}
|
}
|
||||||
NODE_STATISTICS_ENTITY_PREFIX = "sensor.4_in_1_sensor_"
|
NODE_STATISTICS_ENTITY_PREFIX = "sensor.4_in_1_sensor_"
|
||||||
# node statistics with initial state of 0
|
# node statistics with initial state of 0
|
||||||
@ -817,7 +817,7 @@ NODE_STATISTICS_SUFFIXES = {
|
|||||||
# node statistics with initial state of unknown
|
# node statistics with initial state of unknown
|
||||||
NODE_STATISTICS_SUFFIXES_UNKNOWN = {
|
NODE_STATISTICS_SUFFIXES_UNKNOWN = {
|
||||||
"round_trip_time": 6,
|
"round_trip_time": 6,
|
||||||
"rssi": 7,
|
"signal_strength": 7,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -887,7 +887,7 @@ async def test_statistics_sensors_no_last_seen(
|
|||||||
):
|
):
|
||||||
for suffix_key in suffixes:
|
for suffix_key in suffixes:
|
||||||
entry = entity_registry.async_get(f"{prefix}{suffix_key}")
|
entry = entity_registry.async_get(f"{prefix}{suffix_key}")
|
||||||
assert entry
|
assert entry, f"Entity {prefix}{suffix_key} not found"
|
||||||
assert entry.disabled
|
assert entry.disabled
|
||||||
assert entry.disabled_by is er.RegistryEntryDisabler.INTEGRATION
|
assert entry.disabled_by is er.RegistryEntryDisabler.INTEGRATION
|
||||||
|
|
||||||
@ -913,12 +913,12 @@ async def test_statistics_sensors_no_last_seen(
|
|||||||
):
|
):
|
||||||
for suffix_key in suffixes:
|
for suffix_key in suffixes:
|
||||||
entry = entity_registry.async_get(f"{prefix}{suffix_key}")
|
entry = entity_registry.async_get(f"{prefix}{suffix_key}")
|
||||||
assert entry
|
assert entry, f"Entity {prefix}{suffix_key} not found"
|
||||||
assert not entry.disabled
|
assert not entry.disabled
|
||||||
assert entry.disabled_by is None
|
assert entry.disabled_by is None
|
||||||
|
|
||||||
state = hass.states.get(entry.entity_id)
|
state = hass.states.get(entry.entity_id)
|
||||||
assert state
|
assert state, f"State for {entry.entity_id} not found"
|
||||||
assert state.state == initial_state
|
assert state.state == initial_state
|
||||||
|
|
||||||
# Fire statistics updated for controller
|
# Fire statistics updated for controller
|
||||||
|
Loading…
x
Reference in New Issue
Block a user