‘supervisory’ control of the OpenEVSE Solar Divert using NodeRED

I posted this on the e-Niro Facebook group yesterday and Glyn suggested putting it here - I’ve added a couple of extra techy references. I’m happy to talk through/share any of this if it’s useful…

In my enforced isolation, I’ve done a bit of refinement to my ‘supervisory’ control of the OpenEVSE. I’ve used the underlying solar tracking control done by Glyn, but I have sat some other control above it (using Node Red in my EmonPi). There are two main functions:

Off-Peak Operation - I have used a schedule node that is quite simple ( node-red-contrib-schedex ). It just has one on/off time, but which you can set active or inactive for any day of the week. I’ve built a Node Red interface to that so I can control it from a web browser (see pics). Normally I work at home on a Tuesday and I’m at home on Sat and Sun, so I have I have it set to inactive on those days. That means the car will be partially discharged at the start of those days ready to absorb some solar. I’ve set the car to charge to a maximum of 90% (I’ll probably drop that to 80%), so on the active days the Node Red code starts the charger at the scheduled off-peak start time (00:30 for me) and it will be stopped by the car at the limit. (I’ve also put an override switch in that turns the off-peak charge schedule off altogether - I imagine it will be set to that for a few months ! :frowning: )

Solar Divert - I’ve set up a calc in Node Red that determines the excess power available at any time. I also have the Peak and Off-Peak tariffs in the system; if the slider on the settings page is at 0 then it will increase the kW to the point that the cost of charging is equal to the off-peak cost, if it’s set to 1, it will just use excess solar (so ‘free charging’). The same excess power signal then runs through a low-pass filter (‘smooth’ function with a factor of 50) which using about 8-10 minutes worth of history. when this ‘smoothed signal’ exceeds 1.6kW it sends a signal to turn the OpenEVSE solar divert function on, when it falls below 1.2kW it turns the divert function off (I also have to send a pause command here). This combination means that it can ride through a day of very variable solar output, or the kettle being boiled, without too much switching of the contactor. The OpenEVSE control signal is the unsmoothed version of excess power, so Glyn’s algorithm quickly compensates for low solar or high house demand.

(1) A very variable Solar Day

(2) A better day!

(3) The control UI - the top bar is showing car connected/not connected, charging/not charging, Schedule State (Red = Suspended, Amber = pending, Green = active), Sun - just that Solar is generating, Cloud shows there isn’t enough output to charge, and then charger fault/no fault.

Where is says ‘sus’ under Day would normally tell you the next day for which off-peak charging is scheduled - - sus indicates suspended (switch to the right off).

(4) This allows the Off-peak time to be set and which days it should be active. Then you can set the tariffs and the ‘safety factor’ I’ve termed it - whether you want to charge at the same cost as off-peak or just take free solar.

Fantastic! Nice work, it’s great to see demonstrations of what’s possible with the OpenEVSE using open source tools.

Would you be happy to share your nodeRED flow? The NodeRED UI in particular is really nice.

What’s the safety factor!? :face_with_monocle:

I will get round to posting code - just trying to keep up with some actual work at the moment! The safety factor isn’t very well named… If it’s set to 1, then the divert will match EV to excess solar so there is no export or import. As you move it towards 0, so the EV charge rate ramps up until at zero the effective cost of charging the car is the same as the off-peak tariff. It really just allows you to maximise the cost benefit of charging when the sun is shining.

Here’s a summary of the flows and how it fits together. I’m not an experienced Node Red programmer (this is the first thing I’ve done), so there’s probably lots here that could be done better! (But it works).

There are 3 flows:
PVDivert
Off-Peak Schedule
EV Status & Resets

I’ll just put the Divert Schedule here. There is lots of stuff bespoke to my system here such as MQTT calls etc (though I’ve removed the API Key :slight_smile:) but the main blocks are “PV Divert Ratio”, “PVEconomicSurplus”, “PVESurplusSmooth” and “SwitchPVDivert” and downstream calls.
I’ve provided a copy of the JSON export for this (and the other flows) here:
https://www.dropbox.com/sh/d6kxwbuynsxib7y/AABuWyx4DAuqQhzdxkp0tpcka?dl=0

1 Like

Here’s the Off-Peak Schedule - this uses a simple package called ‘schedex’. It doesn’t take account of GMT/BST, but since most off-peak meters don;t either at the moment that seems OK, and it can easily be programmed to add/subtract an hour.

1 Like

And this flow is just gathering info (including any kWh or time override) and posting to places. The bit that might be of most interest is the car connection status at the bottom as that’s not captured by openevse. This flow is also in the dropbox link above.

1 Like