Displaying a card with a lot of text

I’ve got a rest entity that calls out to an API my kids school uses for the school lunch menu. The result is saved in an attribute. I’m displaying that attribute on an entity card on a dashboard so my kids can see what is for lunch tomorrow. This all works fine.

I’ve started playing around with generative AI, and my thought process was to make it a little more fun for them by using AI to create jokes and whatnot out of the menu. I’ve got the generative AI working just fine, but now I can’t figure out how to display it. It seems that there is a 100 character limit to entities so I can’t save that generative AI somewhere I can display it.

How can I go about displaying this to a dashboard card?

I believe it’s 255 character limit on the state, but on attributes there is no limit.

Markdown Card

An entity’s attributes can store up to 16Kb.

How do I go about creating and setting an attribute?

Post the existing Template Sensor you created and we’ll show you how to modify it.

If you created a Template Sensor helper, just post its template.

Here is the template sensor:


- platform: template
  sensors:
    lunch_items:
        friendly_name: "Lunch Items"
        value_template: "{{ state_attr('sensor.lunch_tomorrow', 'menu_items')}}"
        attribute_templates:
          lunch_text: "{{ response.text }}""

Here is the automation where I want to get the response.text into the lunch_text attribute

alias: Funny Lunch Menu
description: ""
triggers:
  - trigger: state
    entity_id:
      - sensor.lunch_tomorrow
  - trigger: state
    entity_id:
      - input_button.test_button
conditions: []
actions:
  - action: google_generative_ai_conversation.generate_content
    response_variable: response
    data:
      prompt: >-
        The following is a list of menu items for lunch tomorrow {{
        state_attr('sensor.lunch_tomorrow', 'menu_items') }}.  Tell me back the
        menu.

I solved this by eliminating the automation and building this into a Trigger Template.

trigger:
  - trigger: state
    entity_id: sensor.lunch_tomorrow
action:
  - action: google_generative_ai_conversation.generate_content
    response_variable: response
    data:
      prompt: >-
        The following is a list of menu items for lunch tomorrow {{ state_attr('sensor.lunch_tomorrow', 'menu_items') }}.  Tell me back the menu in a funny way. 
sensor:
    - name: Funny Lunch Text
      unique_id: funnyllunchtext
      state: None
      attributes:
        funny_text: "{{ response.text }}"