Alert not activating or sending notification

I’m trying to create an alert that activates when I absorb over 3.3kW from the grid. I have created the current configuration:

template:
  - binary_sensor:
      - name: "Overpower Grid"
        unique_id: grid_overpower
        state: "{{ states('sensor.inverter_fotovoltaico_grid_power')|float(0) > 10 }}"
        delay_on:
          seconds: 1
        delay_off:
          seconds: 1

alert:
  grid_overpower:
    name: "Superata la potenza massima della rete elettrica"
    title: "Supero potenza rete elettrica"
    message: "Allarme Consumo: Superati 3.3kW di assorbimento dalla rete."
    done_message: "Assorbimento rete rientrato."
    entity_id: binary_sensor.grid_overpower
    state: "on"
    repeat: 0.016
    notifiers:
      - google_assistant_sdk
      - mobile_app_s20_fe_di_stefano

I have put 10 for now instead of 3300, just for testing, but it does not work.
The template state is “on”, but the alert remains “idle”.

I have also tried to use the debug tools for manually forcing the state of the alert to “on”, but no notifications are sent.

What could be the problem?

I don’t know if this is the only problem, but what is this line supposed to do? Are you trying to repeat the message every 0.016*60=0.96 seconds? The docs say the repeat parameter needs to be an integer.

I put 0.016 just because the YAML check tool said it’s the minimum value that can be used:

Configuration warnings

Invalid config for ‘alert’ at configuration.yaml, line 48: value must be at least 0.016 ‘alert->grid_overpower->repeat->0’, got None

I have also tried putting 1 and 5, but I had no luck; the same problem occurred.

It’s been a while since I tested it but IIRC, Alerts function just like Automation triggers, the value of binary_sensor.grid_overpower needs to change from “off” to “on”. Try using the “Set State” tool to set binary_sensor.grid_overpower “off” then “on”.

I was wondering about that. The doc is less than clear about this:

In this example, the garage door status (input_boolean.garage_door ) is watched and this alert will be triggered when its status is equal to on .

Unlike an automation, given that alerts can repeat makes an “equality” test workable. It makes sense that the fact that the state isn’t changing would be the problem here, since OP set the threshold low for testing purposes.

I have tried different things, but nothing works. Even if I manually set binary_sensor.grid_overpower “off” and then “on”, the alarm doesn’t trigger.
Also, if I manually set the alarm to the “on” state, I don’t receive any notification.

Just for contest, I’m running my HA on a Raspberry Pi 5 as the main OS, and I probably had some issues with the time. I think I solved it by installing the addon chrony, but nothing changed apparently.