Skip to content
stekkerPublic

About

Gem to connect to the official Zaptec api

Resources

Stars

4 stars

Watchers

4 watching

Forks

Latest commit

 

History

179 Commits

Folders and files

Repository files navigation

Zaptec

Ruby gem for the Zaptec EV charger API. Built and maintained by Stekker.

Installation

gem "stekker_zaptec"

Usage

client = Zaptec::Client.new(username: "[email protected]", password: "secret")

Token caching and encryption are supported via token_cache: and encryptor: options.

Chargers

chargers = client.chargers
charger = chargers.first
charger.id              # => "de522271-91f5-..."
charger.device_id       # => "ZAP049387"
charger.installation_id # => "8a3b1c2d-..."

Charger state

state = client.state(charger.id)
state.online?                   # => true
state.charging?                 # => true
state.disconnected?             # => false
state.total_charge_power        # => 7.36 (kW)
state.max_phases                # => 3
state.total_charge_power_session # => 12.4 (kWh)
state.meter_reading             # => #<Zaptec::MeterReading reading_kwh=1234.56>

Charging commands

client.pause_charging(charger.id)
client.resume_charging(charger.id)
client.deauthorize_and_stop(charger.id)

Current control

client.update_installation(installation_id,
  AvailableCurrentPhase1: 16,
  AvailableCurrentPhase2: 16,
  AvailableCurrentPhase3: 16
)

client.update_charger(charger.id, MaxChargeCurrent: 10)

Installations

installation = client.get_installation(installation_id)
installation.address      # => "Keizersgracht 100"
installation.city         # => "Amsterdam"
installation.country_code # => "NL"

hierarchy = client.get_installation_hierarchy(installation_id)
hierarchy.network_type # => "TN_3_Phase"
hierarchy.circuits.each do |circuit|
  circuit.max_current # => 25
  circuit.chargers    # => [#<Zaptec::Charger ...>]
end

Access grant

url = client.grant_access_url(
  lookup_key: "[email protected]",
  partner_name: "My App"
)

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/stekker/zaptec.

Publishing

# - bumps the gem version to the next major, minor or patch version.
# - creates commit for the version bump
# - tags the commit
# - pushes the commit and tag
# - publishes the gem to Rubygems
bin/release [major|minor|patch]
# See also https://github.com/svenfuchs/gem-release#gem-bump

About

Gem to connect to the official Zaptec api

Resources

Stars

4 stars

Watchers

4 watching

Forks

Releases

Packages

Used by

Contributors

Languages