#can anyone help me getting a condition in an action i don't understand how could do this

42 messages · Page 1 of 1 (latest)

wide mango
#

i have a working automation but i want to get an condition in it
the automation may not do the google tts if the sun is below horizon so it doesn't wake me up in the night
but it may do the notify telegram things
Could anyone please make a change to my code?

alias: togoodtogobakkerijdemuynck
description: ""
mode: single
triggers:
  - entity_id: sensor.tgtg_bakkerij_demuynck
    for: "00:00:05"
    trigger: state
conditions:
  - condition: template
    value_template: "{{ trigger.from_state.state|int(0) < trigger.to_state.state|int(0) }}"
actions:
  - data:
      message: Bakkerij Demunck heeft weer to good to go deals!
    action: notify.parents
  - delay:
      hours: 0
      minutes: 0
      seconds: 0
      milliseconds: 500
  - data:
      action:
        - data:
            language: nl
            entity_id: media_player.alles
            message: Bakkerij Demunck heeft weer to good to go deals!
            cache: true
          extra:
            entity_id: media_player.alles
          action: tts.google_say
    action: script.google_home_resume
  - data:
      message: Bakkerij Demunck heeft weer to good to go deals!
    action: notify.telegram_martine

so i only want the below horizon in the 2th action that does the media_player tts
Thanks on advance

zealous marten
#

But you still want to do the last action all the time?

wide mango
#

yes

#

there are 3 actions in this automation

zealous marten
#

I saw that

wide mango
#

2 doing notify telegram the first and the last one the middle one needs an condition i don't want this one to run at night

zealous marten
#

Use an if/then

wide mango
#

ok i'm not very great in that automation coding 😉

zealous marten
#

Or move the second one to the end and add a condition before it

wide mango
#

hm thats an idea

zealous marten
#

You enjoy have to be great at

#

Do it all in the UI

wide mango
#

yeah but i don't find an option how to add the condition

#

oh found it

#

under building block

zealous marten
#

You can just search:

wide mango
#

yes i found it thanks !!

#

and it works

wide mango
#

at least it didn't reported me at night

#

but its not working fully yet

#

the condition part works but i have trouble with the script google tts

#

it doesn't do anything this

#

but i get the test telegram message

#

so the problem isn't the condition

#

you can see above the original code and here below the new:

#
alias: togoodtogobakkerijdemuynck
description: ""
triggers:
  - entity_id: sensor.tgtg_bakkerij_demuynck
    for: "00:00:05"
    trigger: state
conditions:
  - condition: template
    value_template: "{{ trigger.from_state.state|int(0) < trigger.to_state.state|int(0) }}"
actions:
  - data:
      message: Bakkerij Demunck heeft weer to good to go deals!
    action: notify.parents
  - data:
      message: Bakkerij Demunck heeft weer to good to go deals!
    action: notify.telegram_martine
  - delay:
      hours: 0
      minutes: 0
      seconds: 0
      milliseconds: 500
  - if:
      - condition: sun
        after: sunrise
    then:
      - data:
          action:
            - data:
                language: nl
                entity_id: media_player.alles
                message: Bakkerij Demunck heeft weer to good to go deals!
                cache: true
              extra:
                entity_id: media_player.alles
              action: tts.google_say
        action: script.google_home_resume
      - action: notify.telegram_alex
        data:
          message: test
mode: single
#

i hope someone see's whats wrong

#

so i get the test message but not the google say

wide mango
wide mango
#

@tulip socket maybe

tulip socket
#

Check the trace from the Google Home Resume script

wide mango
tulip socket
#

That's not the trace of the Google Home Resume script, that's the trace of your automation

tulip socket
#

You need to update the script. Version 2024.9 adds support for the change from service to action

wide mango
#

hm is this the problem you think?

#

i didn't saw that there was an update sorry

#

Nice this was the problem

#

its not working like a sharm thanks