Skip to content

feat: add shelly script example#57

Open
hoinmic wants to merge 1 commit intoZendure:mainfrom
hoinmic:feat/add_shelly_script_example
Open

feat: add shelly script example#57
hoinmic wants to merge 1 commit intoZendure:mainfrom
hoinmic:feat/add_shelly_script_example

Conversation

@hoinmic
Copy link
Copy Markdown
Contributor

@hoinmic hoinmic commented Mar 7, 2026

Add ShellyScript battery management demo with grid power balancing. Script automatically charges battery when excess grid power is available and discharges when additional power is needed.

The script can be executed directly on the Shelly device (e.g., Shelly Pro3EM).

Add ShellyScript battery management demo with grid power balancing. Script
automatically charges battery when excess grid power is available and
discharges when additional power is needed.

The script can be executed directly on the Shelly
device (e.g., Shelly Pro3EM).
@hoinmic
Copy link
Copy Markdown
Contributor Author

hoinmic commented Mar 7, 2026

@dav1dBoy I made an example for shelly script. What do you think?

@Spessartwald
Copy link
Copy Markdown

I made a similar thing with ESP32 & Tasmota. Took me some time to implement a PI control loop, which will achieve +/-2W grid power consumption after 30sec with the SF800Pro for slow changing loads, but fast enough to follow a switching coffee machine heater with 1,3KW and ~20sec on/off cycle to keep its temperature. The total efficiency in this case is not the best, due to a minimum cycle time of 1sec to get the power value from the smartmeter, and the settling time of the SF800Pro of approx 2sec from 0->800W. I assume that my current control loop has an efficiency of ~90% during a ´standard´ day, with cooking, washing, gardening. This means losses (feed to grid) of 0,3KWh, on a sunny day. That´s sufficient for me from cost point of view, but not from a technical point of view. It should be almost ´0´

Im very interested to see the transient behavior and total efficiency of your control loop with the Shelly. Do you have any measurements ?

@hoinmic
Copy link
Copy Markdown
Contributor Author

hoinmic commented Mar 22, 2026

Thanks for your comment. I tested the code with a “Zendure SolarFlow 2400 AC.”

In my case, I can only evaluate the results based on nighttime data, since the device is used as a supplement to a larger solar system (during the day, the Zendure SolarFlow 2400 AC is more or less just charging, and there isn't really any regulation taking place).

Normally, I achieve an autonomy of 96–98 percent at night (active devices: freezer, refrigerator, lights, dehumidifier, Wi-Fi, etc.).

To illustrate, here are the results from last night (since midnight):
Screenshot From 2026-03-22 06-08-43

Screenshot From 2026-03-22 06-08-04

@Spessartwald
Copy link
Copy Markdown

Good morning, thanks for that.
Your Shelly script matches perfectly to your SolarSystem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants