I understood thanks to juan11perez on github https://github.com/home-assistant/home-assistant/issues/20014#issuecomment-455237468
that service_template must now have IF ELSE and ENDIF. but I do not know how to solve the following case, automation does not have to do anything except turn on the scene in those specific time slots.
- id: arrivo_a_casa
alias: “Arrivo a casa”
hide_entity: true
trigger:
- platform: state
entity_id: group.famiglia
from: 'not_home'
to: 'home'
action:
- wait_template: "{{ is_state('sensor.hue_motion_sensor_motion_1', 'on') }}"
- service_template: >
{% if states.sensor.periodo_dal_giorno.state != 'giorno' %}
scene.turn_on
{% endif %}
data_template:
entity_id: >
{% if (now().hour < 5) %}
scene.zona_giorno_notte
{% elif (now().hour < 23) %}
scene.zona_giorno_normale
{% elif (now().hour == 23) and (now().minute < 59) %}
scene.zona_giorno_notte
{% endif %}
- condition: time
after: '9:00:00'
before: '22:00:00'
- service: homeassistant.turn_on
entity_id: script.riproduci_caminetto
- condition: time
after: '18:00:00'
before: '22:00:00'
- service: homeassistant.turn_on
entity_id: switch.presa_3