Google Calendar "widget" on website

Hi,
i’m writing this for helping other people.
i’ve set google calendar native support and used this code to read the next event in calendar and then use it in a entity.

in configuration.yalm:

sensor:
  - platform: template
    sensors:
      template_calendar_veritas:
        value_template: >
          {%- set date = as_timestamp(strptime(states.calendar.CALNAME.attributes.start_time, "%Y-%m-%d %H:%M:%S")) -%}
          {% set giorno = ["Domenica", "Lunedì", "Martedì", "Mercoledì", "Giovedì", "Venerdì", "Sabato"] %}
          {% set mese = ["Gennaio", "Febbraio", "Marzo", "Aprile", "Maggio", "Giugno", "Luglio", "Agosto", "Settembre", "Ottobre", "Novembre", "Dicembre"] %}
          {% set m_ok = date | timestamp_custom("%m") | int %}
          {% set g_ok = date | timestamp_custom("%w") | int %}
          {% set giorno_della_settimana = giorno[g_ok] %}
          {% set giorno_del_mese = date | timestamp_custom("%d") %}
          {% set mese = mese[m_ok - 1] %}
          {{ giorno_della_settimana }} {{ giorno_del_mese }} {{ mese }}: {{ states.calendar.CALNAME.attributes.message }}
        friendly_name: CALNAME
        unit_of_measurement: ''

change CALNAME with the identifier of the calendar you want.

in lovelace:

entity: sensor.template_calendar_CALNAME
icon: 'mdi:calendar'
name: Next Event
type: entity

part of the code found here: