Skip to content

Instantly share code, notes, and snippets.

View pa-nic's full-sized avatar

Patrick pa-nic

View GitHub Profile
@pa-nic
pa-nic / zendure_controller_shelly_script.js
Created March 31, 2026 13:37
Zendure Solar Power Controller Shelly Script
/**
* @fileoverview Zendure Solar Power Controller with Shelly (script)
* @version 1.0
* @description Controls a Zendure SolarFlow device via its local zenSDK HTTP API
* using P1 meter readings from a Shelly energy monitor.
*
* Algorithm:
* setpoint = p1 + homeOutput → one-shot zero-grid-import convergence
*
* Supports: SolarFlow 800 Pro and zenSDK-compatible devices.
@pa-nic
pa-nic / Shelly_Pro3EM_EnergyCounter.js
Last active March 17, 2026 14:08
Shelly Pro 3EM Energy Counter Script
/**
* @fileoverview Energy Counter Script for Shelly Pro 3EM
* @version 3.0
* @description Tracks consumed and returned energy with smart persistent storage.
* Uses internal energy counters instead of integrating the power readings.
* Features: drift-free counting, virtual components for runtime adjustments,
* non-blocking startup state machine, and intelligent KVS save logic.
* After running the script you can update Energy Consumed/Returned values via Shelly UI/App to set your start values.
* @note Requires Shelly Pro 3EM with firmware supporting Virtual Components and KVS API
* @author Patrick Probst