Dummy temp sensor for swimming pool

Hello everyone,

May be can someone help me… I have a external pool and I plugged a temp sensor close to the water pump.
Works well but during the night, the water stops and get to air temperature and make my sensor wrong for water temp tracking.
Is it possible to have a dummy temp sensor which only takes the temperature from my sensor between 10am to 4pm so my average is correct and I can more easily program my water heating?

Thanks for your support!
Cheers.
Sam

Is it not better to place the existing sensor in the right place?

Yeah that would be the best solution. However if it is not possible try this:

configuration.yaml

template:
  - sensor:
      - name: Pool Temperature
        device_class: temperature
        state_class: measurement
        state: "{{ states('sensor.your_temperature_sensor_here') }}"
        availability: "{{ is_state('switch.your_pump_switch_here','on' }}"

Alternatively if you do not have a switch controlling the pump:

        availability: "{{  10 < now().hour < 16 }}"

If you live somewhere that has daylight savings this could complicate matters slightly.

Thanks for the code. Really amazing !!!
Impossible to move the sensor somewhere else. It is next to the pump which is much better than put a sensor in a middle of a pool (which is ugly and will fail after some time).

Hello, the “dummy” sensor (helpers) is not updating with the other sensor temp. Here is my configuration.yaml.
So any help would be amazing!

template:

  • sensor:
    • name: Temperature Piscine
      device_class: temperature
      state_class: measurement
      state: “{{ states(‘sensor.temperature_eau_piscine_air_temperature’) }}”
      availability: “{{ is_state(‘input_boolean.pompe_piscine’,‘on’ }}” → I did remove this one to make sure this was not the reason.

The real sensor
image

The dummy/sensor
image

Any support please?

Please share your template sensor config correctly formatted for the forum. https://community.home-assistant.io/t/how-to-help-us-help-you-or-how-to-ask-a-good-question/114371#oneone-format-it-properly-16

Where did you put the template: sensor?

It goes in configuration.yaml, not sensors.yaml.

If this is the first time you have created a template sensor you need to restart home assistant. After that you can use reload when adding new template sensors or editing existing ones.

Are there any errors in Settings → System → Logs relating to your sensors?