How keep or get last historical data?

Hi all!
i created sensor

- platform: command_line
  unique_id: wheather_1d
  name: Precipitation
  command: |
        wget -q --user-agent='Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.80 Safari/537.36' "https://yandex.ru/pogoda/maps/nowcast?lat={{states.zone.home.attributes.latitude}}&lon={{states.zone.home.attributes.longitude}}" -O /dev/stdout | sed 's/>/>\n/g' | grep "weather-maps-fact__nowcast-alert" -A1 | tail -1 | sed 's/<\/div>//g' | sed 's|.*\. ||'
#  value_template: "{{ value if value != '' else 'HTTP ERROR' }}"

But if the sensor gets an error, then I see a void (so i added my text “HTTP ERROR”)
How keep old value OR get last (not null) historical data?