#making a game time over automation

1 messages · Page 1 of 1 (latest)

bronze scroll
#

I made this automation to tell my kids when there game time is up for the next school day. i want to have openai create random funny messages for them. i made a test scenario and it failed?

`alias: Test automation
description: ""
triggers:

  • trigger: state
    entity_id:
    • input_boolean.test
      from: "off"
      to: "on"
      conditions: []
      actions:
  • data:
    agent_id: conversation.kids_ai
    text: >-
    Craft a fun message for the kids, reminding them that game time is over
    and they have 10 minutes to save their progress before shutdown.
    Randomly include quotes from Invader Zim, Gumball, Teen Titans Go, and
    Sonic.
    language: en
    response_variable: kids_message
    action: conversation.process
  • delay:
    seconds: 2
  • data:
    message: "{{ kids_message.speech.plain.speech }}"
    action: script.game_time_actions
    mode: single`
tacit shard
bronze scroll
tacit shard
# bronze scroll you mean the script its sending it too?

no, you are using conversation.process and storing its responce in kids_message then looking for .speech.plain.speech inside that and its complaining that .speech doesnt exist so you need to look at the format of kids_message to find out what it actually needs

#

look at the part of the trace that handles the conversation.process

#

probably this one:

tacit shard
#

change this
message: "{{ kids_message.speech.plain.speech }}"
to
message: "{{ kids_message.text }}"
when calling your script

bronze scroll
#

for both the automation and script i got: Error: Error rendering data template: UndefinedError: 'kids_message' is undefined

#

when i changed to message: "{{ kids_message.text }}"

#

`alias: Test automation
description: ""
triggers:

  • trigger: state
    entity_id:
    • input_boolean.test
      from: "off"
      to: "on"
      conditions: []
      actions:
  • data:
    agent_id: conversation.kids_ai
    text: >-
    Craft a fun message for the kids, reminding them that game time is over
    and they have 10 minutes to save their progress before shutdown.
    Randomly include quotes from Invader Zim, Gumball, Teen Titans Go, and
    Sonic.
    language: en
    response_variable: kids_message
    action: conversation.process
  • delay:
    seconds: 2
  • data:
    message: "{{ kids_message.text }}"
    action: script.game_time_actions
    mode: single`
tacit shard
#

try kids_message.data.text

bronze scroll
#

do i update also in my script too to match

tacit shard
#

did you copy this from somewhere to begin with?

#

sorry you probably actually want the automation to return the entire dict
so change it to
"{{ kids_message }}"
then we can try and deal with it in the script

#

then inside the script you want to output

{{ message.text }}
becasue the data you send to the script is stored in the field message and then the variable of the dict is text

#

i have absolute no idea where .speech.plain.speech came from? copied or hallucinated i guess

bronze scroll
#

is this correct. the original automation was created by chatgpt

tacit shard
#

that looks right, does it work? if not where is it erroring?

#

also in future don't start with "i made this automation" if its AI generated. tell people thats its AI generated. as thats probably why it doesnt work and needs to be looked at differently

bronze scroll
#

ok it got to the script and produce this error on the script

tacit shard
#

data section should be:

  entities: scene.game_time_before```
tacit shard
#

oh wait i think it should be entity id but the action is wrong

#
target:
  entity_id: scene.game_time_before```
bronze scroll
#

alias: Restore TV Volume and Surround Sound
action: scene.turn_on
target:
entity_id: scene.game_time_before

tacit shard
#

yeah

bronze scroll
#

ok it ran all the way through this tim but no announcment was made on any of my speakers?

tacit shard
#

what does the trace show for the make announcement section

tacit shard
#

on the step details

bronze scroll
#

no announcementwas made

tacit shard
#

yeah because the variable its trying to use is not returning anything

bronze scroll
#

oh damnit lol

tacit shard
#

i am starting to think it might be easier to start from scratch. this AI generated chaos is just painful to try and adapt

bronze scroll
#

ok i will do that. just wanted to make it fun for my kids and make them laugh

tacit shard
#

yeah i see what your trying to achive. but the AI is hulicinating stuff that does not exist

bronze scroll
#

yeah lol how should i start?

tacit shard
#

ok so this is a stripped down automation that should just get the responce and announce it

#
description: ""
triggers:
  - trigger: state
    entity_id:
      - input_boolean.test
    from: "off"
    to: "on"
conditions: []
actions:
  - action: conversation.process
    metadata: {}
    data:
      text: >-
        Craft a fun message for the kids, reminding them that game time is over
        and they have 10 minutes to save their progress before shutdown.
        Randomly include quotes from Invader Zim, Gumball, Teen Titans Go, and
        Sonic.
    response_variable: kids_message
  - alias: Make Announcement
    action: notify.alexa_media
    data:
      message: "{{ kids_message.text }}"
      target:
        - media_player.echo_show
        - media_player.jamar_echo
        - media_player.echo_king
        - media_player.paris_echo
mode: single
#

try that and see if it works on its own without all the other adjustments

bronze scroll
#

just asking restart or single mode?

tacit shard
#

it probably doesnt matter but leave on single

bronze scroll
#

nothing was announced?

tacit shard
#

look at the conversation process section

bronze scroll
tacit shard
#
description: ""
triggers:
  - trigger: state
    entity_id:
      - input_boolean.test
    from: "off"
    to: "on"
conditions: []
actions:
  - action: conversation.process
    metadata: {}
    data:
      text: >-
        Craft a fun message for the kids, reminding them that game time is over
        and they have 10 minutes to save their progress before shutdown.
        Randomly include quotes from Invader Zim, Gumball, Teen Titans Go, and
        Sonic.
      agent_id: conversation.kids_ai
    response_variable: kids_message
  - alias: Make Announcement
    action: notify.alexa_media
    data:
      message: "{{ kids_message.text }}"
      target:
        - media_player.echo_show
        - media_player.jamar_echo
        - media_player.echo_king
        - media_player.paris_echo
mode: single
#

i missed the agent id for your ai integration

bronze scroll
#

dangit now another issue.

#

is that the open ai tokens i have to replenish?

tacit shard
#

i dont know your openai status but we can maybe get this working to the point it at least announces the error

#

then you can sort out your openai account

#

at least now i know where paramaters from earlier came from

#

can try

#
description: ""
triggers:
  - trigger: state
    entity_id:
      - input_boolean.test
    from: "off"
    to: "on"
conditions: []
actions:
  - action: conversation.process
    metadata: {}
    data:
      text: >-
        Craft a fun message for the kids, reminding them that game time is over
        and they have 10 minutes to save their progress before shutdown.
        Randomly include quotes from Invader Zim, Gumball, Teen Titans Go, and
        Sonic.
      agent_id: conversation.kids_ai
    response_variable: kids_message
  - alias: Make Announcement
    action: notify.alexa_media
    data:
      message: "{{ kids_message.speech.plain.speech }}"
      target:
        - media_player.echo_show
        - media_player.jamar_echo
        - media_player.echo_king
        - media_player.paris_echo
mode: single```
#

if we get it doing stuff and announcing the error then when you sort out openai subscription stuff it should start working

bronze scroll
#

do i need to add a delay to give it time to process the conversation

tacit shard
#

no its a blocking step

#

it doesnt continue until its done

bronze scroll
tacit shard
#

try adding responce in there

#
description: ""
triggers:
  - trigger: state
    entity_id:
      - input_boolean.test
    from: "off"
    to: "on"
conditions: []
actions:
  - action: conversation.process
    metadata: {}
    data:
      text: >-
        Craft a fun message for the kids, reminding them that game time is over
        and they have 10 minutes to save their progress before shutdown.
        Randomly include quotes from Invader Zim, Gumball, Teen Titans Go, and
        Sonic.
      agent_id: conversation.kids_ai
    response_variable: kids_message
  - alias: Make Announcement
    action: notify.alexa_media
    data:
      message: "{{ kids_message.response.speech.plain.speech }}"
      target:
        - media_player.echo_show
        - media_player.jamar_echo
        - media_player.echo_king
        - media_player.paris_echo
mode: single```
bronze scroll
#

Finaly got a response. max output token my alex just said

tacit shard
#

ok so we have that part, now we just need to add the adjustment stuff back in

bronze scroll
tacit shard
#

you totally delete everything you had before

#

i added the adjustment stuff you said was working before to the automation

#

oh whoops

#

sorry had the old not working responce var in there

#

hopefully should all be combined now

#

i am not sure its entirily right but can at least test it and go from there

bronze scroll
#

going to implement it in my current automation.

#

i have diffrent times for it to run for the reminders

tacit shard
#

ok, well at lease you now have the 2 blocks you need to get the variable and to play the variable.
you can mess with stuff around that

bronze scroll
#

change them all to this {{ kids_message.response.speech.plain.speech }}

tacit shard
#

you need to use both the section that generates the responce and the notify section

#

on the stripped down automation. there were 2 blocks.
add your other stuff around them

bronze scroll
#

ok once i complete the full automation ill post it here if you dont mind reviewing

tacit shard
#

ill have a quick look if its not working, but hopefully you should be able to put the pieces together now

#

treat this as a learning exercise

bronze scroll
#

thank you sir, really appreciate it. so all i have to do now is get some openapi tokens and rewrite my automation

#

just asking do you know exactly where i can replinsh my openapi tokens

tacit shard
#

i have no idea, i havent ever used it. but i assume you log in and set up payment terms. its usually pay as you use i think?

bronze scroll
#

i go it

bronze scroll
#

Message malformed: extra keys not allowed @ data['actions'][0]['choose'][0]['sequence'][0]['lias']

tacit shard
#

lias: Save Current TV States

should be

alias: Save Current TV States