Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only show unit of measurement if we have it and if the state is not a string while managing sensors #3685

Merged
merged 2 commits into from
Jul 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ fun SensorDetailTopPanel(
if (sensor.state.isBlank()) {
stringResource(commonR.string.enabled)
} else {
if (sensor.unitOfMeasurement.isNullOrBlank()) {
if (sensor.unitOfMeasurement.isNullOrBlank() || sensor.state.toDoubleOrNull() == null) {
sensor.state
} else {
"${sensor.state} ${sensor.unitOfMeasurement}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ fun SensorRow(
if (dbSensor.state.isBlank()) {
stringResource(commonR.string.enabled)
} else {
if (basicSensor.unitOfMeasurement.isNullOrBlank()) {
if (basicSensor.unitOfMeasurement.isNullOrBlank() || dbSensor.state.toDoubleOrNull() == null) {
dbSensor.state
} else {
"${dbSensor.state} ${basicSensor.unitOfMeasurement}"
Expand Down