kalkih / mini-graph-card

Minimalistic graph card for Home Assistant Lovelace UI
MIT License
2.96k stars 232 forks source link

Non-numeric, non-binary sensor support #895

Closed Line-Noise closed 7 months ago

Line-Noise commented 1 year ago

G'day!

I'd like to use mini-graph-card to display tide times (next high tide time, next low tide time) and plot graphs of the historic tide height for each. The tide heights work great but because the sensor value is a date I just get NaN.

Is there a way to show the literal value of a sensor if it's not a number?

Screenshot_from_2022-12-27_18-27-30

igorsantos07 commented 1 year ago

Wait, if values are dates...... what are those numbers on the left side? I guess your Y is date/time, and X is the height, right?

ildar170975 commented 1 year ago

X is always a time. Y is allays a sensor’s (attribute’s) value. What is posted in the issue is barely clear since the author omitted both the card’s code and a description of his values. No wonder there is no any movement with this issue.

Line-Noise commented 1 year ago

Yeah, fair enough, I should have included the card's code. My bad.

Sadly, I don't have a copy of the card code anymore because it wasn't working for me. So I'll have a go at recreating it from memory.

I have a tide sensor that provides:

sensor.high_tide_height
sensor.high_tide_time
sensor.low_tide_height
sensor.low_tide_time

So I did something like

entities:
  - entity: sensor.low_tide_height
    show_state: false
  - entity: sensor.low_tide_time
    show_state: true
    show_graph: false

The graph of the tide height in metres worked fine. But the low_tide_time is a string value which, of course, is not a number, hence the NaN. My request was for support to display arbitrary strings as state values. They couldn't be graphed, of course, hence the show_graph: false, but I don't see any reason why the state needs to be a number.

ildar170975 commented 1 year ago

Please post also an example of values kept in that non-numerical sensor. A screenshot from Dev tools -> set state.

ildar170975 commented 7 months ago

No feedback from OP for 11 months. Closing.