Integrating Shelly 3EM with AV Dimmer and ESP32 for Solar Energy Optimization

I’ve been working on a project to optimize my water heater’s energy consumption using solar power, and I’d love to share my journey and ask for some advice! :sun_with_face:

I’ve successfully integrated a Shelly 3EM energy monitor with a Shelly 1 relay to control my water heater. The setup is pretty straightforward: the Shelly 1 turns the heater on when the net energy consumption drops below -1000W and keeps it running as long as this threshold is maintained. It’s been working like a charm, especially during sunny days when solar production is high. :sun_with_face::sparkles:

However, with winter approaching, I’ve noticed that solar production isn’t always sufficient to meet the 1000W threshold. On cloudy days, the system often exports around 700W back to the grid, which means the water heater doesn’t get the full benefit of the available solar energy. I’d love to find a way to adjust the heater’s power consumption based on the current solar production. :sun_behind_small_cloud::bulb:

I’ve come across some solutions that use a dimmer to control the heater’s power, either through a potentiometer or a digital dimmer controlled by an ESP32. This seems like a promising direction, but I’m not entirely sure how to set it up. Would it be possible to have the Shelly 3EM communicate with the AV dimmer and ESP32 to dynamically adjust the heater’s power draw based on real-time solar production? :thinking:

I’d greatly appreciate any insights or experiences from others who’ve tackled similar challenges! Whether it’s about the hardware setup, software integration, or even alternative approaches, I’m all ears! :headphones: Let’s brainstorm together! :rocket: