How to make a custom Device history-graph?

I’m trying to replicate going in the interface in History/Choose device, and then it graphs all the device’s entities, in a custom dashboard.

I have this:

title: Fridge
  - title: Air Quality
    type: panel
      - type: vertical-stack
          - type: history-graph
            hours_to_show: 24
            title: Air Quality
            entities: '{{ device_entities(device_id("Air Quality Monitor - Blue")) }}'

Seeing the error I get, I guess there is no template parsing here?

Any way to have this working?

Most core dashboard cards do not support templates.

So no you can’t do that.

Have a look at this third party card:

Though I suspect it will not do what you want. It will put all the automatically selected entities in the one history graph.