Creating a Smart Pool Temperature Sensor: Tips and Tricks

Hey everyone! I’ve been working on a fun project to create a smart pool temperature sensor using Home Assistant. The goal is to have a sensor that only updates when the pool pump is running and holds the last temperature reading when the pump is off. This way, I can keep track of the pool temperature without unnecessary updates when the pump isn’t active.

Here’s what I’ve tried so far:

yaml
sensor:

  • name: current_pool_temperature
    unique_id: id_pool_temperature
    state: “{{ states(‘sensor.water_temp_temperature’) }}”
    availability: “{{ is_state(‘switch.shellyplus2pm_d48afc787034_switch_0’, ‘on’) }}”
    unit_of_measurement: “°F”
    device_class: temperature
    state_class: measurement

The idea is that the sensor should only update when the pump (controlled by the Shelly Plus 2PM switch) is on. However, I’m running into an issue where the sensor shows “unavailable” when the pump is off, which isn’t what I want. I’ve tried adjusting the availability settings and even looked into adding delays, but nothing seems to work quite right.

Has anyone tackled a similar project? I’d love to hear your tips or tricks for making this work smoothly. Maybe there’s a way to modify the template or use a different approach altogether. Let me know if you’ve got any suggestions—this would be a great addition to my smart home setup! :swimming_man::male_sign::sparkles: