Skip to content

Latest commit

 

History

8 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AutoShore

AutoShore is a local control daemon for Victron GX devices running Venus OS. It uses Nord Pool day-ahead electricity prices and battery state of charge (SoC) to control a connected VE.Bus inverter/charger's shore-power mode.

The daemon runs on the GX device, reads Victron D-Bus services, and changes the VE.Bus mode between On and Inverter Only. It is intended for installations where charging from shore power should occur during lower-priced periods while respecting configured SoC limits.

Current version: 0.2.6

Warning

AutoShore changes the operating mode of a VE.Bus inverter/charger. Review the decision rules, configure safe SoC limits, and confirm that no other automation is responsible for the same VE.Bus mode. Test the installation while you can supervise it locally.

Features

  • Fetches Nord Pool day-ahead prices for the configured delivery area and currency.
  • Caches current and next-day prices on the GX device.
  • Connects shore power only when the configured price and SoC conditions allow it.
  • Disconnects shore power when the price or SoC reaches the configured stop condition.
  • Exposes an AutoShore Enabled toggle and schedule text in the GX user interface.
  • Disables itself if it detects a manual change to the VE.Bus mode after it has taken control.
  • Installs as a persistent Venus OS service under /data/autoshore.

Compatibility and requirements

AutoShore requires a Venus OS GX installation that exposes the VE.Bus service below. With the default Use_External_Battery_Soc: Auto, it also uses a connected external battery service on ttyS<n> when available, then falls back to VE.Bus SoC.

  • com.victronenergy.vebus, with /Mode, /Ac/State/AcIn1Available, and /Soc
  • Optional external source: com.victronenergy.battery.ttyS<n>, with /Soc

In practice, this means a GX device connected to a compatible VE.Bus Multi, Quattro, or inverter that publishes usable SoC. An external shunt on ttyS<n> is optional and preferred by default when present. It can be used with standalone GX hardware, such as Venus GX, Cerbo GX, and Ekrano GX, as well as GX-equipped inverter/chargers, such as MultiPlus-II GX and EasySolar-II GX, when the required services are present. Victron documents GX support for compatible VE.Bus products and identifies the GX hardware used in the MultiPlus-II GX and EasySolar-II GX ranges in its GX documentation and Venus GX manual.

Before installation, you need:

  • A local network path to the GX device.
  • A computer with Bash and the OpenSSH client.
  • Root SSH access to the GX device, using either a password or an SSH key.
  • Internet access from the GX device for the Nord Pool API.
  • A system configuration in which switching the VE.Bus mode is safe.

The installer checks for Victron GX markers before copying files. It does not replace a site-specific commissioning review or prove that every firmware and product combination is suitable.

Venus OS access

The installer requires root access over SSH. On the GX device, enable the Superuser access level, set a root password if you are using password authentication, and enable SSH on LAN. Victron's Venus OS root access guide describes these steps and explains that SSH keys stored on /data persist through firmware updates.

The installer writes AutoShore beneath /data, which Victron documents as the persistent data partition. It also adds an AutoShore startup line to /data/rc.local. Check the service after any Venus OS update.

How AutoShore decides

AutoShore uses two SoC limits to provide hysteresis:

  • It may connect shore power only when the current price is below the configured threshold and SoC is below SoC_Percentage_Connect_Under.
  • It disconnects shore power when the price is at or above the threshold or SoC is at or above SoC_Percentage_Disconnect_Over.
  • When SoC is between those limits during a lower-priced period, it leaves the current state unchanged.

The daemon only acts after it finds both required D-Bus services and detects shore AC availability. If there is no usable current-price data, its normal fallback is Inverter Only, which disconnects shore power. If the VE.Bus mode is already Charger Only or Off, AutoShore treats that as a manual state and leaves it alone.

When enabled, AutoShore remembers the VE.Bus mode it last observed or set. A later manual change through the native Victron control disables AutoShore so it does not fight the operator. Disabling AutoShore from its own UI also stops it from changing the VE.Bus mode.

Price data is fetched at startup when absent, then the next day's data is requested daily at Nord_Pool_Query_Time_UTC. The daemon caches price files in /data/autoshore/data, keyed by Nord Pool delivery date. Price decisions use each timestamped delivery slot, so local midnight is not tied to UTC midnight.

Connection_Logic: Threshold uses the configured price limit. Connection_Logic: Best selects the requested number of cheapest 15-minute slots in each Nord Pool delivery day. SoC limits still prevent charging above the configured upper limit.

Configuration

Edit config/autoshore.conf before the first installation. The installer copies it to /data/autoshore/autoshore.conf on the GX device.

Setting Default Meaning
Global_Enable True Starts AutoShore enabled. Use True or False (case-insensitive).
Use_External_Battery_Soc Auto Use a valid connected com.victronenergy.battery.ttyS<n> SoC source when available, otherwise use VE.Bus /Soc. Set False to always use VE.Bus /Soc.
Connection_Logic Threshold Threshold uses the monetary limit. Best selects the cheapest daily 15-minute slots.
Best_Of_Mode_Number_Of_Hours 8 Whole hours to charge in Best mode, from 1 through 24.
Best_Of_Mode_Late_Behavior Recalculate More than three minutes into a planned slot, either recalculate remaining slots or keep the plan. At fourteen minutes, recalculation is forced unless too few slots remain.
SoC_Percentage_Connect_Under 80 Connect only below this SoC percentage. Values are clamped to 0 through 100.
SoC_Percentage_Disconnect_Over 90 Disconnect at or above this SoC percentage. Values are clamped to 0 through 100.
Nord_Pool_Query_Time_UTC 1500 UTC time for the daily next-day price query, in HHMM form.
Nord_Pool_Poll_Interval_On_Error 30m Retry interval after a failed price query. Use 0 to 60m or 1 to 10h.
Nord_Pool_Poll_Tries_Before_Bail 10 Maximum failed price-query attempts before giving up for that date. Values are clamped to 0 through 50.
Nord_Pool_Zone NO3 Nord Pool delivery area. See the supported values below.
Nord_Pool_Currency NOK Currency returned by Nord Pool. See the supported values below.
Nord_Pool_Price_Threshold_Per_MWh 300 Maximum price, in the configured currency per MWh, considered cheap enough to connect. Values are clamped to 0 through 9999.
Nord_Pool_Connect_Before_Offset_Seconds 5 Seconds before a price boundary to evaluate a potential connection. Clamped to 0 through 60.
Nord_Pool_Disconnect_Before_Offset_Seconds 1 Seconds before a price boundary to evaluate a potential disconnection. Clamped to 0 through 60.
Local_Time_Zone_Offset_Override blank Optional UTC offset, including fractional hours such as 5.5. Leave blank to use the GX device's local timezone. Values are clamped to -13 through 12.

Supported Nord Pool zones are EE, LT, LV, AR, BE, FR, GER, NL, PL, DK1, DK2, FI, NO1, NO2, NO3, NO4, NO5, SE1, SE2, SE3, SE4, BG, TEL, and SYS. Supported currencies are DKK, EUR, NOK, PLN, RON, and SEK.

Missing, malformed, or unsupported configuration values prevent the daemon from starting. Numeric values described as clamped are constrained to their stated range instead.

Changing an installed configuration

The daemon validates its configuration at startup, then checks /data/autoshore/autoshore.conf for changes every two seconds. A valid manual edit takes effect without a restart. An invalid replacement is rejected with an error in the AutoShore log while the last valid configuration stays active. Changing the Nord Pool zone or currency starts fresh queries and uses a separate price-cache directory for that market. During an upgrade, the installer asks whether to keep the existing configuration; if kept, it appends every setting missing from the shipped template without overwriting existing values.

Installation

  1. Review and adjust config/autoshore.conf.

  2. On the GX device, complete the Venus OS root-access prerequisites described above.

  3. From this repository on your computer, run:

    ./install.sh
  4. Follow the prompts to select password or SSH-key authentication and enter the GX device address. Press Enter at the address prompt to use venus.local.

  5. Confirm that the installer reports that the service is up, then check the AutoShore entry in the GX user interface.

The installer creates /data/autoshore, copies the daemon and version file, creates the service runners, adds a persistent /data/rc.local startup entry without overwriting existing content, and enables /service/autoshore.

Uninstallation

Run a dry run first to inspect the exact remote changes:

./uninstall.sh --dry-run

The uninstaller verifies the GX identity and accepts only the AutoShore paths created by this installer. It removes the exact AutoShore entry from /data/rc.local, stops and unlinks /service/autoshore, and deletes /data/autoshore, including the active configuration and price caches.

Use --keep-data to retain /data/autoshore, or --purge-logs to also delete /var/log/autoshore. The latter is not removed by default so logs remain available for diagnosis. --force accepts the displayed removal plan but never overrides the ownership checks.

Installer options

./install.sh [options]

  -h, --help                 Show help.
      --address ADDRESS      GX device IPv4 address or .local hostname.
      --key PATH             SSH private key path. Otherwise choose password or key interactively.
      --non-interactive      Skip the prerequisites text and confirmation.
      --force                Skip reinstall and configuration prompts, and overwrite configuration.
./uninstall.sh [options]

  -h, --help                 Show help.
      --address ADDRESS      GX device IPv4 address or .local hostname.
      --key PATH             SSH private key path. Otherwise choose password or key interactively.
      --non-interactive      Do not prompt; requires --address and uses --key or SSH agent.
      --force                Accept the approved removal plan without prompting.
      --dry-run              Inspect the GX device and print planned changes only.
      --keep-data            Keep /data/autoshore, including configuration and price caches.
      --purge-logs           Also remove /var/log/autoshore after confirmation.

For example:

./install.sh --address 192.168.1.50 --key ~/.ssh/id_ed25519

--non-interactive only skips the prerequisite notice and prevents retrying invalid values supplied through --address or --key. It does not invent missing authentication or address values, so prompts can still appear. --force accepts reinstall prompts and overwrites an existing AutoShore configuration. Use it only when that configuration replacement is intended.

Caution

The installer disables SSH host-key checking and does not save the GX device host key. Run it only on a trusted local network and verify the target address before entering credentials.

Operation and troubleshooting

  • The GX user interface publishes an AutoShore Enabled toggle and the next scheduled price-driven change.
  • The service log directory is /var/log/autoshore on the GX device.
  • If AutoShore reports that it is waiting for devices, confirm that the expected VE.Bus and battery services are visible on the GX device.
  • If it reports no shore power, verify the VE.Bus /Ac/State/AcIn1Available state and the physical AC input.
  • If price data is unavailable, check the GX device's Internet access, Nord Pool zone and currency, and the service log. The normal fallback is to use Inverter Only when AutoShore owns the VE.Bus mode.
  • If the AutoShore toggle turns itself off after native mode changes, re-enable it only after confirming that automatic control should resume.

Development status

The installer has command-line and syntax tests. The daemon test suite is a scaffold: most behavior tests are intentionally skipped until Victron D-Bus and HTTP test doubles are added. A real GX device is required for meaningful integration testing.

Run the available local tests with:

python3 -m unittest discover -s tests -v

Project layout

Path Purpose
src/autoshore.py GX-resident daemon and control logic.
config/autoshore.conf Default deployment configuration.
install.sh Remote installer for a GX device.
uninstall.sh Guarded remote uninstaller for a GX device.
tests/ Installer tests and daemon test scaffold.

License

This project is released under the MIT License.

About

AutoShore is a local control daemon for Victron GX devices running Venus OS. It uses Nord Pool day-ahead electricity prices and battery state of charge (SoC) to control a connected VE.Bus inverter/charger's shore-power mode.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Used by

Contributors

Languages