Create sensor to read last value (for solar panels)

I want to read the last value before it shuts down, any ideas?