Help me convert my last YAML automation

Hi all, I’ve managed to get all of my YAML automations moved over except one. Can anyone help me convert this.

The only part that I’m struggling with in is the tts.google_say part. I just don’t know how to add this (not really a coder, I can just hack stuff together).

- id: 'morning_motion'
  alias: 'Morning Motion'
  initial_state: true
  trigger:
    - platform: state
      entity_id: binary_sensor.hall_motion_sensor
      to: 'on'
  condition:
    condition: and
    conditions:
      - condition: time
        before: '09:00:00'
        after: '05:30:00'
      - condition: state
        entity_id: group.family
        state: 'home'
      - condition: template
        value_template: '{{ (as_timestamp(now()) - as_timestamp(states.automation.morning_motion.attributes.last_triggered | default(0)) | int > 10800)}}'
  action:
    - service: script.good_morning
    - service: media_player.volume_set
      data_template:
        entity_id: media_player.lounge_speaker
        volume_level: 0.5
    - service: tts.google_say
      data_template:
        entity_id: media_player.lounge_speaker
        message: |
          
          {% if is_state('alarm_control_panel.ha_alarm', 'disarmed') %}
            {{["Good morning.","Morning.","Good Morning Gringos.","Good morning Granger house."] | random}}
          {% else %}
            {{["Good morning.","Morning.","Good Morning Gringos.","Good morning Granger house."] | random}}
          {% endif %}

          Today is 
          {{as_timestamp(now()) | timestamp_custom('%A')}}, {% set day = (as_timestamp(now()) | timestamp_custom('%d')) |int-%}
          {{day}}{%- if day >= 4 and day <= 20 or day >= 24 and day <= 30 -%}th
          {%- elif day == 1 or day == 21 or day == 31-%}st
          {%- elif day == 2 or day == 22 -%}nd
          {%- elif day == 3 or day == 23 -%}rd
          {%- endif %} {{as_timestamp(now()) | timestamp_custom('%B')}}.
          It's currently {{states('sensor.dark_sky_summary')}} and {{states("sensor.dark_sky_temperature")|round}} degrees.
          Today will be {{states('sensor.dark_sky_hourly_summary')|replace(".", "")}}

You can try this one i simplified so the templates would render for me, you will have to add the rest of the template text

Also need to add the rest of the services you require at the end, either in parallel or sequentially

[{"id":"76b833ea.6c710c","type":"trigger-state","z":"64b0477e.6a31f8","name":"","server":"d5ce5cec.92bc8","exposeToHomeAssistant":false,"haConfig":[{"property":"name","value":""},{"property":"icon","value":""}],"entityid":"binary_sensor.hall_motion_sensor","entityidfiltertype":"exact","debugenabled":false,"constraints":[{"id":"zzc7b25xcxc","targetType":"this_entity","targetValue":"","propertyType":"current_state","propertyValue":"new_state.state","comparatorType":"is","comparatorValueDatatype":"str","comparatorValue":"on"},{"id":"6o2jhyb991s","targetType":"entity_id","targetValue":"group.family","propertyType":"current_state","propertyValue":"new_state.state","comparatorType":"is","comparatorValueDatatype":"str","comparatorValue":"home"}],"constraintsmustmatch":"all","outputs":2,"customoutputs":[],"outputinitially":false,"state_type":"str","x":380,"y":600,"wires":[["f2a2d06b.689cb"],[]]},{"id":"f2a2d06b.689cb","type":"time-range-switch","z":"64b0477e.6a31f8","name":"","lat":"","lon":"","startTime":"5:30","endTime":"9:30","startOffset":0,"endOffset":0,"x":670,"y":600,"wires":[["4e2e27b6.3a3908"],[]]},{"id":"4e2e27b6.3a3908","type":"api-render-template","z":"64b0477e.6a31f8","name":"tmpl","server":"d5ce5cec.92bc8","template":"{{ (as_timestamp(now()) - as_timestamp(states.automation.bathroom_humidity_update_change_rate.attributes.last_triggered | default(0)) | int > 10800)}}","resultsLocation":"payload","resultsLocationType":"msg","templateLocation":"template","templateLocationType":"msg","x":830,"y":600,"wires":[["981c3955.5a8ff8"]]},{"id":"981c3955.5a8ff8","type":"switch","z":"64b0477e.6a31f8","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"True","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":970,"y":600,"wires":[["fae95d1f.f99fb"]]},{"id":"fae95d1f.f99fb","type":"api-render-template","z":"64b0477e.6a31f8","name":"tmpl","server":"d5ce5cec.92bc8","template":" {{[\"Good morning.\",\"Morning.\",\"Good Morning Gringos.\",\"Good morning Granger house.\"] | random}}","resultsLocation":"payload","resultsLocationType":"msg","templateLocation":"template","templateLocationType":"msg","x":830,"y":680,"wires":[["732a436b.9571ac"]]},{"id":"732a436b.9571ac","type":"change","z":"64b0477e.6a31f8","name":"","rules":[{"t":"set","p":"message","pt":"flow","to":"(\t{\"message\": payload}\t)","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":990,"y":680,"wires":[["f5f7dc8d.3088d"]]},{"id":"f5f7dc8d.3088d","type":"api-call-service","z":"64b0477e.6a31f8","name":"","server":"d5ce5cec.92bc8","version":1,"debugenabled":false,"service_domain":"media_player","service":"tts.google_say","entityId":"media_player.lounge_speaker","data":"","dataType":"json","mergecontext":"message","output_location":"","output_location_type":"none","mustacheAltTags":false,"x":1270,"y":680,"wires":[[]]},{"id":"d5ce5cec.92bc8","type":"server","z":"","name":"Home Assistant","legacy":false,"hassio":false,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true}]
1 Like

FYI
Since version 0.92, the google text-to-speech platform was renamed to google_translate. The service is now called tts.google_translate_say

1 Like

Amazing - Thanks so much for this! You have actually given me a springboard to rebuild some other automations that I had simplified to get into node red. Superstar!