Notifications when solar stops producing

I want my automation to notify me when my solar have stopped producing every night.
Notification needs to give me produced electricity, sold and imported.
Everything works great if i put below 1 kWh (below: ‘1’) but my solar panels will produce under 1kwh a few hours so I want it to be “below: 0” but that does not work, I tried 0.1 and that will not work.
How can a make it work with 2 or 3 decimals? Like 0.100? or even better just with 0.

I have other automations that i want this to work on, it just works on 1, 2. 3. 4. and so on, no decimals.

Here is my code:

alias: Producerat, sålt, köpt idag
description: ""
trigger:
  - platform: numeric_state
    entity_id: sensor.active_power
    below: "Needs to be 0 or 0.1"
    for:
      hours: 0
      minutes: 0
      seconds: 0
condition: []
action:
  - service: notify.notify
    data:
      message: >-
        Energiproduktionen upphörde idag.  Producerad El idag: 
        {{states('sensor.daily_yield')}} kwh.  Köpt idag: 
        {{states('sensor.grid_import_solar_daily_energy')}} kWh.  Sålt idag: 
        {{states('sensor.grid_export_solar_daily_energy')}} kWh.
mode: restart

Would a template trigger == 0 work?

Use a template and convert your sensor to watt (I added a “for” so in this case the automation will trigger if the power is below 1 watt for 10 minutes) :

  - platform: template
    value_template: "{{ (states('sensor.active_power') | float(0) * 1000.0) < 1 }}"
    for: "00:10:00"

I would not use a template with == 0 for solar panels because during the night, the inverters are consuming electricity (instead of producing some)… So the power will be slightly negative… at the limit, I would use “<= 0” instead of “==0”…

Thanks, If i change this < 1 }}" to < 1000 }}" that means it is 1kw?

Here is the code, is this correct then?

alias: Producerat, sålt, köpt idag
description: ""
trigger:
  - platform: template
    value_template: "{{ (states('sensor.active_power') | float(0) * 1000.0) < 1 }}"
    for: "00:10:00"
condition: []
action:
  - service: notify.notify
    data:
      message: >-
        Energiproduktionen upphörde idag.  Producerad El idag: 
        {{states('sensor.daily_yield')}} kwh.  Köpt idag: 
        {{states('sensor.grid_import_solar_daily_energy')}} kWh.  Sålt idag: 
        {{states('sensor.grid_export_solar_daily_energy')}} kWh.
mode: restart

Yes it should work …

Yes just tested it, it works, thank you :slight_smile:

I also have a norpool automation, and want it to notify when spotprice are low and high, but same problem here.
But i guess i need to make a similar template to get this working?

alias: Spotpris
description: ""
trigger:
  - platform: numeric_state
    entity_id: sensor.nordpool_kwh_fi_eur_3_10_024
    above: "0.20"
    attribute: max
condition: []
action:
  - service: notify.notify
    data:
      message: >-
        Spotpriset är nu:     {{states('sensor.nordpool_kwh_fi_eur_3_10_024')}}
        €
mode: restart

Yes try a similar template…