Surplus Solar Power

I am working on a solution to consume my surplus solar power for a water heater. Instead of a simple on/off system, I want to dynamically adjust the power to the heater based on the available surplus power (i.e., x W surplus means x W to the water heater).

My setup includes:

  • A SSR-40-DA controlled via a Wemos D1 Mini programmed in ESPHome.
  • A smart meter (P1) that reads production and consumption power every 10 seconds.

I have some questions and concerns:

  1. Optimal PWM Frequency:

    What would be the optimal frequency for the pwm_output to operate? It could be 1 Hz (1 cycle per second), but measurements are taken every 10 seconds, so perhaps it would be better to use 0.1 Hz (1 cycle per 10 seconds). With a duty cycle of, let's say, 50%, at 1 Hz, the heater will turn on/off every half second, whereas at 0.1 Hz, the heater will remain on for 5 seconds and off for 5 seconds. What frequency would be best for minimizing stress on the heater and SSR, and for efficient operation?

  2. Using a 'Dumb' Heater with a Thermostat:

    I have read that it's best to use a 'dumb' heater, but my heater has a built-in thermostat. Is it safe to apply PWM to the entire water heater, or would it be better to keep the thermostat powered on continuously and only PWM the heating element itself? I'm concerned about potential damage to the thermostat due to frequent power cycling.

Any insights or recommendations would be greatly appreciated!