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?
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 }}"