es-ESS: Tiny tool belt for any ESS

Hey all,

some months ago, I finished the migration to a victron-centric system, and started to dig into phython and the posibilities of venus os. I’m a professional software engineer with about 20 years of experience and therefore creating the second helpful script was no option - it had to become a service-based, modular tool belt to ensure maintainability during the (hopefully) next 10 years :slight_smile:

So, es-ESS was born.

Every service works independent (with some dependencies) and can be enabled or disabled based on personal favour.

I’ve written a quite nice and detailed documention on github (link bellow), but here is a brief overview of what is currently contained - with more stuff to come in the future :wink:

:clock130: TimeToGoCalculator
Tiny helper filling out the Time to Go field in VRM, when BMS do not report this value.

:thermometer: MqttTemperatures
You have temperature sensors communicating with your Mqtt-Server? Use this helper to subscribe and display temperature and optionally humidity and pressure in the GX / VRM.

:next_track_button: MqttExporter
You need some values on your local mqtt, but keeping the local cerbo mqtt alive 24/7 just to read 10 values feels wrong? MqttExporter allows you to directly export any value from dbus to your local mqtt, without having to take the expensive way.

:oncoming_automobile: FroniusWattpilot
You are owning a Fronius Wattpilot? This is your Musst-Have Service: Full Integration of Fronous Wattpilot into VRM, including bidirectional communication beetween the cerbo and the wattpilot app including Solaroverhead-Charging.

:low_battery: NoBatToEV
You are charging an EV from the AC-OUT side, but you basically don’t want to use your battery for that? NoBatToEV will constantly monitor your local consumption, solar production and ev-charge rate and adjust the grid set point in a way that no energy flows from the battery to the ev.

:zap: Shelly3EMGrid
Implementation to use the Shelly3EM as a grid meter in Venus OS. Script-based implementation of NET-Metering for D, CH, AT (etc.)

:part_alternation_mark: ShellyPMInverter
Got some microinverters that you measure with ShellyPM Devices? Integrate them into your system. (Configurable Phase)

and last but absolutely not least:

:sun_with_face: SolarOverheadDistributor
The SolarOverheadDistributor is a service running on your gx device. It can control your consumers in various ways. Starting with a config-based definition to simply turn on/off some http or mqtt controllable devices as soon as conditions are met, It also provides a Request/Approval connection endpoint (mqtt), where you can connect any (complex) external script you like. (Powershell, Arduino devices, bash, …)

Multiple consumers can co-exist at the same time, and will be either directly controlled - or just receive an allowance-report on mqtt to start consumption.


es-ESS is basically starting into it’s open beta now. Instructions on Installation / Configuration and generall documentation is available on github.

For the beginning, I would recommend users with a medium skill-level in the unix world. I’m running the majority of services since some months, but the configuration file is currently not validated, any typo or wrong configuration may break the script execution. Having a minimum understanding of reading logs and eventually beeing able to figure out the problem would be kinda helpful to not endup frustrated :wink:

If you have found any bugs or have feature requests, Feel Free to create a Issue on github - Please avoid floading this topic with comments, after several pages no one will be able to figure out, that a problem was already reported / solved or what’s the cause / solution.

Contributions of devs welcome as well, implementing a new Service is kinda easy, just implement the esESSService class and you don’t have to mind any deep-technical stuff (beside the actual implementation of what should happen, ofc.) :slight_smile:

Project-Page:

5 Likes

@PontusLindberg poke :wink:

1 Like

Thank you! Will have a look at this during the weekend :smile:

1 Like

@dognose
Does it work when running DESS (Green mode)? because it does not seem to work
3 phase MultiPlus-II 5000, everything running on AC OUT1
It’s the Victron EV Charger

It does set the Grid setpoint to -30 as set in the config.

If I set the Grid setpoint to 1000 W through the Cerbo it runs 1000 W on grid:

If I then run root@einstein:/data/es-ESS# sh restart.sh
It just goes back to the -30 W as set in the config.

TimeToGoCalculator works and is visible on VRM… but only if I don’t have NoBatToEV enabled… might just be a side effect of NoBatToEV failing.

Seems FroniusWattpilot is somehow interfering
So found the code and searched for evcharger in MQTT Explorer.
Could it be that it cannot find “com.victronenergy.evcharger” when it’s ServiceName is “com.victronenergy.evcharger.evc_HQ2301UMCJ7”… or maybe fails on this line:
if (Globals.esESS._services[“FroniusWattpilot”] is None):

2024-10-30 21:53:34,530 INFO [MainThread|esESS._validateConfiguration] Running on most recent configuration file version: v6
2024-10-30 21:53:34,532 INFO [MainThread|esESS.__init__] Initializing es-ESS (es-ESS 24.10.6 beta)
2024-10-30 21:53:34,534 INFO [MainThread|esESS.__init__] Initializing thread pool with a size of 10
2024-10-30 21:53:34,541 INFO [MainThread|es-ESS.configureMqtt] MQTT: Connecting to broker: localhost
2024-10-30 21:53:34,544 INFO [MainThread|esESS.configureMqtt] Connecting to broker: tcp://localhost:1883
2024-10-30 21:53:34,579 INFO [Thread-1|esESS.onMainMqttConnect] Connected to MQTT broker!
2024-10-30 21:53:34,588 INFO [MainThread|esESS.configureMqtt] Connecting to broker: tcp://localhost:1883
2024-10-30 21:53:34,608 INFO [Thread-2|esESS.onLocalMqttConnect] Connected to MQTT broker!
2024-10-30 21:53:35,609 INFO [MainThread|esESS.publishServiceMessage] ServiceMessage: es-ESS is starting up...
2024-10-30 21:53:35,636 INFO [MainThread|esESS.publishServiceMessage] ServiceMessage: Initializing Services.
2024-10-30 21:53:35,663 INFO [MainThread|esESS._checkAndEnable] Service SolarOverheadDistributor is not enabled. Skipping initialization.
2024-10-30 21:53:35,669 INFO [MainThread|esESS._checkAndEnable] Service TimeToGoCalculator is not enabled. Skipping initialization.
2024-10-30 21:53:35,675 INFO [MainThread|esESS._checkAndEnable] Service FroniusSmartmeterJSON is not enabled. Skipping initialization.
2024-10-30 21:53:35,681 INFO [MainThread|esESS._checkAndEnable] Service MqttExporter is not enabled. Skipping initialization.
2024-10-30 21:53:35,687 INFO [MainThread|esESS._checkAndEnable] Service FroniusWattpilot is not enabled. Skipping initialization.
2024-10-30 21:53:35,693 INFO [MainThread|esESS._checkAndEnable] Service MqttTemperature is not enabled. Skipping initialization.
2024-10-30 21:53:35,698 INFO [MainThread|esESS._checkAndEnable] Service NoBatToEV is enabled.
2024-10-30 21:53:35,724 INFO [MainThread|esESS._checkAndEnable] Service Shelly3EMGrid is not enabled. Skipping initialization.
2024-10-30 21:53:35,748 INFO [MainThread|esESS._checkAndEnable] Service ShellyPMInverter is not enabled. Skipping initialization.
2024-10-30 21:53:35,754 INFO [MainThread|esESS.publishServiceMessage] ServiceMessage: Initializing Dbus-Subscriptions.
2024-10-30 21:53:35,786 INFO [MainThread|esESS._initializeServices] Initializing Dbus-Subscriptions for Service NoBatToEV
2024-10-30 21:53:35,812 CRITICAL [MainThread|esESS._initializeServices] Exception
Traceback (most recent call last):
  File "/data/es-ESS/es-ESS.py", line 309, in _initializeServices
    service.initDbusSubscriptions()
  File "/data/es-ESS/NoBatToEV.py", line 24, in initDbusSubscriptions
    if (Globals.esESS._services["FroniusWattpilot"] is None):
KeyError: 'FroniusWattpilot'

The Config:

[DEFAULT]
devComment1 = Comments in this file have been ommited for 2 reasons:
devComment2 = 1 The config file is quite huge - without comments it stays somewhat readable.
devComment3 =   On https://github.com/realdognose/esESS/blob/main/README.md youll find a full documentation.
devComment4 = 2 Version upgrades will automatically update existing config files - and this process will remove any comment a>

[Common]
LogLevel=APP_DEBUG
NumberOfThreads=10
ServiceMessageCount=50
ConfigVersion=6
VRMPortalID=DELETED
BatteryCapacityInWh=15000
BatteryMaxChargeInWh = 9000
DefaultPowerSetPoint = -40

[Mqtt]
Host=localhost
User=
Password=
Port=1883
SslEnabled=false
LocalSslEnabled=false

[Services]
SolarOverheadDistributor=false
TimeToGoCalculator=false
FroniusWattpilot=false
MqttExporter=false
MqttTemperature=false
NoBatToEV=true
Shelly3EMGrid=false
ShellyPMInverter=false
Grid2Bat=false
FroniusSmartmeterJSON=false

[FroniusSmartmeterJSON]
VRMInstanceID=40
CustomName=Fronius Smartmeter (JSON)
PollFrequencyMs=500
Host=10.10.20.46
MeterID=0

[TimeToGoCalculator]
UpdateInterval=1000

[SolarOverheadDistributor]
VRMInstanceID=1000
VRMInstanceID_ReservationMonitor=1001
MinBatteryCharge= (5750/(min(SOC,99)-100)+5750) + 250

[FroniusWattpilot]
VRMInstanceID=1007
VRMInstanceID_OverheadRequest=1006
MinPhaseSwitchSeconds=300
MinOnOffSeconds=300
OverheadPriority=35
ResetChargedEnergyCounter=OnDisconnect
Position=0
Host=10.10.20.47
Username=admin
Password=password
HibernateMode=true


Hi Denis,

yes you are right, the NoBatToEV seems to fail - very detailed analisys there :slight_smile:

Reason is, that i’m checking if the FroniusWattPilot Plugin is used - but if it is not even registered, it fails to check on the service itself.

I’ve now changed that lines, so it should properly detect that the Fronius wattpilot is not used and fallback to the systems evcharger.

You can just run the “setup” lines again, it will overwrite the files, but not touch your configuration.
(At least it should not, hope that works :smiley: )

Yes, it works with DESS as well. When DESS is overwriting the grid-setpoint for a scheduled charge - the grid setpoint of NoBatToEV doesn’t matter, but then the system naturally comes down to the “right” thing:

4000W Bat Charge + 6000 EV Charge (- 0 Solar) will lead to 10.000 being pulled from grid - theres obviously no other choice then.

YES!!!.. both NoBatToEV (Need To Have) and TimeToGoCalculator (Nice To Have) is running :+1: :ok_hand: :muscle:
And nice to be able to see the logging… well… maybe not that many decimals :laughing:

I did have issues re-installing… ended up deleting both “es-ESS” and “es-ESS-main” folders and then the install went successful. I did not write/log what went wrong, so can’t give any useful information :upside_down_face:

Do you have a Patreon or something like that?.. or maybe look into this → Displaying a sponsor button in your repository - GitHub Docs

2024-11-02 13:38:56,282 APP_DEBUG [TPt_0|NoBatToEV._update] EV Charge is 5372.0W, Consumption is 4626.803771972656W and available Pv is 4252.803771972656W.
2024-11-02 13:38:56,284 APP_DEBUG [TPt_0|NoBatToEV._update] So, raw consumption is -745.1962280273438W, remainingPV is 4998.0W, we therefore offload 374.0W to the grid.
2024-11-02 13:38:56,330 APP_DEBUG [TPt_0|esESS._manageGridSetPoint] Grid Set Point request of NoBatToEV is 374.0
2024-11-02 13:38:56,335 APP_DEBUG [TPt_0|esESS._manageGridSetPoint] Combined all GSP-Requests, new GSP is: 354.0
1 Like

Had this once as well. I think this happens, when you run the install scripts from another path than ., especially from within /data/es-ESS (it then ends up to install into /data/es-ESS/data/es-ESS rather than overwriting correctly.)

Need to look at this, to make the install script independent of current directory. (or just add a cd / as first command.)

But glad it works so far.

Just noted, that with the upgrade to 3.5 the TimeToGoCalculator is no longer working, or say VRM is no longer picking up the values “injected” through mqtt Write-Commands. Have to look at this, missing it already :stuck_out_tongue:

So, raw consumption is -745.1962280273438W, remainingPV is 4998.0

Was this just a unlucky moment, when the EV-charger was ramping up? Raw consumption basically shouldn’t be negativ, unless you have PV on AC that is unknown to venus os?

I’m running 3.41 because I have a Shelly Pro 3EM on PV-AC and couldn’t get this → Shelly Pro 3EM support for dbus-modbus-client 1.58+ by rkapsi · Pull Request #7 · victronenergy/dbus-modbus-client · GitHub to work on 3.50 or 3.42
So yes… I have 22 (15 south, 7 north) micro inverters under the solar-roof (Ennogie solar-roof)
I did look into those numbers and cannot figure out the calculation :rofl:

Ok, didn’t consider the case of “unknown PV”. But apparently it seems to work by coincidence as excpected: -745 consumption increases the “available PV” from 4252 to 4998 PV, so only 374 are pulled from grid :stuck_out_tongue:

(then, the whole 5372 of the ev are covered by 4998 Solar + 374 grid)

Usual calculation would be like

EV Charge is 4090.7600100000004W, Consumption is 5118.0W and available Pv is 1284.4760073127745W.
So, raw consumption is 1027.2399899999996W, remainingPV is 257.23601731277495W, we therefore offload 3833.5239926872255W to the grid.

Raw consumption 1027, to be covered by the 1284 solar first - that leaves 257 PV unused.
Thus, to not touch the battery, the ev charge of 4090 (-257) requires a 3833 Grid Setpoint

Well… it is known… through the Shelly Pro 3EM… it’s the PV Inverter → VRM Portal - Victron Energy

Ok - then it was just a coincident, when the Charger was ramping up and already reported MORE power than the consumption.

Yet, your EV charger is reporting a higher value than the overall consumption, this causes a “tiny bit” battery discharge.

Probably I could add a static-offset value, so you can adjust for system-dependent imprecisions here.

But that +/- 100 Watts won’t deplete your battery when charging the ev :slight_smile:

Haha… your right. Strange… it’s the Victron EV Charger.
The Charger seems to report incorrect W… maybe I need to adjust this in the Charger

Could be the shellies. If they report less PV than there actually is, that would lead to under-calculation of consumption by the system.

(Using them as well and know they can be off 5-10%)

If you charge at night one day, and EVCS stays <= consumption, it’s “their fault”.

Took me a while, but I started looking at this now. Unfortunately I do not have a Victron EC charger, I have an Easee charger so I need to figure out how to integrate it into the Victron ecosystem first.

Excellent tool! Is there a chance the TimeToGoCalculator would work without your setup being an ESS? I have a Multiplus 3kva with closeloop communications with an EG4 battery, and have no ‘estimated’ runtime or time to go either ongrid or on battery and this seems like a good fix. It looks like the battery BMS isnt providing any data and thus nothing is displayed in the CERBO or VRM.

Hi,

unfortunately the TimeToGo Calculator does no longer work with the latest Version. The value that I modified to “inject” the time to run can no longer be modified in the way I did it :frowning:

I will look at this and find a solution for sure, but didn’t have time until now.