Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),

### Fixed

- **Export Compensation can now be set to a negative value** — needed when a grid operator charges for export instead of paying for it; the field silently allowed only non-negative values. ([#666](https://github.com/johanzander/bess-manager/issues/666))
- **A brief Nordpool hiccup no longer produces a daily "recovered from an earlier issue" notice** — the health check re-fetched today's prices every five minutes instead of using the ones already held. ([#662](https://github.com/johanzander/bess-manager/issues/662))
- **Growatt VPP now lets the inverter and BMS sleep through a long idle at minimum SoC** — an empty battery was still held under continuous remote control, which nothing was protecting. ([#592](https://github.com/johanzander/bess-manager/issues/592))
- **A tiny solar surplus is no longer planned as an export the inverter will absorb** — below the export the plan can express, the battery charged anyway and ran fuller than planned, spilling the difference later. ([#630](https://github.com/johanzander/bess-manager/issues/630))
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/settings/PricingFormSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ export function PricingFormSection({ form, onChange }: Props) {
{ unit: 'factor (1.0 = no adjustment)', min: 0.5, max: 2.0, step: 0.0001 })}
{numField('Export Compensation', form.taxReduction,
v => onChange({ ...form, taxReduction: v }),
{ unit: `${currency}/kWh`, min: 0, step: 0.001 })}
{ unit: `${currency}/kWh`, step: 0.001 })}
</div>
{isEntsoe ? (
<div className="rounded-lg bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-800/40 px-4 py-3 space-y-3 text-xs text-gray-600 dark:text-gray-400">
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import { render, screen, fireEvent } from '@testing-library/react';
import { describe, it, expect, vi } from 'vitest';
import { PricingFormSection } from '../PricingFormSection';
import type { PricingForm } from '../PricingFormSection';

const BASE_FORM: PricingForm = {
currency: 'SEK',
provider: 'nordpool_official',
nordpoolConfigEntryId: '',
nordpoolEntity: '',
octopusImportTodayEntity: '',
octopusImportTomorrowEntity: '',
octopusExportTodayEntity: '',
octopusExportTomorrowEntity: '',
entsoeEntity: '',
area: '',
markupRate: 0,
vatMultiplier: 1.25,
additionalCosts: 0,
taxReduction: 0,
spotMultiplier: 1.0,
exportSpotMultiplier: 1.0,
};

describe('PricingFormSection', () => {
it('allows a negative Export Compensation value (nätnytta can be a cost, not just a credit)', () => {
const onChange = vi.fn();
render(<PricingFormSection form={BASE_FORM} onChange={onChange} />);

const input = screen.getByLabelText(/Export Compensation/i);
expect(input).not.toHaveAttribute('min', '0');

fireEvent.change(input, { target: { value: '-0.05' } });
expect(onChange).toHaveBeenCalledWith(expect.objectContaining({ taxReduction: -0.05 }));
});

it('reflects a negative Export Compensation in the sell price preview', () => {
render(<PricingFormSection form={{ ...BASE_FORM, taxReduction: -0.05 }} onChange={vi.fn()} />);

expect(screen.getByText('0.95 SEK/kWh')).toBeInTheDocument();
});
});
Loading