kalkih / mini-graph-card

Minimalistic graph card for Home Assistant Lovelace UI
MIT License
3.05k stars 237 forks source link

binary_sensor wont show correctly #814

Closed magiva closed 2 years ago

magiva commented 2 years ago

I created a simple binary_sensor to ping the google dns server. The purpose is so that i can cycle the power of the wifi if the sensor shows 'off' for too long. This is an observed problem and fix in the apartment im in with no access to the "main house router".

I thought it would be nice to plot this up/down into a chart in config i created: binary_sensor:

in the card i created: type: custom:mini-graph-card name: Internet Status icon: mdi:check-network entities:

The chart show up and... up image

The sensor has off and on during the hoursto:show image

magiva commented 2 years ago

i see that the off spike was not long enough to reflect in the points_per_hour but still weird that i have up and up even if i put upper and lower bounds. If i do specify upper and lower bounds (as up and down) the chart shows NaN

weird issues that ive worked around... close if you feel it doesnt need attention

ildar170975 commented 2 years ago

The issue will be faster analysed if it is created properly. Here the code in unformatted and cannot be checked. Use triple "`" to format the code.

HeedfulCrayon commented 2 years ago

You need to set upper_bound: 1

type: custom:mini-graph-card
name: Internet Status
icon: mdi:check-network
entities:
  - entity: binary_sensor.internet
    name: Internet
**upper_bound: 1**
hours_to_show: 12
points_per_hour: 60
aggregate_func: max
line_width: 2
smoothing: false
state_map:
  - value: 'off'
    label: Down
 - value: 'on'
    label: Up
magiva commented 2 years ago

nice, that seems to have fixed it, thanks

magiva commented 2 years ago

would be good to update the doc as it seems critical to its use with binary sensor data like this.