Reset a trigger based sensor

I have the following Trigger Based sensors Trigger sensors. They are working great, but I want to reset the values to zero and get new values. I can’t see how to do that. Any help would be appreciated.

In standard add another trigger on e.g. Whatever state, boolean helper, etc. And if this is triggering, set it to 0.

Out of standard, you can install custom code or integrations, which are adding services to manipulate sensor data as well.

I usually use a custom event trigger, but you can use any trigger type you want as long as you make sure your templates are set up to filter correctly.

template:
  - trigger:
      - platform: state
        entity_id:
          - sensor.lux_solar_output_live
          - sensor.maximum_incoming_watts_combined
        to:
      - platform: event
        event_type: custom_reset_max_watts
    sensor:
      - name: "Maximum Incoming Watts Combined"
        unit_of_measurement: W
        unique_id: maximum_incoming_watts_combined
        state: >-
          {% if trigger.platform == 'event' %}
          0
          {% else %} 
          {{ [states('sensor.maximum_incoming_watts_combined'), states('sensor.lux_solar_output_live')] | map('float', 0) | max }}
          {% endif %}

I don’t specifically want to reset them on a trigger. I just want to reset them to zero. I am recording the maximum watts my solar panels have produced. Once summer is over, I want to record the maximum for autumn and then in 2024.

Effectively, you do want to reset it on a trigger. Your trigger is a date and time; it’s the start of the first day of each season.

Thanks for the feedback. Does this look right? I can just change the date and time when I want to reset the values.

  - trigger:
      - platform: state
        entity_id:
          - sensor.lux_solar_output_array_1_live
          - sensor.maximum_incoming_watts_back
      - platform: time
    	at: '2023-06-25 14:00:00'  # Specify the desired date and time
        to:
    sensor:
      - name: "Maximum Incoming Watts Back"
        unique_id: maximum_incoming_watts_back
        state: >-
          {% if trigger.platform == 'time' %}
          0
          {% else %}
           {{ [states('sensor.maximum_incoming_watts_back')|float(0), states('sensor.lux_solar_output_array_1_live')|float(0)] | max }}
          {% endif %}

According to the documentation for Time Trigger, it won’t accept a string containing date and time (only time). However it will accept the entity_idof an Input Datetime helper containing date and time.

Thanks for sticking with me. I have made a new Date Time help called -

input_datetime.solar_panel_watt_reset

How does this look?

  - trigger:
      - platform: state
        entity_id:
          - sensor.lux_solar_output_array_1_live
          - sensor.maximum_incoming_watts_back
      - platform: time
    	at: input_datetime.solar_panel_watt_reset  # Specify the desired date and time
        to:
    sensor:
      - name: "Maximum Incoming Watts Back"
        unique_id: maximum_incoming_watts_back
        state: >-
          {% if trigger.platform == 'time' %}
          0
          {% else %}
           {{ [states('sensor.maximum_incoming_watts_back')|float(0),states('sensor.lux_solar_output_array_1_live')|float(0)] | max }}
          {% endif %}

Remove this line because it’s not a valid option for a Time Trigger.

        to:

Thanks for the help. I finally got to update my config.yaml. For completeness this is what I used.

 # Watt input from the back string with reset date and time
  # The date and time is under the Helper section
  - trigger:
      - platform: state
        entity_id:
          - sensor.lux_solar_output_array_1_live
          - sensor.maximum_incoming_watts_back
      - platform: time
        at: input_datetime.solar_panel_watt_reset  # Specify the desired date and time
    sensor:
      - name: "Maximum Incoming Watts Back"
        unique_id: maximum_incoming_watts_back
        state: >-
          {% if trigger.platform == 'time' %}
          0
          {% else %}
           {{ [states('sensor.maximum_incoming_watts_back')|float(0), states('sensor.lux_solar_output_array_1_live')|float(0)] | max }}
          {% endif %}