Importing prices into Dynamic ESS with NodeRED

I’ve spent a bit of time setting up a Node-RED flow to import prices from my (unsupported) local provider in Australia - Amber Electric - using their API. With thanks to @dfaber’s post and @podarok’s contribution also, I’m feeding the provider’s prices into Dynamic ESS successfully:

// Extract the intervals from the payload
const intervals = msg.payload;

// Create empty arrays to hold buy and sell schedules
let buySchedule = [];
let sellSchedule = [];

// Helper function to convert UTC time to local time
const toLocalTime = (isoTime) => {
    const date = new Date(isoTime);
    const options = {
        hour: '2-digit',
        minute: '2-digit',
        hour12: false,
        timeZone: Intl.DateTimeFormat().resolvedOptions().timeZone // Local timezone
    };
    let time = new Intl.DateTimeFormat('en-US', options).format(date);

    // Fix for midnight time formatting
    if (time.startsWith("24:")) {
        time = time.replace("24:", "00:");
    }

    return time;
};

// Iterate through each interval and sort data into buy and sell schedules
intervals.forEach(interval => {
    const from = toLocalTime(interval.startTime); // Convert to local time
    const to = toLocalTime(interval.endTime); // Convert to local time

    // Extract and format price
    let price = parseFloat(interval.perKwh);

    if (interval.channelType === "general") {
        // Convert buy price to dollars and round to the nearest cent
        price = Math.round(price) / 100;
        buySchedule.push({ from: from, to: to, price: price });
    } else if (interval.channelType === "feedIn") {
        // Invert sell price, convert to dollars, and round to the nearest cent
        price = Math.round(-price) / 100;
        sellSchedule.push({ from: from, to: to, price: price });
    }
});

// Create the final output structure
const buyPriceSchedule = [{
    days: [0, 1, 2, 3, 4, 5, 6], // All days of the week
    schedule: buySchedule
}];

const sellPriceSchedule = [{
    days: [0, 1, 2, 3, 4, 5, 6], // All days of the week
    schedule: sellSchedule
}];

// Assign the formatted schedules to the payload
msg.payload = {
    buyPriceSchedule: JSON.stringify(buyPriceSchedule),
    sellPriceSchedule: JSON.stringify(sellPriceSchedule)
};

return msg;

This function node feeds a “Change Dynamic ESS Settings” node, which successfully imports the price data from my provider.

If I look at VRM → Settings → Dynamic ESS, I see the buy and sell prices correlating correctly to the information my electricity provider’s API generated. What doesn’t line up, though, is the graphed “Schedule” data in the Dynamic ESS section of the dashboard - the prices are not what has been specified on the Dynamic ESS settings page by the Node-RED.

I confess I don’t understand Dynamic ESS well enough just yet - I’m really just experimenting at the moment and it’s switched off for now because it hasn’t been making good decisions - but I’m concerned that it’s not acting on up-to-date information based on the discrepancy between the graph and the settings page.

My provider passes on wholesale prices (our national energy market operates on a 5-minute basis), and I trigger the flow to reload every 15 minutes so as not to overwhelm the system or the provider’s API.

Does anyone have feedback about this approach and why there might be this discrepancy?

Thanks so much in advance, this is a great product that I’m sure will only get better! :smiley:

Andrew

1 Like

You need to let 28 days of data for DESS to work properly.

Rule of thumb - set something like 70% SOC, green mode and let it work

1 Like

Thanks mate — looks like you’re doing some really cool stuff with it!

I’d like to see it trade — or at least, charge intelligently — to minimise grid cost. For example, if SoC is a bit low, grid price is low now but expected to be high in a few hours, it makes sense to buy from the grid now at a low price and then discharge to loads when the grid is expensive.

All of that can be controlled with some simple enough Node-RED work, but it’d be cool to see it happen like magic inside VRM.

Still not entirely clear why the prices I’m feeding into DES are not being reflected on the graphing for the schedule.

I have trade mode(feed-in to grid) in DESS + automated prices pull from planned grid cuts. Working somehow ok.

For the actual outage I’m disabling feed-in

Prices, once you set them - visible after refresh of the graph. Use next-prev day pagination to refresh it. Also keep in mind DESS has 60s update interval as well as hourly schedule change from server