Energy Management Systems (EMS) Integration with Domoticz

Subforum for general discussions. Do not dump your questions/problems here, but try to find the subforum where it belongs!

Moderators: leecollings, remb0

Post Reply
Lightning707
Posts: 15
Joined: Friday 16 April 2021 13:58
Target OS: Linux
Domoticz version:
Location: BE
Contact:

Energy Management Systems (EMS) Integration with Domoticz

Post by Lightning707 »

Hello Domoticz Community,

I'm interested in implementing an Energy Management System (EMS) within my Domoticz setup to optimize energy consumption based on factors like solar PV production and dynamic electricity pricing.
I came across EMHASS (Energy Management for Home Assistant), which can schedule deferrable loads such as EV charging, water heaters, and batteries, aiming to minimize energy costs while maximizing self-consumption.

Are there any similar solutions or plugins available for that I can use with Domoticz that offer comparable functionality?
I'm particularly interested in:
  • Optimizing energy consumption based on real-time solar production and electricity prices
  • Scheduling deferrable loads to operate during optimal times.
Any insights, experiences, or recommendations would be greatly appreciated :)
Thank you in advance for your assistance.
HvdW
Posts: 612
Joined: Sunday 01 November 2015 22:45
Target OS: Raspberry Pi / ODroid
Domoticz version: 2023.2
Location: Twente
Contact:

Re: Energy Management Systems (EMS) Integration with Domoticz

Post by HvdW »

In fact you can achieve all this using dzVents.
Car charging on solar energy, swichting on P1 results is the basic setup.
For orientation:

Code: Select all

        -- Basisgegevens ophalen
        local solarPower = domoticz.devices('Zonnepanelen').WhActual
        local ChargingSwitchState = domoticz.devices('Charging Level').levelName
        local EVSwitch_16A = domoticz.devices('EVSE Main')
        local chargeLevelSet = domoticz.devices('XC40 battery charge set').level
        local chargeLevelActual = domoticz.devices('XC40-ChargeLevel').nValue
        local EVSE_Connected = domoticz.globalData.EVSE_Connected
        local newLevel = 'Off'
        
        -- Huidig vermogen van de laadpaal bepalen
        local PowerLaadpaal = domoticz.data.powerLevels[ChargingSwitchState] or 0
        
        -- Power gegevens ophalen
        local PowerReturn = tonumber(domoticz.devices('Power').rawData[6]) -- Terug naar het net
        local PowerConsumption = tonumber(domoticz.devices('Power').rawData[5]) -- Verbruik
        local availableEnergy = PowerLaadpaal + PowerReturn - PowerConsumption
        
        -- Controleer of we in handmatige of automatische modus zijn
        local isManualOverride = (EVSwitch_16A.state == 'On')

        -- Logging
        domoticz.log('#0 Solar Power: '.. solarPower, domoticz.LOG_DEBUG)
        domoticz.log('#1 EVSE connected: ' .. domoticz.globalData.EVSE_Connected, domoticz.LOG_DEBUG)
        domoticz.log('#2 Energy usage from the network: ' .. PowerConsumption, domoticz.LOG_DEBUG)
        domoticz.log('#3 Energy return to the network: ' .. PowerReturn, domoticz.LOG_DEBUG)
        domoticz.log('#4 Actual power on laadpaal: ' .. PowerLaadpaal, domoticz.LOG_DEBUG)
        domoticz.log('#5 Available energy: ' .. availableEnergy, domoticz.LOG_DEBUG)
        domoticz.log('#6 Manual override (EVSE switch on): ' .. tostring(isManualOverride), domoticz.LOG_DEBUG)
Bugs bug me.
User avatar
waltervl
Posts: 5853
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: Energy Management Systems (EMS) Integration with Domoticz

Post by waltervl »

Check for example this topic: viewtopic.php?t=39709

See as a reference also the energy Dahboard https://wiki.domoticz.com/Energy_dashboard
It is not a management system but only a dashboard.
For Dutch users there is the Enever integration that loads the future energy prices https://wiki.domoticz.com/Enever
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
User avatar
waltervl
Posts: 5853
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: Energy Management Systems (EMS) Integration with Domoticz

Post by waltervl »

See also the scripts of user @psubiaco on his website: https://www.creasol.it/en/support/domot ... c-forecast and on his github: https://github.com/CreasolTech/domoticz_lua_scripts

And his EMS project viewtopic.php?t=37281
In github repository it's possible to find script_device_power.lua, that should be placed in domoticz/scripts/lua directory, that manages EV charging, checks for power imported from the grid disabled or reducing loads when imported power is near the maximum permitted, enable some loads (electric heaters, dehumidifiers, ...) in case of extra production from photovoltaic, shows current power usage/export on red/green LEDs, activate white leds in case of blackout, ...
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Lightning707
Posts: 15
Joined: Friday 16 April 2021 13:58
Target OS: Linux
Domoticz version:
Location: BE
Contact:

Re: Energy Management Systems (EMS) Integration with Domoticz

Post by Lightning707 »

Thank you for the valuable insights and links you shared.

To clarify my current setup (which is already implemented in Domoticz):
  • EV Charging Station: Capable of adjusting current between 6A and 32A, including the option to switch off.​ I mode my own arduino board for this.
  • Boiler: Power output controllable from 0% to 100%, with an option to switch off.​ I made my own ESP board for this.
  • Energy Prices: Retrieved via the ENTSO-E platform.​

I'm now constructing a DIY home battery system to store energy. The goal is to charge the battery when electricity prices are low or even negative and discharge (inject into the grid) when prices are high.​

So my next Steps are:
  • Solar PV Forecasting: Develop a day-ahead prediction of solar power generation.​
  • Price Comparison: Compare the solar forecast with day-ahead electricity prices.​
  • Load scheduling: Schedule energy consumption for the following day. I also would like to be able to prioritize certain loads. For instance, ensure that the EV battery reaches at least 55% charge by a specific time, by using the best time slots (with lowest energy prices.​
I'm now exploring existing systems (or code) that can help me facilitate these functionalities within Domoticz.
This code seems very interesting: https://github.com/WillemD61/battery-planning
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest