Add translated native unit of measurement - squeezebox (#131912)

This commit is contained in:
Andrew Jackson 2024-12-02 09:54:37 +00:00 committed by GitHub
parent 584bb7bca8
commit 56ec70815c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 12 additions and 12 deletions

View File

@ -33,12 +33,10 @@ SENSORS: tuple[SensorEntityDescription, ...] = (
SensorEntityDescription( SensorEntityDescription(
key=STATUS_SENSOR_INFO_TOTAL_ALBUMS, key=STATUS_SENSOR_INFO_TOTAL_ALBUMS,
state_class=SensorStateClass.TOTAL, state_class=SensorStateClass.TOTAL,
native_unit_of_measurement="albums",
), ),
SensorEntityDescription( SensorEntityDescription(
key=STATUS_SENSOR_INFO_TOTAL_ARTISTS, key=STATUS_SENSOR_INFO_TOTAL_ARTISTS,
state_class=SensorStateClass.TOTAL, state_class=SensorStateClass.TOTAL,
native_unit_of_measurement="artists",
), ),
SensorEntityDescription( SensorEntityDescription(
key=STATUS_SENSOR_INFO_TOTAL_DURATION, key=STATUS_SENSOR_INFO_TOTAL_DURATION,
@ -49,12 +47,10 @@ SENSORS: tuple[SensorEntityDescription, ...] = (
SensorEntityDescription( SensorEntityDescription(
key=STATUS_SENSOR_INFO_TOTAL_GENRES, key=STATUS_SENSOR_INFO_TOTAL_GENRES,
state_class=SensorStateClass.TOTAL, state_class=SensorStateClass.TOTAL,
native_unit_of_measurement="genres",
), ),
SensorEntityDescription( SensorEntityDescription(
key=STATUS_SENSOR_INFO_TOTAL_SONGS, key=STATUS_SENSOR_INFO_TOTAL_SONGS,
state_class=SensorStateClass.TOTAL, state_class=SensorStateClass.TOTAL,
native_unit_of_measurement="songs",
), ),
SensorEntityDescription( SensorEntityDescription(
key=STATUS_SENSOR_LASTSCAN, key=STATUS_SENSOR_LASTSCAN,
@ -63,13 +59,11 @@ SENSORS: tuple[SensorEntityDescription, ...] = (
SensorEntityDescription( SensorEntityDescription(
key=STATUS_SENSOR_PLAYER_COUNT, key=STATUS_SENSOR_PLAYER_COUNT,
state_class=SensorStateClass.TOTAL, state_class=SensorStateClass.TOTAL,
native_unit_of_measurement="players",
), ),
SensorEntityDescription( SensorEntityDescription(
key=STATUS_SENSOR_OTHER_PLAYER_COUNT, key=STATUS_SENSOR_OTHER_PLAYER_COUNT,
state_class=SensorStateClass.TOTAL, state_class=SensorStateClass.TOTAL,
entity_registry_visible_default=False, entity_registry_visible_default=False,
native_unit_of_measurement="players",
), ),
) )

View File

@ -76,25 +76,31 @@
"name": "Last scan" "name": "Last scan"
}, },
"info_total_albums": { "info_total_albums": {
"name": "Total albums" "name": "Total albums",
"unit_of_measurement": "albums"
}, },
"info_total_artists": { "info_total_artists": {
"name": "Total artists" "name": "Total artists",
"unit_of_measurement": "artists"
}, },
"info_total_duration": { "info_total_duration": {
"name": "Total duration" "name": "Total duration"
}, },
"info_total_genres": { "info_total_genres": {
"name": "Total genres" "name": "Total genres",
"unit_of_measurement": "genres"
}, },
"info_total_songs": { "info_total_songs": {
"name": "Total songs" "name": "Total songs",
"unit_of_measurement": "songs"
}, },
"player_count": { "player_count": {
"name": "Player count" "name": "Player count",
"unit_of_measurement": "players"
}, },
"other_player_count": { "other_player_count": {
"name": "Player count off service" "name": "Player count off service",
"unit_of_measurement": "[%key:component::squeezebox::entity::sensor::player_count::unit_of_measurement%]"
} }
} }
} }