Schedule switch with google calendar


I’m new on hassio and need some help to schedule a switch with google calendar.
All calendars are working because i can see changes from disabled to enabled on calendar entity every time I create an event on google calendar:

- cal_id: [email protected]
  - device_id: xxxxx_gmail_com
    ignore_availability: true
    name: [email protected]
    track: true
  - device_id: test
    ignore_availability: true
    name: test
    track: true

I have created an automation with the calendar and the switch with this code:

- id: '1552340082272'
  alias: Prova Test
  - platform: state
    entity_id: calendar.test
    to: 'on'
    service: switch.turn_on
    entity_id: switch.llumtest

If I click to execute automation, it turns the switch on, but for an unknown reason the automation is not triggered by the calendar.test. If I change the trigger event with a time platform, automation is working correctly.

What I’m doing wrong?

Best Regards