Add entity translations to RFXTRX (#96041)

This commit is contained in:
Joost Lekkerkerker 2023-07-07 06:44:09 +02:00 committed by GitHub
parent 66a1e5c2c1
commit 4bf3720911
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 76 additions and 27 deletions

View File

@ -70,14 +70,12 @@ class RfxtrxSensorEntityDescription(SensorEntityDescription):
SENSOR_TYPES = (
RfxtrxSensorEntityDescription(
key="Barometer",
name="Barometer",
device_class=SensorDeviceClass.PRESSURE,
state_class=SensorStateClass.MEASUREMENT,
native_unit_of_measurement=UnitOfPressure.HPA,
),
RfxtrxSensorEntityDescription(
key="Battery numeric",
name="Battery",
device_class=SensorDeviceClass.BATTERY,
state_class=SensorStateClass.MEASUREMENT,
native_unit_of_measurement=PERCENTAGE,
@ -86,49 +84,46 @@ SENSOR_TYPES = (
),
RfxtrxSensorEntityDescription(
key="Current",
name="Current",
device_class=SensorDeviceClass.CURRENT,
state_class=SensorStateClass.MEASUREMENT,
native_unit_of_measurement=UnitOfElectricCurrent.AMPERE,
),
RfxtrxSensorEntityDescription(
key="Current Ch. 1",
name="Current Ch. 1",
translation_key="current_ch_1",
device_class=SensorDeviceClass.CURRENT,
state_class=SensorStateClass.MEASUREMENT,
native_unit_of_measurement=UnitOfElectricCurrent.AMPERE,
),
RfxtrxSensorEntityDescription(
key="Current Ch. 2",
name="Current Ch. 2",
translation_key="current_ch_2",
device_class=SensorDeviceClass.CURRENT,
state_class=SensorStateClass.MEASUREMENT,
native_unit_of_measurement=UnitOfElectricCurrent.AMPERE,
),
RfxtrxSensorEntityDescription(
key="Current Ch. 3",
name="Current Ch. 3",
translation_key="current_ch_3",
device_class=SensorDeviceClass.CURRENT,
state_class=SensorStateClass.MEASUREMENT,
native_unit_of_measurement=UnitOfElectricCurrent.AMPERE,
),
RfxtrxSensorEntityDescription(
key="Energy usage",
name="Instantaneous power",
translation_key="instantaneous_power",
device_class=SensorDeviceClass.POWER,
state_class=SensorStateClass.MEASUREMENT,
native_unit_of_measurement=UnitOfPower.WATT,
),
RfxtrxSensorEntityDescription(
key="Humidity",
name="Humidity",
device_class=SensorDeviceClass.HUMIDITY,
state_class=SensorStateClass.MEASUREMENT,
native_unit_of_measurement=PERCENTAGE,
),
RfxtrxSensorEntityDescription(
key="Rssi numeric",
name="Signal strength",
device_class=SensorDeviceClass.SIGNAL_STRENGTH,
state_class=SensorStateClass.MEASUREMENT,
native_unit_of_measurement=SIGNAL_STRENGTH_DECIBELS_MILLIWATT,
@ -137,108 +132,104 @@ SENSOR_TYPES = (
),
RfxtrxSensorEntityDescription(
key="Temperature",
name="Temperature",
device_class=SensorDeviceClass.TEMPERATURE,
state_class=SensorStateClass.MEASUREMENT,
native_unit_of_measurement=UnitOfTemperature.CELSIUS,
),
RfxtrxSensorEntityDescription(
key="Temperature2",
name="Temperature 2",
translation_key="temperature_2",
device_class=SensorDeviceClass.TEMPERATURE,
state_class=SensorStateClass.MEASUREMENT,
native_unit_of_measurement=UnitOfTemperature.CELSIUS,
),
RfxtrxSensorEntityDescription(
key="Total usage",
name="Total energy usage",
translation_key="total_energy_usage",
device_class=SensorDeviceClass.ENERGY,
state_class=SensorStateClass.TOTAL_INCREASING,
native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
),
RfxtrxSensorEntityDescription(
key="Voltage",
name="Voltage",
device_class=SensorDeviceClass.VOLTAGE,
state_class=SensorStateClass.MEASUREMENT,
native_unit_of_measurement=UnitOfElectricPotential.VOLT,
),
RfxtrxSensorEntityDescription(
key="Wind direction",
name="Wind direction",
translation_key="wind_direction",
state_class=SensorStateClass.MEASUREMENT,
native_unit_of_measurement=DEGREE,
),
RfxtrxSensorEntityDescription(
key="Rain rate",
name="Rain rate",
state_class=SensorStateClass.MEASUREMENT,
native_unit_of_measurement=UnitOfVolumetricFlux.MILLIMETERS_PER_HOUR,
device_class=SensorDeviceClass.PRECIPITATION_INTENSITY,
),
RfxtrxSensorEntityDescription(
key="Sound",
name="Sound",
translation_key="sound",
),
RfxtrxSensorEntityDescription(
key="Sensor Status",
name="Sensor status",
translation_key="sensor_status",
),
RfxtrxSensorEntityDescription(
key="Count",
name="Count",
translation_key="count",
state_class=SensorStateClass.TOTAL_INCREASING,
native_unit_of_measurement="count",
),
RfxtrxSensorEntityDescription(
key="Counter value",
name="Counter value",
translation_key="counter_value",
state_class=SensorStateClass.TOTAL_INCREASING,
native_unit_of_measurement="count",
),
RfxtrxSensorEntityDescription(
key="Chill",
name="Chill",
translation_key="chill",
device_class=SensorDeviceClass.TEMPERATURE,
state_class=SensorStateClass.MEASUREMENT,
native_unit_of_measurement=UnitOfTemperature.CELSIUS,
),
RfxtrxSensorEntityDescription(
key="Wind average speed",
name="Wind average speed",
translation_key="wind_average_speed",
state_class=SensorStateClass.MEASUREMENT,
native_unit_of_measurement=UnitOfSpeed.METERS_PER_SECOND,
device_class=SensorDeviceClass.WIND_SPEED,
),
RfxtrxSensorEntityDescription(
key="Wind gust",
name="Wind gust",
translation_key="wind_gust",
state_class=SensorStateClass.MEASUREMENT,
native_unit_of_measurement=UnitOfSpeed.METERS_PER_SECOND,
device_class=SensorDeviceClass.WIND_SPEED,
),
RfxtrxSensorEntityDescription(
key="Rain total",
name="Rain total",
state_class=SensorStateClass.MEASUREMENT,
native_unit_of_measurement=UnitOfPrecipitationDepth.MILLIMETERS,
device_class=SensorDeviceClass.PRECIPITATION,
),
RfxtrxSensorEntityDescription(
key="Forecast",
name="Forecast status",
translation_key="forecast_status",
),
RfxtrxSensorEntityDescription(
key="Forecast numeric",
name="Forecast",
translation_key="forecast",
),
RfxtrxSensorEntityDescription(
key="Humidity status",
name="Humidity status",
translation_key="humidity_status",
),
RfxtrxSensorEntityDescription(
key="UV",
name="UV index",
translation_key="uv_index",
state_class=SensorStateClass.MEASUREMENT,
native_unit_of_measurement=UV_INDEX,
),

View File

@ -78,5 +78,63 @@
"status": "Received status: {subtype}",
"command": "Received command: {subtype}"
}
},
"entity": {
"sensor": {
"current_ch_1": {
"name": "Current Ch. 1"
},
"current_ch_2": {
"name": "Current Ch. 2"
},
"current_ch_3": {
"name": "Current Ch. 3"
},
"instantaneous_power": {
"name": "Instantaneous power"
},
"temperature_2": {
"name": "Temperature 2"
},
"total_energy_usage": {
"name": "Total energy usage"
},
"wind_direction": {
"name": "Wind direction"
},
"sound": {
"name": "Sound"
},
"sensor_status": {
"name": "Sensor status"
},
"count": {
"name": "Count"
},
"counter_value": {
"name": "Counter value"
},
"chill": {
"name": "Chill"
},
"wind_average_speed": {
"name": "Wind average speed"
},
"wind_gust": {
"name": "Wind gust"
},
"forecast_status": {
"name": "Forecast status"
},
"forecast": {
"name": "Forecast"
},
"humidity_status": {
"name": "Humidity status"
},
"uv_index": {
"name": "UV index"
}
}
}
}