kalkih / mini-graph-card

Minimalistic graph card for Home Assistant Lovelace UI
MIT License
2.89k stars 233 forks source link

Two or more sensors causes flat lining #992

Open smartypantsuk opened 12 months ago

smartypantsuk commented 12 months ago

Hi,

I simplified my code to try and diagnose this but nothing works... it has been working for months. I'm on latest HASS.

type: custom:mini-graph-card
name: Cupboard
entities:
  - entity: sensor.cupboard_humidity_9
    - sensor.cupboard_temperature_8
hours_to_show: `24`
points_per_hour: 6

I've tried variations of the above code, including update frequency, cache disabled, etc etc. Nothing seems to change the graph... yet with one sensor I get a proper line of data, whereas two sensors (any sensors) I get the last in order sensor graph flat lining and the top most one with a slight curve but completely inaccurate.

This: Screenshot_20230802_002302_Home Assistant

Should be: Screenshot_20230802_002628_Home Assistant

And: Screenshot_20230802_002536_Home Assistant

Tried deleting and recreating, tried restarting HA. Tried loads of configuration options, nothing fixed it.

Ok so I tried the exact code taken from the example on the code page with the exception that I changed the sensors to my own.

type: custom:mini-graph-card
entities:
  - entity: sensor.cupboard_humidity_9
    show_state: true
    show_graph: false
  - entity: sensor.cupboard_temperature_7
    color: green
    show_state: false
    name: CO2-1
  - entity: sensor.cupboard_temperature_8
    color: orange
    show_state: false
    name: CO2-2
name: Humidity
hours_to_show: 4
points_per_hour: 60
show:
  name: true
  legend: true
  icon: false
  labels: true

Which produces the same:

Screenshot_20230802_082201_Home Assistant

Still flat lines

ildar170975 commented 12 months ago

Start with formatting the posted code, there is a special tag for it. Otherwise it is not clear.

ildar170975 commented 12 months ago

Also, the 1st screenshot seems to be for three entities, and your code was for two.

smartypantsuk commented 12 months ago

Start with formatting the posted code, there is a special tag for it. Otherwise it is not clear.

Done

smartypantsuk commented 12 months ago

Also, the 1st screenshot seems to be for three entities, and your code was for two.

I've added three entities on the last example with the same outcome

ildar170975 commented 12 months ago
  1. Even the formatted code you posted has wrong indents. Do not edit code in the post. Always paste the exact code you tested with.
  2. What you do is still very confusing. Adding the example with 3 sensors is not the same as fixing your other “NaN” examples.

Here described how to test a situation when the card gives a strange output: https://github.com/kalkih/mini-graph-card/issues/933#issuecomment-1464932117 Take any two sensors with same unit of measurement, test with each sensor as described above. Then test the card with two sensors. And do not forget to update HA, update the card, clear browser cache, test with standard browsers like Chrome (btw Safari cannot be called a “standard”).

sharpsan commented 2 months ago

Same thing for me:

type: custom:mini-graph-card
name: Living Room
icon: mdi:thermometer
entities:
  - entity: sensor.my_ecobee_current_temperature
    name: Temperature
  - entity: sensor.my_ecobee_current_humidity
    name: Humidity
hours_to_show: 24

They look normal (non-flattened) when only a single entity is listed.

sharpsan commented 2 months ago

Ah, nevermind. I needed to add y_axis: secondary to one of the entities.