Little roast button to roast anybody who press it. Via snapshot and Google generated content

I thought this was funny to share. At the moment we have a wall tablet (Lenovo M10) and I now have 2 buttons on that dashboard. they use the Lenovo’s camera, takes a snapshot. We send it via Google Generative AI and the text returned is spoken on the tablet. with very funny results. Tomorrow we’ll see if the kids like it too :slight_smile:

alias: roast
description: word geroast
triggers:
  - entity_id:
      - input_boolean.roast
    trigger: state
conditions: []
actions:
  - data:
      filename: www/snapshots/lenovo_tab_m10_3rd_gen_snapshot1.jpg
    target:
      device_id: 98ea6686a5d02dd6c53186108766d343
    action: camera.snapshot
  - data:
      image_filename: www/snapshots/lenovo_tab_m10_3rd_gen_snapshot1.jpg
      prompt: >-
        roast me! do it in Dutch. make it human readable. keep it
        short and concise and use humor. If you can't see a person/face on
        the snapshot tells you something like I don't see you, you're probably too
        small. don't talk about static objects in the house. use the time
        to see if it is late/early/morning or evening.
    response_variable: roast_response
    action: google_generative_ai_conversation.generate_content
  - variables:
      clean_roast: " {{-roast_response | replace('text', '') | replace('\N', ' ') | trim-}}"
  - action: tts.speak
    metadata: {}
    data:
      cache: false
      media_player_entity_id: media_player.lenovo_tab_m10_3rd_gen
      message: " {{-clean_roast-}}"
    target:
      entity_id: tts.home_assistant_cloud
  - target:
      entity_id: input_boolean.roast
    action: input_boolean.turn_off
    data: {}
mode: single

the “{{-roast_response | replace(‘text’, ‘’) | replace(‘\N’, ’ ') | trim-}}” part is a little strange, but google keeps saying “Text” and “backslash N”
The “text” part is fixed this way. maybee someone have an idea for the spoken “backslash N” thingy.

By the way, the Heart button is the opposite. translates to be kind. this one tells you your beautiful and spiritual on a good path… i know she wil like that one more!

1 Like