How to prevent unavailable in template sensors?

default 0 sets the value to 0 if the device is offline. and that will also affect my total counter. it’s an increasing number (of made cofffee :D) so pulling it to 0 is not the way…