[App][Pro] Homey EMS (HEMS): Smart EMS

This app will take control of your power management devices through Homey only.
By monitoring the energy readings of all of them it makes smart decisions and controls devices to apply HEMS strategies.

Test channel:

I test this app with:
Homewizard P1
Marstek Energy Storage Venus V2
Peblar EV charger Business (community app)
Polestar EV
Solar forecast
Weather underground

I use supporting flows

  • mark the vehicle home/away based on gps location and charger connected state
  • Use Homey energy pricing to mark expensive/cheap hours
  • Ask myself if I will use the car tomorrow before bed time

But it has a config wizard that should allow you to map most homey devices as long as they have the required capabilities to make the system work.

Widgets
It includes Flow control graph widgets.
Last 24 hours produces a nice rolling window overview on where your solar went
Last 10 minutes gives a live rolling window.
Day analysis allows you to select a full day in the recent past. It holds less details.
Hour analysis allows you to select the hours from the last 24 hours. It holds less details.
Strategy events
Day planning
Fleet insights

For new the first strategy is: Grid Aware
Requires: P1 meter, Solar inverter
Controls: Battery and EV charger
Input: Weather prediction, solar production prediction EV SOC

How it works, but you can manage a lot:

Main operation
When surplus starts to occur (production exceeds house use) it uses the EV threshold to either prioritize the battery (low surplus is efficient for batteries) OR it prioritize the EV charging. This prevents the battery from competing with the EV.
You can then set a max for the EV charging, when the surplus grows over the max value it will start to include the battery. This threshold bandwidth creates a stable consumer for your surplus.
When the surplus ends by going down at the end of the day, it first stops the battery, then the EV and the remainder goes into the battery. If the battery might already be full, it keeps the EV charging.
Goal: Ensure at the end of day the battery is fully loaded, and the remainder has been send to the EV.

Exception: EV is not present
When this happens the battery is handled with a grid zero operations (by the HEMS). This means it will unload to handle peaks and loads while surplus is available, optimizing the max amount it can store during the day.

Grid awareness
During the surplus hours the grid is overloaded, so the HEMS prevents your house to send additional surplus to the grid. It ensures it only charges and charges (unless everything is full or the EV is not available then it tries to stay at 0). When the shortage hours start (expensive hours, morning evenings) it will use the battery to keep the import low. It will do this till the battery is drained to your safety margin bottom (settable).
It will stop doing this when the expensive hours are done and there is still left, it will safe that till the next peak.
This should stabilize your power usage to a rather nice average.

Influance
You can have influance on the system using modes like ‘EV will be used’. This will tell the HEMS the car WILL leave later on and safes the battery by prioritize the EV with all surplus.
And it will allow for a lower safety margin for the battery SOC, doing this in the morning or night will allow the first expensive period to drain the battery more creating more space for the upcoming sunny day (depends on weather prediction).
EV SOC the car will be used will trigger a night charge cycle to ensure your car is charged to the target SOC, this can be made dynamic by flows. The charge speed is calculated to ensure you hit the goal with the lowest speed the charger can do, preventing load on your grid.

Example
You will get this behavior.
Battery was at its low during the day start, so the morning was all import then when the sun started you see the nice green solar curve in different energy flows. Around it small imports. During the day the grid is overloaded with surplus, so import is cheap and helps the grid, so the HEMS preffers to import over export keeping a safe margin there.

When the sun went down, the battery took over.
The lower darker green is solar power used by the house
The middle green is solar power pushed into the EV charger
The light green top is solar power stored in the battery.
The teal is the house running from the battery.
Multiple widgets included

Net Zero,

Basic strategy that allows the multi inverter and multi battery (fleets) to work together to work towards a net zero result. Simpler than the grid aware logic, not forecast and safing power in th ebattery for the grid congestion periods etc.

Third main strategy (In test now)

Peak shaving

It works to solve the BE rules by shaving off the peaks in your energy level, discharging the battery to the point where the load is ‘free’ again and charges when there is space in your bandwuth to recharge the battery. This is respecting your expensive hours when linked to a price indicator app.

I don’t have a battery configured, but it still stays in the mode to load the battery. What did I configured incorrectly?

Grid Aware EMS — quick start checklist

1. Make sure your battery can be controlled

  • Your battery’s Homey app must accept a power setpoint (target_power): positive = charge, negative = discharge.
  • In the pairing wizard, pick the battery mode Homey uses to control it (“homey”) and the mode where the battery follows your usage by itself (“anti-feed” / self-consumption), or leave that to the app (often responds faster).

2. Link the devices (pairing wizard)

  • Required: P1 / smart meter and solar inverter.
  • Recommended:
    • home battery
    • EV charger + car (for SOC and at-home status)
    • solar forecast device
    • weather forecast
    • price device (or Homey Energy prices, but those are less accurate and reliable)

Without the forecast and price devices, Grid Aware still works, but it can’t plan ahead.

3. Fill in the settings that matter

  • Battery usable capacity (kWh) — the real value, not the default 10. All planning is based on this number.
  • Battery maximum charge power (W) — your battery’s hardware limit.
  • Battery reserve (minimum SOC) — the battery never discharges below this.
  • EV — charger minimum and maximum amps, EV battery capacity, and whether 3-phase is allowed.
  • Run the day plan automatically — turn it on, or create a flow with your own schedule. The day plan decides each night how full the battery should be and whether it needs a top-up from the grid.

4. Test first, then go live

  • Test run is on by default. In Test run the app only shows what it would do on the device tile (“Charging EV from solar”, “Topping up battery”).
  • Watch one sunny day. Does what it shows make sense?
  • Then turn Test run off, and the app takes control.

5. Tell it about your car (flows)

  • EV at home / away — an action card driven by your car’s location or the charger’s plug status.
  • EV needed tomorrow — night charging only happens when this is set.
  • Set EV target SOC — how full the car must be for tomorrow.

6. Day to day

  • Surplus (what is left after the house’s own consumption) goes to the car first, then the battery. When needed, it balances between the two so the battery still reaches its target to cover the evening.
  • In expensive hours, the battery covers your usage.
  • The force buttons (charge battery now, charge EV now) override the plan. Press them again to stop.
  • The tile always shows in one line what it’s doing and why. Check that first when something looks wrong.

Not working as expected?

What you see Cause
Battery does the opposite of what the tile says The sign is wrong in the battery app (report it to the battery app developer)
Battery dropdowns are empty in the wizard Your battery’s app is read-only and can’t be controlled (ask the battery app developer to support the target_power and target_power_mode capabilities)
Still stuck Post a screenshot of the tile plus the app log in the forum thread

The advanced settings (BOOST, battery priority, start/stop delays, expensive-hours blocking) work fine on their defaults for a start.

i also see
HEMS (Homey Energy Management System) | Homey

maybe it’s an idea to join forces with @Menno_De_Braak for one EMS app?
saves development time, and choice stress for the users

P.S. I really like the idea of an EMS app and when they hit the released state i will start playing around with it as i have to switch energy contract in october

I am done, already running this in my setup, with support for all Homey devices, now for several months.
:blush:

then thanks for all the work, will check it out when it is officlially released.
P.S. is also electric floor heating and airco’s embeded?

it looks like a coincident that we both published an app at the same time… Mine is also close to finished but I’m open for a talk…

No they are not. This is my 5th release, the other 4 I was never happy with. Trying to include underfloor heating and airco’s was one of the things that I had in several previous versions. But in all I found they are less responsive to just surpluss needs. Next to my hot water system I hooked them up the the events and use simple flows to manage them linked to main events of the HEMS. The device control I reserved for systems that need active monitoring and control, speed and reliability. The slow systems are easier to hook to the ‘cheap hours’ event etc.
But I designed the app to allow on the same core for multiple strategies, so lets generate those ideas.

So how would you hope the HEMS would include the underfloor heating that require the more calculation power of an app over simple flows?

indeed, it was clear there was a need, so great minds think alike :wink:
I am curious what your approach is, like stated above I set it up to have different device drivers from different strategies, this one is the dream I had for my purpose, but I am sure many people have different dreams and based on my core engine with its device mapper through the repair wizard it is now easy to generate other strategies.
I would be more than happy to include the one your building into this one for example.

Hi Vincent,

Is it possible to attach more then one Solar Inverter. I’m testing right now and I only had the option to add one inverter when adding the device and I see no option to add my other inverters afterwards. All three of my inverters (1x Goodwe an 2x Growatt) are recognised.

Thanks!

The code is ready for it, I will send a test version with it. I could not test it since I don’t have multiple.

I will also test it once available. I have two SolarEdge single phase inverters in my system.

@DaneedeKruyff and @Jean_S ask and you shall receive:

Use the repair wizard to add your additional inverters, they are use cummulative in the calculations.

Once your confir this works, I am looking a for a tester with multple batteries.
First in would be to use that loadblanced. But I believe there is more config required there.

Hi Vincent,

Via the repair action, I was able to add the 2nd inverter but in de app still only the first inverter is shown in the list of EMS devices (even after a restart of the app).

Best regards, Jan

By the way… I have both a Zendure Solarflow AC2400+ and HomeWizard plug-in battery, so also volunteering as tester there.

Looks prommising. For me it would be nice to add more Solar forcast devices for multiple Panel-Directions.

That’s probably Ui not aware, the math in the ems should use both, I’ll check it