The aim is to allocate solar energy production on multiple equipments (resistive load) in order to improve grid resiliency and reduce homeowner electric bills. Equipments priority should be managed. Communication through Wifi/Mqtt.
Here is a Pierre's forked version.
Let update/improve this code to your needs...
- At least 2
modules
- Here a third Pzem Smartmeter is used, connected to the WaterHeater in order to improve Grafana charts and to detect Over Load when the thermostat goes to off/on.
- n
module(s)
- n Wifi MQTT Energy Commutator (like Sonoff Relay etc...)
- 1 Raspberry Pi Zero 2 / Pi3 / Pi4 (which host this python program and Mosquito Mqtt broker)
Installation :
By installing 2 in your solar system, and clamping the first PZEM toroid onto main house loads and the second PZEM toroid onto solar inverter, you can monitor "Grid Consumption Energy" (the energy consumed from the grid), " Solar Production Energy" (the energy producted by solar panels), and "Exported Energy" (the calculated energy exported to the grid)
You can monitor the energy flow of the solar system, as following ;
Above, Grafana screenshot. (here EDF is the Grid Consumtion Energy)
Above, Domoticz screenshot (from domoticz's page called 'Floorplans')
- python 3
- paho-mqtt : $> pip3 install paho-mqtt
Pierre vs Coturex
- At startup it Calculate 'Polynomial Regression' Vector' depending on Power Variator technology and differents calibrations/equipment directly from CSV calibration files -> implemented in VariablePowerEquipment subclass
- Do
through Mqtt (instead of pzem hardware attachment)
- Read
at startup (all parameters/settings are located in this file)
- Dynamic load of equipments (rules in
)
- Save/Load 'status of equipments' while restarting the program
(and every xx seconds cf. 'status_time' in
)
- Cloud forecast, using OpenWeatherMap (https://openweathermap.org/)
- 'Water heater fallback' if not enough dayly or 2days solar energy : Seasons consideration
- attach the (un)forced mode to MQTT Domoticz device - https://www.domoticz.com/wiki/MQTT
Python Regulation
- regul/mode/{(un)forced mode.json}
- regul/status/{evaluate status.json}
Wifi_MQTT_Energy_Smartmeter : (pzem_topic = smeter/pzem)
<pzem_topic>/<pzem_id>/
- smeter/pzem/{boot.json}
- smeter/pzem/id_0/{pzem.json}
- smeter/pzem/id_n/{pzem.json}
Wifi_MQTT_Power_Variator : (vload_topic = regul/vload)
<vload_topic>/<vload_id>/
- regul/vload/{boot.json}
- regul/vload/id_0/{percent power}
- regul/vload/id_n/{percent power}
...
Constant Power Equipment : (cload_topic = regul/cload)
<kload_topic>/<kload_id>/
...
Domoticz link (then influxDb, Grafana) : (and Constant Power Equipment too)
- domoticz/in/{json}
- domoticz/out/{json}




