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(".", "")}}