
Research
/Security News
Shai Hulud Strikes Again (v2)
Another wave of Shai-Hulud campaign hits npm.
@socialenergy/tariffs
Advanced tools
This library is provided by Social Energy as a simple way to retrieve tariffs and compute savings. It is intended for our partners, installers, and internal use only.
This library is provided by Social Energy as a simple way to retrieve tariffs and compute savings. It is intended for our partners, installers, and internal use only.
This library is written in TypeScript so full type support is provided when using TS, and autocomplete should behave nicely when importing in a standard JavaScript project too.
The current quarterly / monthly bill field can be omitted, though the resulting totalBenefit data should be ignored. This is a useful way to just retrieve the tariff data object without attempting to calculate their savings.
The export tariff is calculated by taking the expected exported kWh after the battery is installed, then multiplying the amount before the kWh cap by the higher export unit rate, and any amount after the kWh cap by the standard export unit rate.
The savings outputted are in a yearly format from the current year onwards. The first array element is year 1 of the customer owning the system, the second array element is year 2, so on and so forth. To calculate their total benefit, sum all of the array elements together.
The following is a quick "getting started" guide.
npm install @socialenergy/tariffs # or
yarn add @socialenergy/tariffs
const { au, gb } = require("@socialenergy/tariffs");
const res = await au.calculate({
currentQuarterlyBill: 500,
postcode: 2117,
retrofit: false,
});
{
"tariff": {
"regionCode": "NSW",
"operatorName": "Endeavour",
"importUnitRate": 24,
"dailyCharge": 150,
"exportUnitRate": 6,
"higherExportUnitRate": 40,
"quarterlyExportCapKwh": 300,
"controlledLoadUnitRate": 18,
"controlledLoadDailyCharge": 0,
"referencePriceDifferencePercentage": -7.0,
"estimatedAnnualCost": 1733.29,
"estimatedAnnualCostCL": 2190.93,
"tariffPlanLinks": {
"withControlledLoad": "https://www.energymadeeasy.gov.au/plan?id=SEA460020MRE&utm_source=Social+Energy&utm_campaign=bpi-retailer&utm_medium=retailer",
"withoutControlledLoad": "https://www.energymadeeasy.gov.au/plan?id=SEA460024MRE&utm_source=Social+Energy&utm_campaign=bpi-retailer&utm_medium=retailer"
}
},
"totalBenefit": [
2810.3519, 2896.455092, 2984.4157553600003, 3074.682779427201,
3166.3358490412165, 3260.472887706614, 3356.451272292811,
3453.0466041334157, 3548.786210472957, 3645.170179933667
]
}
const res = await au.calculate({
currentQuarterlyBill: 500,
postcode: 2117,
retrofit: true,
});
{
"tariff": {
"regionCode": "NSW",
"operatorName": "Endeavour",
"importUnitRate": 24,
"dailyCharge": 150,
"exportUnitRate": 6,
"higherExportUnitRate": 40,
"quarterlyExportCapKwh": 300,
"controlledLoadUnitRate": 18,
"controlledLoadDailyCharge": 0,
"referencePriceDifferencePercentage": -7.0,
"estimatedAnnualCost": 1733.29,
"estimatedAnnualCostCL": 2190.93,
"tariffPlanLinks": {
"withControlledLoad": "https://www.energymadeeasy.gov.au/plan?id=SEA460020MRE&utm_source=Social+Energy&utm_campaign=bpi-retailer&utm_medium=retailer",
"withoutControlledLoad": "https://www.energymadeeasy.gov.au/plan?id=SEA460024MRE&utm_source=Social+Energy&utm_campaign=bpi-retailer&utm_medium=retailer"
}
},
"totalBenefit": [
2356.4599000000007, 2425.561780000001, 2499.41902864, 2575.2937459456007,
2651.405990636993, 2733.5464577501252, 2816.500614134424,
2903.9945035462933, 2994.6722119358815, 3086.8170155786856
]
}
const res = await gb.calculate({
currentMonthlyBill: 50,
postcode: "pl13fh",
retrofit: false,
});
{
"tariff": {
"operatorId": 22,
"elecImportUnitRate": 17.9,
"elecStandingCharge": 21.6,
"gasImportUnitRate": 2.88,
"gasStandingCharge": 25.82,
"higherExportUnitRate": 20,
"exportUnitRate": 6,
"yearlyExportCapKwh": 1000
},
"totalBenefit": [
493.299, 504.61760000000004, 518.4939808, 536.0407225280001,
555.0914722432001, 573.6424958741632, 592.0240908917791, 608.7716633030329,
636.8021608867887, 665.5678353044013
]
}
const res = await gb.calculate({
currentMonthlyBill: 50,
postcode: "pl13fh",
retrofit: true,
});
{
"tariff": {
"operatorId": 23,
"elecImportUnitRate": 16.63,
"elecStandingCharge": 21.6,
"gasImportUnitRate": 3.13,
"gasStandingCharge": 25.82,
"higherExportUnitRate": 14,
"exportUnitRate": 0,
"yearlyExportCapKwh": 1000
},
"totalBenefit": [
400.4258, 409.837888, 426.61306496000003, 462.4309121792001,
473.64153594841605, 485.98940266810115, 497.6012977617117,
505.2692954629117, 521.580968312763, 532.7727484095135
]
}
FAQs
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Research
/Security News
Another wave of Shai-Hulud campaign hits npm.

Product
Add real-time Socket webhook events to your workflows to automatically receive software supply chain alert changes in real time.

Security News
ENISA has become a CVE Program Root, giving the EU a central authority for coordinating vulnerability reporting, disclosure, and cross-border response.