Aqualink Temperature Sensor Unknown

I hae an aqualink integration through HA which works wonderfully. However, a drawback is that when the pool pump is off, the temperature sensor reports as ‘Unknown’. This happens both in HA and in the iAqualink App so I do not expect that to change.

However, is there a way to create a helper sensor that would:

  1. Report the pool temperature when value is other than ‘Unknown’; and
  2. Report the last known pool temperature if the value changes to ‘Unknown’.

For example, if the pump is running and the temperature is 78 when the pump starts and raises to 81 when the pump turns off (and HA reports ‘unknown’), the custom sensor would say 81 until such time as the pump is turned on again and a new temperature can be reported.

So I did some more research. Is there an automation that would allow me to capture the temperatuere of the water every hour of the day and save that temperature wthin the sensor as an entity (lastknowntemp) or something similar?

I could then take this temperature and pass it to a custom sensor to just report the temperature that would not say ‘unknown’