Help with power sensor to show last value instead of "0" but allow negative value

I have an energy sensor that shows real time power usage, only problem is it drops to 0 once in a while. Im trying to have it display the last value if the sensor is at 0. I have this which is working but I have solar as well which means I will get a negative value to, and when I get a negative value it shows unavailable.

this is what I have

  - sensor:
      - name: sensor.torrance_street_123_1min_2
        unit_of_measurement: "W"
        unique_id: Current Watt Use
        state: >-
          {% set e = states('sensor.torrance_street_123_1min') %}
          {% if e | is_number and e | int(0) > 0 %}
             {{ e | int(0)  }}
          {% else %}
             {{ this.state }}
          {% endif %}

[...] and e | int(0) != 0 %}