Skip to content

Tariff Manager

Marcin Gaszewski edited this page May 25, 2026 · 2 revisions

Tariff Manager

The Tariff Manager watches any Home Assistant electricity price sensor and automatically controls your battery's charge and discharge current based on configurable price thresholds. No automations needed — everything is configured through the HA UI.


How it works

Two independent modes can be enabled separately or together:

Cheap-rate charging

Condition Action
price ≤ threshold and SOC < target Raises chargeCurrent to cheap-rate value
price rises above threshold Restores normal charge current
SOC reaches target Restores normal charge current

Expensive-rate discharging

Condition Action
price ≥ threshold and SOC > minimum Raises dischargeCurrent to peak value (sells to grid)
price drops below threshold Restores normal discharge current
SOC reaches minimum Restores normal discharge current

Both modes can be active simultaneously on the same inverter.


Supported price sensors

Any HA entity with a numeric state works:

Provider Integration
Octopus Agile / Flux / Go octopus_energy
NordPool nordpool
Tibber Built-in HA integration
Energi Data Service (DK) energidataservice
ENTSO-E entsoe
Fixed / manual price input_number helper
Any other Any sensor with numeric state

Setup

  1. Go to Settings → Devices & Services → Sunsynk → Configure
  2. Scroll to the Tariff section
  3. Fill in the fields (see reference below)
  4. Click Submit — the integration reloads
  5. Find the Tariff Manager switch entity and turn it ON

The manager always starts OFF after setup or reload. You must enable it manually.


Configuration reference

Shared

Field Description
Electricity Price Sensor Pick any HA sensor or input_number. Leave blank to disable the Tariff Manager entirely.
Price data max age (minutes) If the sensor has not updated within this many minutes, any active mode is stopped as a safety measure. Default 90. Set to 1440 to effectively disable.

Cheap-rate charging

All three fields are required together; leave all blank to disable charging mode.

Field Description
Charge below price Threshold value. When price ≤ this, charging starts (if SOC < target).
Charge current at cheap rate (A) Charge current to use during cheap period.
Normal charge current to restore (A) Charge current restored when cheap period ends.
Stop charging when SOC reaches (%) Charging stops automatically at this SOC. Default 100.

Expensive-rate discharging

All three fields are required together; leave all blank to disable discharging mode.

Field Description
Discharge above price Threshold value. When price ≥ this, discharging starts (if SOC > minimum).
Discharge current at expensive rate (A) Discharge current to use during expensive period.
Normal discharge current to restore (A) Discharge current restored when expensive period ends.
Stop discharging when SOC drops below (%) Discharging stops automatically at this SOC. Default 10.

Active schedule

Both fields must be filled together; leave both blank for always-on.

Field Description
Active schedule — start hour (0–23) Hour when the manager becomes active.
Active schedule — end hour (0–23) Hour when the manager deactivates. Supports midnight wrap — e.g. start 22, end 6 = 22:00–06:00.

Adjusting thresholds from the UI

All Tariff Manager thresholds, currents and SOC limits are exposed as Number entities in the Config entity category. You can change them directly from:

  • The auto-generated Settings dashboard view — a dedicated "Tariff Manager Configuration" card shows all eight number entities
  • Settings → Devices & Services → Sunsynk → your device — scroll to Config entities
  • Any Lovelace card using those entity IDs

Changes take effect immediately — no restart or re-configure needed. The manager re-evaluates the current price and SOC as soon as a value is changed.

Config entity IDs follow the pattern number.{prefix}_tariff_{key}. See Entities Reference for the full list.


Entities

Tariff Manager switch

  • Unique ID: {entry_id}_tariff_enabled
  • Default state: OFF
  • Turning OFF immediately restores normal charge and discharge currents on all configured inverters
  • Turning ON immediately re-evaluates the current price and SOC

Tariff Mode sensor

  • Unique ID: {entry_id}_tariff_mode
  • States: disabled · idle · charging · discharging
  • Updates in real time whenever the mode changes
  • Attributes:
    • price_entity — entity ID of the configured price sensor
    • cheap_threshold — configured cheap threshold (if set)
    • expensive_threshold — configured expensive threshold (if set)
    • active_hours — configured schedule window (if set)

Tariff Price Quality sensor (diagnostic)

  • Unique ID: {entry_id}_tariff_price_quality
  • States:
State Meaning
ok Sensor exists, state is numeric, data is fresh
unavailable Sensor state is unavailable or unknown
not_found Entity does not exist in HA state machine
invalid Sensor state is not a number
stale Sensor has not updated within the configured max age
  • Icon: mdi:check-circle when ok, mdi:alert-circle otherwise
  • Attributes:
    • price_entity — entity ID being monitored
    • max_age_minutes — configured staleness threshold
    • last_updated — ISO timestamp of last sensor update
    • current_state — raw state value of the price sensor

Price quality safety check

Every time the coordinator refreshes (default every 5 minutes) and on every price state change, quality is re-assessed. If quality drops from ok to anything else while a mode is active:

  1. The active mode is stopped immediately
  2. Normal currents are restored on all inverters
  3. An HA persistent notification is fired describing the reason
  4. The Tariff Mode sensor switches back to idle

This protects against a scenario where your price feed goes down while the battery is charging or discharging at a non-standard current.


HA Notifications

A persistent notification is created in HA on every state transition:

Event Notification title
Cheap charging starts Tariff: Charging started
Cheap charging stops Tariff: Charging stopped
Expensive discharging starts Tariff: Discharging started
Expensive discharging stops Tariff: Discharging stopped
Manager disabled Tariff Manager disabled
Bad price quality stops a mode Tariff: stopped — price data quality issue

All notifications use the ID sunsynk_tariff so they replace each other rather than stacking.


Dashboard

When the Tariff Manager is configured, two cards are automatically added to the auto-generated dashboard:

  • Overview view — Tariff Manager card with the enable switch and current mode sensor
  • Charts view — history graph showing Tariff Mode and Battery SOC over the last 24 hours

Example: Octopus Agile

Octopus Agile prices are typically cheapest between 00:00–06:00 and most expensive between 16:00–19:00. A typical configuration:

Setting Value
Price sensor sensor.octopus_energy_electricity_current_rate
Charge below price 0.10 (10p/kWh)
Charge current 100 A
Normal charge current 50 A
Target SOC 95 %
Discharge above price 0.35 (35p/kWh)
Discharge current 100 A
Normal discharge current 50 A
Min SOC 15 %
Schedule start 22
Schedule end 20
Price max age 90 min

Troubleshooting

The Tariff Manager switch is missing The switch is only created when a price entity is configured. Go to Configure and pick a price sensor.

Mode never activates even though price is correct Check the Tariff Price Quality sensor. If it shows stale or unavailable, the price data is not being received by HA — fix the price integration first.

Charging stops unexpectedly Check the HA notification for the reason. The most common causes are: price rose above threshold, SOC reached the target, or price quality dropped.

Normal current not restored after disabling If HA restarted while a mode was active, the manager has no memory of the previous state. Set the current manually via the number entity (number.{prefix}_setting_charge_current) or trigger a Configure → Save cycle to restart the manager.

Clone this wiki locally