Any way to force this card to always be 0-255 (I have some devices that vary 200-255 and they should not go from the top to the bottom, I only want things under 100 to have that dramatic of a swing).
Untested:
- Create a Zero sensor with “state_class: management” (since you are talking about Statistics graph).
- Add this sensor on the same card - it will show you a zero lower bound.
- Ether hide the whole legend (by a corr. option) or just zero sensor’s label (by card-mod).
How to set a 0 lower bound for Y-axis in statistics-graph:
Assume we have two “humidity” values:
- type: statistics-graph
entities:
- sensor.home_openweathermap_humidity
- sensor.moscow_openweathermap_humidity
stat_types:
- mean
- min
- max
chart_type: line
period: hour
days_to_show: 1
Create a zero sensor with same UoM:
template:
- sensor:
- name:zero_value_humidity
unit_of_measurement: "%"
state_class: measurement
state: 0
Add this sensor on the graph:
- type: statistics-graph
entities:
- sensor.home_openweathermap_humidity
- sensor.moscow_openweathermap_humidity
- sensor.zero_value_humidity
stat_types:
- mean
- min
- max
chart_type: line
period: hour
days_to_show: 1
Now hide a legend for this zero sensor & make it’s line less vivid:
- type: statistics-graph
entities:
- sensor.home_openweathermap_humidity
- sensor.moscow_openweathermap_humidity
- sensor.zero_value_humidity
stat_types:
- mean
- min
- max
chart_type: line
period: hour
days_to_show: 1
card_mod:
style:
.content statistics-chart $:
ha-chart-base $: |
.chartLegend li:nth-child(n+7) {
display: none;
}
.: |
ha-card {
--graph-color-3: #c5c5c5;
}
Unfortunately, cannot make it transparent…
If only one humidity graph is displayed, the whole legend may be hidden:
- type: statistics-graph
entities:
- sensor.home_openweathermap_humidity
- sensor.zero_value_humidity
stat_types:
- mean
- min
- max
chart_type: line
period: hour
days_to_show: 1
hide_legend: true
card_mod:
style: |
ha-card {
--graph-color-2: #c5c5c5;
}
Here an undesired glitch may be seen - a hidden line may be selected:
Do not select it then )))
2 Likes