How to create an automation to control my solar panels

Hello,
I do not know what the rule to control the pump for my solars (warm water) should look like

  • The pump activates if the temperature is higher than the pool water
  • It turned off if the temperature of the solar panels is lower than the water in the pool (the sun goes down)

water temperature sensor : ‘sensor.hottub_pump_temp’
pump solar temperature sensor : ‘sensor.sonoff_1001032177_temperature’

  • alias: solar heater
    trigger:
    • type: temperature
      platform: device
      device_id: ???
      entity_id: ???
      domain: sensor
      above: ???
      condition:
    • condition: device
      type: is_on
      device_id: f51f4991e24193061dcc106513c49e1b
      entity_id: switch.sonoff_1001032177
      domain: switch
      action:
    • type: turn_off
      device_id: f51f4991e24193061dcc106513c49e1b
      entity_id: switch.sonoff_1001032177
      domain: switch
      mode: single