Project

growatt

0.0
The project is in a healthy, maintained state
A Ruby wrapper for the Growatt APIs (readonly)
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

 Project Readme

Growatt API

Version Maintainability Test Coverage

This is a wrapper for the Growatt rest API. Main objective is to turn inverter on/off. This has been testen with MOD-9000TL-X.

Installation

Add this line to your application's Gemfile:

gem 'growatt'

And then execute:

$ bundle install

Or install it yourself as:

$ gem install growatt

Usage

Before you start making the requests to API provide the username and password using with Shinephone app.

require 'growatt'
require 'logger'
TEST_LOGGER = './test.log'
# use do block
Growatt.configure do |config|
  config.username = ENV['GROWATT_USERNAME']
  config.password = ENV['GROWATT_PASSWORD']
  config.logger = Logger.new(TEST_LOGGER)
end

# or configure with options hash
client = Growatt.client
client.login

Resources

Authentication and configuration

# setup
#
begin
  client = Growatt.client
  client.login
  # turn invertor off
  client.turn_inverter('<serial_no>', false)
rescue Growatt::AuthenticationError => e
  puts "Error login to growatt api"
  puts e
end

Read data

# create client (don't forget to configure authentication)
# get data for first inverter for first defined plant
plants = client.plant_list
plant_id = plants.data.first.plantId
devices = client.inverter_list(plant_id)
inverter = devices.first

yymm = Time.now.strftime("%Y%m")
puts "- loading period #{yymm}"
data = client.inverter_data(inverter.deviceSn,Growatt::Timespan::MONTH,current_month)

Control

# continu from read data example above
inverter = devices.first

# turn inverter on/of
client.turn_inverter(inverter.deviceSn, false)

# or limit energy export
client.export_limit(inverter.deviceSn,Growatt::ExportLimit::PERCENTAGE, 100)
# allow energy export to grid
client.export_limit(inverter.deviceSn,Growatt::ExportLimit::DISABLE)

Publishing

  1. Update version in version.rb.
  2. Add release to CHANGELOG.md
  3. Commit.
  4. Test build.
> rake build

  1. Release
> rake release

Contributing

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

License

The gem is available as open source under the terms of the MIT License. "# growatt"