Lovelace: mini graph card

I still think there is something odd with the state_map in my opinion.

I have now been using the input_number and it is working fine, but I also left the binary sensor there to check it and start to use it when the time was right… and now that binary sensor it’s apparently working fine, but when I add it to the graph to replace the input_number, it does not appear, feels like the on/off is not transalated to 1/0

I see the same issue here. My config:

aggregate_func: max
entities:
  - entity: sensor.hourly_gas
hour24: true
group_by: hour
hours_to_show: 24
line_width: 2
name: Gas consumption
points_per_hour: 60
show:
  graph: bar
  labels: true
type: 'custom:mini-graph-card'

When I compare to the normal history graph, I could see abnormalities, so I opened the same graph in a new private tab in FF, then I get a correct graph. Here an example:
Original graph:
(PNG%20Image%2C%20411%C2%A0%C3%97%C2%A0143%20pixels)

Wrong graph:
image

Correct graph:
image

1 Like

There’s an issue open for this.

I have recreated the history graph of a climate component. But I think I have a refresh problem. Many times when I open the panel that contains the graph, it shows like this, (green graphs area is more on the left that should be).

mal

when I press F5 in my browser, the graph is already updated correctly.

ok

You can see the difference of the green part, it seems to show old data.

Can I do something about it?

Thangs in advance.

1 Like

Ok, I see. I will keep an eye on that thread :slight_smile:

There’s an issue open for that too.

Still not getting it to work? I can’t reproduce that issue unfortunately.
It’s however not really optimal that we cache the mapped values, if the user ever want to change the state_map structure later the cached data will not be remapped.

@dutchguy, @DendelX, @tom_l
Thanks for your reports.
Can hopefully make some progress on those issues during the weekend, one of them should be fairly easy to solve, the other one could require some experimentation.

1 Like

Basically if I use the input_number I did create originally it does work perfectly.
If I use the binary_sensor you suggested it doesn’t.
I have checked and the binary sensor it is correctly setting on/off depending on the tod rules, but the graph it doesn’t seems to be “translating” on/off to 1/0, therefore it is not showing the graph when I use that…

Very odd indeed :slight_smile:

Hi Kalkih, I have to report another bug. If you compare both graphs I attached before, at begining you can see that first green area is different. I have seen that some times, this graph and blue one (second and third entities) mantains fixed a value instead real values. This is always with the oldest data that graph shows, and not is fixed refreshing browser.

In this example the correct is the first graph attached. If you need more information tell me.

Thanks for your work! I love this card.

Sorry, I’m not entirely sure what you mean.
Could you please explain the issue one more time in more detail?
Please open an issue regarding this on github, it’s easier for me to track it that way.
Thanks!

Just looking at his posted graphs I’m pretty sure it’s this issue:

Has anyone been able to use the tap_action option? This was introduced in v0.7.0.

I’m trying to open a popup with Browser Mod on the tap_action as shown below, but it isn’t working. It’s simply opening the more-info view (default behaviour I guess).

card:
  type: custom:mini-graph-card
  ...
  tap_action:
    action: call-service
    service: browser_mod.command
    service_data:
      command: popup
      title: 'title_x'
      card:
        type: custom:more-info-card
        entity: 'entity_id_x'
        title: ' '
      style:
        border-radius: var(--theme-border-radius)
        background: var(--theme-background)
      deviceID:
        - this

Everything under tap_action is also used on other cards and it works fine when used on a button (custom:button-card) for example.

1 Like

I am not 100 sure, but I do use the popup differently and it works (not on mini-graph-card but on a single entity)

                      action: call-service
                      service: browser_mod.popup
                      service_data:

This instead of using the command and then the popup, so your should look more like this:

card:
  type: custom:mini-graph-card
  ...
  tap_action:
    action: call-service
    service: browser_mod.popup
    service_data:
      title: 'title_x'
      card:
        type: entities
        entity: 'entity_id_x'
        title: ' '
      style:
        border-radius: var(--theme-border-radius)
        background: var(--theme-background)
      deviceID:
        - this

I have also removed the more-info-card which sound pointless for me, you should use the “entities” card and list the entities you want to show in the popup, so for instance my whole card looks like this:

              - type: glance
                show_state: false
                columns: 3
                show_header_toggle: false
                entities:
                  - name: HASP Desk
                    entity: sensor.hasp_desk_status
                    tap_action:
                      action: call-service
                      service: browser_mod.popup
                      service_data:
                        title: HASP Desk
                        card:
                          type: entities
                          entities:
                            - sensor.hasp_desk_status
                            - light.hasp_desk_display
                            - sensor.hasp_desk_ip_address
                            - sensor.hasp_desk_signal_strenght
                            - sensor.hasp_desk_uptime
                            - sensor.hasp_desk_esp_version
                            - sensor.hasp_desk_esp_update_available
                            - sensor.hasp_desk_lcd_version
                            - sensor.hasp_desk_lcd_update_available

And looks like this (on click):

Hope it helps :slight_smile:

1 Like

Thanks for trying to help out.

I actually have the Browser Mod popups working. I tried your way (browser_mod.popup) which works fine, but so does the way I specified it.

The thing that isn’t working is the tap_action on the Mini Graph Card, because if it would, it would have showed my popup.

I even tried something more simplified like:

tap_action:
  action: navigate
  navigation_path: /lovelace/some-path

This also does not work. It just performs the default, which is more-info.

On another note, thanks for your tip about the entities card. I was actually already thinking of a way to filter some attributes which are on the more-info-card. So, thanks for that. Definitely going to use that.

Sounds like your browser isn’t loading the latest version of the card.
Make sure you’ve updated the card and the old version isn’t loading from cache.
If using HACS, check this: https://github.com/kalkih/mini-graph-card/issues/169

Oh, wow. Thanks for pointing that out! That was indeed it.

I am using HACS and even though I’ve seen you say this to some other people earlier in this thread I never thought to look for this issue myself since everything worked fine up until I wanted to use the popup from Browser Mod.

Also @SeLLeRoNe earlier I said that service: browser_mod.popup was working fine for me, but in fact it didn’t. Because I wasn’t using the correct resource, it looked like it was working, but it wasn’t. I was using an older version of Browser Mod. So, I also updated to the latest version of that and started to use the new configuration (service: browser_mod.popup over service: browser_mod.command and a separate command: popup) and everything is working fine now.

Thanks!

2 Likes

Is there a way to force aspect ratio 1/1 (height/width) for mini graph card?

@kalkih thanks for an awesome card!
I use it to show graph over my energy consumtion.
Is it possible to group the bars weekly? I manage only to group the bars as last 7 days, not as week (mon-sun). Is that possible, and if so, how? Want also to start to show the bars at the 1. of each month, so it`s more logical to the values I use.

sorry for this small error-report, but there’s a typo in the GitHub at https://github.com/kalkih/mini-graph-card#grouping-by-date

- type: type: custom:mini-graph-card
  entities:
    - entity: sensor.energy_daily
  name: Energy consumption
  hours_to_show: 168
  aggregate_func: max
  group_by: date
  show:
    graph: bar

should be:

- type: custom:mini-graph-card
  entities:
    - entity: sensor.energy_daily
  name: Energy consumption
  hours_to_show: 168
  aggregate_func: max
  group_by: date
  show:
    graph: bar

couldn’t find the edit button on the GitHub page, so hope you don’t mind me reporting here.

Hi Tom, sorry for the late reply, only just getting back to this now. I already have some style config for this card and with a bit of playing around I couldn’t get it working. How can I uses both your style code and my existing style code for this card? I tried simply having my code under your example (without having ‘style’ twice) but HA wasn’t happy…

            style:
              top: 15%
              left: 50%
              width: 75%