Convert Room Health Score to integer
HASS 2025.7 has made it store (and display) a ridiculous number of decimals instead of just actually respecting accuracy_decimals. So, manually convert this to an integer since it has no need for decimals.
This commit is contained in:
@ -652,7 +652,6 @@ sensor:
|
|||||||
name: "Room Health Score"
|
name: "Room Health Score"
|
||||||
id: room_health_score
|
id: room_health_score
|
||||||
unit_of_measurement: "%"
|
unit_of_measurement: "%"
|
||||||
accuracy_decimals: 0
|
|
||||||
icon: mdi:home-heart
|
icon: mdi:home-heart
|
||||||
lambda: |-
|
lambda: |-
|
||||||
float voc_index = id(sgp41_voc_index).state;
|
float voc_index = id(sgp41_voc_index).state;
|
||||||
@ -679,7 +678,7 @@ sensor:
|
|||||||
// Weighted average
|
// Weighted average
|
||||||
float overall_score = (voc_score * 0.5 + temp_score * 0.25 + humidity_score * 0.25);
|
float overall_score = (voc_score * 0.5 + temp_score * 0.25 + humidity_score * 0.25);
|
||||||
|
|
||||||
return round(overall_score);
|
return (int) round(overall_score);
|
||||||
update_interval: 15s
|
update_interval: 15s
|
||||||
|
|
||||||
- platform: tsl2591
|
- platform: tsl2591
|
||||||
|
Reference in New Issue
Block a user