Documentation ¶
Overview ¶
Package powerwall implements an interface for accessing Tesla Powerwall devices via the local-network API.
Note: This API is currently undocumented, and all information about it has been obtained through reverse-engineering. Some information here may therefore be incomplete or incorrect at this time, and it is also possible that the API will change without warning.
Much of the information used to build this library was obtained from https://github.com/vloschiavo/powerwall2. If you have additional information about any of this, please help by contributing what you know to that project.
General usage:
First, you will need to create a new powerwall.Client object using the NewClient function. After that has been done, you can use any of the following functions on that object to interact with the Powerwall gateway.
Functions for configuring the client object:
(*Client) FetchTLSCert() (*Client) SetTLSCert(cert)
Functions for authentication and login:
(Note: DoLogin generally does not need to be called explicitly)
(*Client) DoLogin() (*Client) GetAuthToken() (*Client) SetAuthToken(token string)
Functions for configuring the client object:
(*Client) FetchTLSCert() (*Client) SetTLSCert(cert)
Functions for reading power meter data:
(*Client) GetMeters(category string) (*Client) GetMetersAggregates()
Functions for reading network interface info:
(*Client) GetNetworks()
Functions for getting general info about the gateway and site:
(*Client) GetStatus() (*Client) GetSiteInfo() (*Client) GetSitemaster()
Functions for getting info about the system state:
(*Client) GetSystemStatus() (*Client) GetGridFaults() (*Client) GetGridStatus() (*Client) GetSOE() (*Client) GetOperation()
Index ¶
- Constants
- func SetErrFunc(f func(string, error))
- func SetLogFunc(f func(...interface{}))
- type APIClient
- func (c *APIClient) FetchTLSCert() (*x509.Certificate, error)
- func (c *APIClient) GetGridFaults() (*[]GridFaultData, error)
- func (c *APIClient) GetGridStatus() (*GridStatusData, error)
- func (c *APIClient) GetMeters(category string) (*[]MeterData, error)
- func (c *APIClient) GetMetersAggregates() (*map[string]MeterAggregatesData, error)
- func (c *APIClient) GetNetworks() (*[]NetworkData, error)
- func (c *APIClient) GetOperation() (*OperationData, error)
- func (c *APIClient) GetProblems() (*TroubleshootingProblemsData, error)
- func (c *APIClient) GetSOE() (*SOEData, error)
- func (c *APIClient) GetSiteInfo() (*SiteInfoData, error)
- func (c *APIClient) GetSitemaster() (*SitemasterData, error)
- func (c *APIClient) GetStatus() (*StatusData, error)
- func (c *APIClient) GetSystemStatus() (*SystemStatusData, error)
- func (c *APIClient) SetConfigCompleted() (*ConfigData, error)
- func (c *APIClient) SetOperation(mode string, backupReservePercent float32) error
- func (c *APIClient) SetRetry(interval time.Duration, timeout time.Duration)
- func (c *APIClient) SetTLSCert(cert *x509.Certificate)
- func (c *APIClient) SitemasterRun() error
- func (c *APIClient) SitemasterStop() error
- type ApiError
- type AuthClient
- func (a *AuthClient) Cookies(u *url.URL) []*http.Cookie
- func (c *AuthClient) FetchTLSCert() (*x509.Certificate, error)
- func (c *AuthClient) GetAuthToken() string
- func (c *AuthClient) GetAuthTokens() (string, string)
- func (c *AuthClient) GetSessionToggleCookie() string
- func (c *AuthClient) PerformLogin() (string, string, error)
- func (a *AuthClient) SetCookies(u *url.URL, cookies []*http.Cookie)
- func (c *AuthClient) SetRetry(interval time.Duration, timeout time.Duration)
- func (c *AuthClient) SetTLSCert(cert *x509.Certificate)
- type AuthFailure
- type ConfigData
- type DecodedAlert
- type Duration
- type GridFaultData
- type GridStatusData
- type MeterAggregatesData
- type MeterData
- type NetworkData
- type NonIsoTime
- type OperationData
- type SOEData
- type SiteInfoData
- type SitemasterData
- type StatusData
- type SystemStatusData
- type ToggleSupportedResponse
- type TroubleshootingProblemsData
Constants ¶
const ( SitemasterStatusUp = "StatusUp" SitemasterStatusDown = "StatusDown" )
Possible values for the Status field of the SitemasterData struct:
const ( SitemasterRebootOK = "Yes" SitemasterRebootPowerTooHigh = "Power flow is too high" )
Known possible values returned for the CanReboot field of the SitemasterData struct:
(Note that this list is almost certainly incomplete at this point)
const ( GridStatusConnected = "SystemGridConnected" GridStatusIslanded = "SystemIslandedActive" GridStatusTransition = "SystemTransitionToGrid" )
Possible options for the GridStatus field of GridStatusData:
The powerwall can be in one of three states. "Connected" indicates that it is receiving power from the utility and functioning normally. "Islanded" means that it has gone off-grid and is generating power entirely independently of the utility power (if utility power has been lost, or if it has been put into "off-grid" mode). "Transitioning" means that it is in the process of going from being off-grid to back on-grid, which can take a little bit of time to verify the supplied power is clean and synchronize with it, etc.
const ( OperationModeSelf = "self_consumption" // Reported as "Self Powered" in the app OperationModeBackup = "backup" // Reported as "Backup-Only" in the app OperationModeTimeBased = "autonomous" // Reported as "Time-Based Control" in the app )
Possible options for the RealMode field of OperationData:
Variables ¶
This section is empty.
Functions ¶
func SetErrFunc ¶
SetErrFunc registers a callback function which will be called with additional information when certain errors occur. This can be useful if you don't want full debug logging, but still want to log additional information that might be helpful when troubleshooting, for example, API message format errors, etc.
func SetLogFunc ¶
func SetLogFunc(f func(...interface{}))
SetLogFunc registers a callback function which can be used for debug logging of the powerwall library. The provided function should accept arguments in the same format as Printf/Sprintf/etc. Note that log lines passed to this function are *not* newline-terminated, so you will need to add newlines if you want to put them out directly to stdout/stderr, etc.
Types ¶
type APIClient ¶
type APIClient struct { AuthCookie string UserRecord string // contains filtered or unexported fields }
Client represents a connection to a Tesla Energy Gateway (Powerwall controller).
func NewClient ¶
func NewClient(gatewayAddress string, gatewayLoginEmail string, authCookie string, userRecord string) *APIClient
NewClient creates a new Client object. gatewayAddress should be the IP address or hostname of the Tesla Energy Gateway (TEG) device which is connected to the network. gatewayLoginEmail and gatewayLoginPassword are the same as the email address and password which would be used for a "customer" login, when logging in via the web interface (Note: This is not necessarily the same password as used to login to Tesla's servers via the app, which can be different)
For more information on logging into an Energy Gateway, see https://www.tesla.com/support/energy/powerwall/own/monitoring-from-home-network
func (*APIClient) FetchTLSCert ¶
func (c *APIClient) FetchTLSCert() (*x509.Certificate, error)
FetchTLSCert queries the gateway and returns a copy of the TLS certificate it is currently presenting for connections. This is useful for saving and later using with `SetTLSCert` to validate future connections.
func (*APIClient) GetGridFaults ¶
func (c *APIClient) GetGridFaults() (*[]GridFaultData, error)
GetGridFaults returns a list of any current "grid fault" events detected by the system. These generally indicate some issue with the utility power, such as being over or undervoltage, etc.
This same information is also returned by GetSystemStatus in the GridFaults field.
See the GridFaultData type for more information on what fields this returns.
func (*APIClient) GetGridStatus ¶
func (c *APIClient) GetGridStatus() (*GridStatusData, error)
GetGridStatus returns information about the current state of the Powerwall's connection to the utility power grid.
See the GridStatusData type for more information on what fields this returns.
func (*APIClient) GetMeters ¶
GetMeters fetches detailed meter data for each meter under the specified category. Note that as of this writing, only the "site" and "solar" categories appear to return any data.
If the API returns no data (i.e. an unsupported category name was provided), this will return nil.
See the MeterData type for more information on what fields this returns.
func (*APIClient) GetMetersAggregates ¶
func (c *APIClient) GetMetersAggregates() (*map[string]MeterAggregatesData, error)
GetMetersAggregates fetches aggregated meter data for power transferred to/from each category of connection ("site", "solar", "battery", "load", etc).
See the MetersAggregatesData type for more information on what fields this returns.
func (*APIClient) GetNetworks ¶
func (c *APIClient) GetNetworks() (*[]NetworkData, error)
GetNetworks returns information about all of the network interfaces in the system, and their statuses.
See the NetworkData type for more information on what fields this returns.
func (*APIClient) GetOperation ¶
func (c *APIClient) GetOperation() (*OperationData, error)
GetOperation returns information about the current operation mode configuration. This includes whether the Powerwall is configured for "Self Powered" mode or "Time Based Control", how much of the battery is reserved for backup use, etc.
See the OperationData type for more information on what fields this returns.
func (*APIClient) GetProblems ¶
func (c *APIClient) GetProblems() (*TroubleshootingProblemsData, error)
GetProblems returns info about "troubleshooting problems" currently reported by the Powerwall gateway. The format of these reports is currently not documented, but it can potentially still be useful to determine whether the list is non-empty (and thus some investigation is required) or not.
See the TroubleshootingProblemsData type for more information on what fields this returns.
func (*APIClient) GetSOE ¶
GetSOE returns information about the current "State Of Energy" of the system. That is, how much total charge (as a percentage) is present across all batteries.
See the SOEData type for more information on what fields this returns.
func (*APIClient) GetSiteInfo ¶
func (c *APIClient) GetSiteInfo() (*SiteInfoData, error)
GetSiteInfo returns information about the "site". This includes general information about the installation, configuration of the hardware, utility grid it is connected to, etc.
See the SiteInfoData type for more information on what fields this returns.
func (*APIClient) GetSitemaster ¶
func (c *APIClient) GetSitemaster() (*SitemasterData, error)
GetSitemaster returns information about the Powerwall gateway's "sitemaster" process, which handles most of the normal day-to-day tasks of the system (monitoring power, directing it to the right places, etc).
See the SitemasterData type for more information on what fields this returns.
func (*APIClient) GetStatus ¶
func (c *APIClient) GetStatus() (*StatusData, error)
GetStatus performs a "status" API call to fetch basic information about the system, such as the device identification number (part number + serial number), software version, uptime, device type, etc.
Note that this is one of the only API calls which can be made without logging in first.
See the StatusData type for more information on what fields this returns.
func (*APIClient) GetSystemStatus ¶
func (c *APIClient) GetSystemStatus() (*SystemStatusData, error)
GetSystemStatus performs a "system_status" API call to fetch general information about the system operation and state.
See the SystemStatusData type for more information on what fields this returns.
func (*APIClient) SetConfigCompleted ¶
func (c *APIClient) SetConfigCompleted() (*ConfigData, error)
func (*APIClient) SetOperation ¶
func (*APIClient) SetRetry ¶
SetRetry sets the retry interval and timeout used when making HTTP requests. Setting timeout to zero (or negative) will disable retries (default).
(Note: The client will only attempt retries on network errors (connection timed out, etc), not other issues)
func (*APIClient) SetTLSCert ¶
func (c *APIClient) SetTLSCert(cert *x509.Certificate)
SetTLSCert sets the TLS certificate which should be used for validating the certificate presented when connecting to the gateway is correct. You can obtain the current certificate in use by the gateway initially via `FetchTLSCert`, and then supply it via this function whenever creating a new connection to ensure the certificate matches the previously fetched one.
func (*APIClient) SitemasterRun ¶
func (*APIClient) SitemasterStop ¶
type ApiError ¶
ApiError indicates that something unexpected occurred with the HTTP API call. This usually occurs when the endpoint returns an unexpected status code.
type AuthClient ¶
type AuthClient struct {
// contains filtered or unexported fields
}
Client represents an authenticationconnection to a Tesla Energy Gateway (Powerwall controller).
func NewAuthClient ¶
func NewAuthClient(gatewayAddress string, installerEmail string) *AuthClient
NewClient creates a new Client object. gatewayAddress should be the IP address or hostname of the Tesla Energy Gateway (TEG) device which is connected to the network. gatewayLoginEmail and gatewayLoginPassword are the same as the email address and password which would be used for a "customer" login, when logging in via the web interface (Note: This is not necessarily the same password as used to login to Tesla's servers via the app, which can be different)
For more information on logging into an Energy Gateway, see https://www.tesla.com/support/energy/powerwall/own/monitoring-from-home-network
func (*AuthClient) FetchTLSCert ¶
func (c *AuthClient) FetchTLSCert() (*x509.Certificate, error)
FetchTLSCert queries the gateway and returns a copy of the TLS certificate it is currently presenting for connections. This is useful for saving and later using with `SetTLSCert` to validate future connections.
func (*AuthClient) GetAuthToken ¶
func (c *AuthClient) GetAuthToken() string
GetAuthToken returns the current auth token in use. This can be saved and then passed to SetAuthToken on later connections to re-use the same token across Clients.
func (*AuthClient) GetAuthTokens ¶
func (c *AuthClient) GetAuthTokens() (string, string)
Returns a tuple of ("AuthCookie", "UserRecord"), which you _must_ provide to functions used in the APIClient
func (*AuthClient) GetSessionToggleCookie ¶
func (c *AuthClient) GetSessionToggleCookie() string
func (*AuthClient) PerformLogin ¶
func (c *AuthClient) PerformLogin() (string, string, error)
PerformLogin performs the login process to the gateway. If the email parameter is non-nil, it will be used as the email address to login with. If it is nil, the email address passed to NewAuthClient will be used. Returns the auth token and user record, or an error if the login failed.
func (*AuthClient) SetCookies ¶
func (a *AuthClient) SetCookies(u *url.URL, cookies []*http.Cookie)
func (*AuthClient) SetRetry ¶
func (c *AuthClient) SetRetry(interval time.Duration, timeout time.Duration)
SetRetry sets the retry interval and timeout used when making HTTP requests. Setting timeout to zero (or negative) will disable retries (default).
(Note: The client will only attempt retries on network errors (connection timed out, etc), not other issues)
func (*AuthClient) SetTLSCert ¶
func (c *AuthClient) SetTLSCert(cert *x509.Certificate)
SetTLSCert sets the TLS certificate which should be used for validating the certificate presented when connecting to the gateway is correct. You can obtain the current certificate in use by the gateway initially via `FetchTLSCert`, and then supply it via this function whenever creating a new connection to ensure the certificate matches the previously fetched one.
type AuthFailure ¶
AuthFailure is returned when the client was unable to perform a request because it was not able to login using the provided email and password.
func (AuthFailure) Error ¶
func (e AuthFailure) Error() string
type ConfigData ¶
type ConfigData struct { Din string `json:"din"` StartTime string `json:"start_time"` UpTime string `json:"up_time_seconds"` IsNew bool `json:"is_new"` Version string `json:"version"` GitHash string `json:"git_hash"` CommissionCount int `json:"commission_count"` DeviceType string `json:"device_type"` TegType string `json:"teg_type"` SyncType string `json:"sync_type"` CellularDisabled bool `json:"cellular_disabled"` CanReboot bool `json:"can_reboot"` }
type DecodedAlert ¶
The DecodedAlert type is used for unpacking values in the "decoded_alert" field of GridFault structures. These are actually encoded as a string, which itself contains a JSON representation of a list of maps, each one containing a "name" and "value". For example:
"[{\"name\":\"PINV_alertID\",\"value\":\"PINV_a008_vfCheckRocof\"},{\"name\":\"PINV_alertType\",\"value\":\"Warning\"}]"
Needless to say, this encoding is rather cumbersome and redundant, so we instead provide a custom JSON decoder to decode these into a string/string map in the form 'name: value'.
func (*DecodedAlert) UnmarshalJSON ¶
func (v *DecodedAlert) UnmarshalJSON(data []byte) error
type Duration ¶
Durations in the API are typically represented as strings in duration-string format ("1h23m45.67s", etc). Go's time.Duration type actually produces this format natively, yet will not parse it as an input when unmarshalling JSON (grr), so we need a custom type (with a custom UnmarshalJSON function) to handle this.
func (*Duration) MarshalJSON ¶
func (*Duration) UnmarshalJSON ¶
type GridFaultData ¶
type GridFaultData struct { Timestamp int64 `json:"timestamp"` AlertName string `json:"alert_name"` AlertIsFault bool `json:"alert_is_fault"` DecodedAlert DecodedAlert `json:"decoded_alert"` AlertRaw int64 `json:"alert_raw"` GitHash string `json:"git_hash"` SiteUID string `json:"site_uid"` EcuType string `json:"ecu_type"` EcuPackagePartNumber string `json:"ecu_package_part_number"` EcuPackageSerialNumber string `json:"ecu_package_serial_number"` }
GridFaultData contains fields returned by the "system_status/grid_faults" API call.
This structure is returned by the GetSystemStatus and GetGridFaults functions.
type GridStatusData ¶
type GridStatusData struct { GridStatus string `json:"grid_status"` GridServicesActive bool `json:"grid_services_active"` }
GridStatusData contains fields returned by the "system_status/grid_status" API call.
This structure is returned by the GetGridStatus function.
type MeterAggregatesData ¶
type MeterAggregatesData struct { LastCommunicationTime time.Time `json:"last_communication_time"` InstantPower float32 `json:"instant_power"` InstantReactivePower float32 `json:"instant_reactive_power"` InstantApparentPower float32 `json:"instant_apparent_power"` Frequency float32 `json:"frequency"` EnergyExported float32 `json:"energy_exported"` EnergyImported float32 `json:"energy_imported"` InstantAverageVoltage float32 `json:"instant_average_voltage"` InstantAverageCurrent float32 `json:"instant_average_current"` IACurrent float32 `json:"i_a_current"` IBCurrent float32 `json:"i_b_current"` ICCurrent float32 `json:"i_c_current"` LastPhaseVoltageCommunicationTime time.Time `json:"last_phase_voltage_communication_time"` LastPhasePowerCommunicationTime time.Time `json:"last_phase_power_communication_time"` Timeout int `json:"timeout"` NumMetersAggregated int `json:"num_meters_aggregated"` InstantTotalCurrent float32 `json:"instant_total_current"` }
MeterAggregatesData contains fields returned by the "meters/aggregates" API call. This reflects statistics collected across all of the meters in a given category (e.g. "site", "solar", "battery", "load", etc).
This structure is returned by the GetMetersAggregates function.
type MeterData ¶
type MeterData struct { ID int `json:"id"` Location string `json:"location"` Type string `json:"type"` Cts []bool `json:"cts"` Inverted []bool `json:"inverted"` Connection struct { ShortID string `json:"short_id"` DeviceSerial string `json:"device_serial"` HTTPSConf struct { ClientCert string `json:"client_cert"` ClientKey string `json:"client_key"` ServerCaCert string `json:"server_ca_cert"` MaxIdleConnsPerHost int `json:"max_idle_conns_per_host"` } `json:"https_conf"` } `json:"connection"` RealPowerScaleFactor float32 `json:"real_power_scale_factor"` CachedReadings struct { LastCommunicationTime time.Time `json:"last_communication_time"` InstantPower float32 `json:"instant_power"` InstantReactivePower float32 `json:"instant_reactive_power"` InstantApparentPower float32 `json:"instant_apparent_power"` Frequency float32 `json:"frequency"` EnergyExported float32 `json:"energy_exported"` EnergyImported float32 `json:"energy_imported"` InstantAverageVoltage float32 `json:"instant_average_voltage"` InstantAverageCurrent float32 `json:"instant_average_current"` IACurrent float32 `json:"i_a_current"` IBCurrent float32 `json:"i_b_current"` ICCurrent float32 `json:"i_c_current"` VL1N float32 `json:"v_l1n"` VL2N float32 `json:"v_l2n"` LastPhaseVoltageCommunicationTime time.Time `json:"last_phase_voltage_communication_time"` RealPowerA float32 `json:"real_power_a"` RealPowerB float32 `json:"real_power_b"` ReactivePowerA float32 `json:"reactive_power_a"` ReactivePowerB float32 `json:"reactive_power_b"` LastPhasePowerCommunicationTime time.Time `json:"last_phase_power_communication_time"` SerialNumber string `json:"serial_number"` Timeout int `json:"timeout"` InstantTotalCurrent float32 `json:"instant_total_current"` } `json:"Cached_readings"` CtVoltageReferences struct { Ct1 string `json:"ct1"` Ct2 string `json:"ct2"` Ct3 string `json:"ct3"` } `json:"ct_voltage_references"` }
MeterData contains fields returned by the "meters/<category>" API call, which returns information for each individual meter within that category.
A list of this structure is returned by the GetMeters function.
type NetworkData ¶
type NetworkData struct { NetworkName string `json:"network_name"` Interface string `json:"interface"` Dhcp bool `json:"dhcp"` Enabled bool `json:"enabled"` ExtraIps []struct { IP string `json:"ip"` Netmask int `json:"netmask"` } `json:"extra_ips,omitempty"` Active bool `json:"active"` Primary bool `json:"primary"` LastTeslaConnected bool `json:"lastTeslaConnected"` LastInternetConnected bool `json:"lastInternetConnected"` IfaceNetworkInfo struct { NetworkName string `json:"network_name"` IPNetworks []struct { IP string `json:"ip"` Mask string `json:"mask"` } `json:"ip_networks"` Gateway string `json:"gateway"` Interface string `json:"interface"` State string `json:"state"` StateReason string `json:"state_reason"` SignalStrength int `json:"signal_strength"` HwAddress string `json:"hw_address"` } `json:"iface_network_info"` SecurityType string `json:"security_type"` Username string `json:"username"` }
NetworkData contains information returned by the "networks" API call for a particular network interface.
A list of this structure is returned by the GetNetworks function.
type NonIsoTime ¶
Most time values in the API are produced in standard ISO-8601 format, which works just fine for unmarshalling to time.Time as well. However, the "start_time" field of the status API call is not returned in this format for some reason and thus will not unmarshal directly to a time.Time value. We provide a custom type to handle this case.
func (*NonIsoTime) UnmarshalJSON ¶
func (v *NonIsoTime) UnmarshalJSON(p []byte) error
type OperationData ¶
type OperationData struct { RealMode string `json:"real_mode"` BackupReservePercent float32 `json:"backup_reserve_percent"` FreqShiftLoadShedSoe float32 `json:"freq_shift_load_shed_soe"` FreqShiftLoadShedDeltaF float64 `json:"freq_shift_load_shed_delta_f"` }
OperationData contains fields returned by the "operation" API call.
This structure is returned by the GetOperation function.
type SOEData ¶
type SOEData struct {
Percentage float32 `json:"percentage"`
}
SOEData contains fields returned by the "system_status/soe" API call. This currently just returns a single "Percentage" field, indicating the total amount of charge across all batteries.
This structure is returned by the GetSOE function.
type SiteInfoData ¶
type SiteInfoData struct { SiteName string `json:"site_name"` TimeZone string `json:"timezone"` MaxSiteMeterPowerKW int `json:"max_site_meter_power_kW"` MinSiteMeterPowerKW int `json:"min_site_meter_power_kW"` MeasuredFrequency float32 `json:"measured_frequency"` MaxSystemEnergyKWH float32 `json:"max_system_energy_kWh"` MaxSystemPowerKW float32 `json:"max_system_power_kW"` NominalSystemEnergyKWH float32 `json:"nominal_system_energy_kWh"` NominalSystemPowerKW float32 `json:"nominal_system_power_kW"` GridData struct { GridCode string `json:"grid_code"` GridVoltageSetting int `json:"grid_voltage_setting"` GridFreqSetting int `json:"grid_freq_setting"` GridPhaseSetting string `json:"grid_phase_setting"` Country string `json:"country"` State string `json:"state"` Distributor string `json:"distributor"` Utility string `json:"utility"` Retailer string `json:"retailer"` Region string `json:"region"` } `json:"grid_code"` }
SiteInfoData contains information returned by the "site_info" API call.
This structure is returned by the GetSiteInfo function.
type SitemasterData ¶
type SitemasterData struct { Status string `json:"status"` Running bool `json:"running"` ConnectedToTesla bool `json:"connected_to_tesla"` PowerSupplyMode bool `json:"power_supply_mode"` CanReboot string `json:"can_reboot"` }
SitemasterData contains information returned by the "sitemaster" API call.
The CanReboot field indicates whether the sitemaster can be stopped/restarted without disrupting anything or not. It will be either "Yes", or it will be a string indicating the reason why it can't be stopped right now (such as "Power flow is too high"). (see the SitemasterReboot* constants for known possible values)
Note that it is still possible to stop the sitemaster even under these conditions, but it is necessary to set the "force" option to true when calling the "sitemaster/stop" API in that case.
This structure is returned by the GetSitemaster function.
type StatusData ¶
type StatusData struct { Din string `json:"din"` StartTime NonIsoTime `json:"start_time"` UpTime Duration `json:"up_time_seconds"` IsNew bool `json:"is_new"` Version string `json:"version"` GitHash string `json:"git_hash"` CommissionCount int `json:"commission_count"` DeviceType string `json:"device_type"` SyncType string `json:"sync_type"` Leader string `json:"leader"` Followers interface{} `json:"followers"` // TODO: Unsure what type this returns when present CellularDisabled bool `json:"cellular_disabled"` }
StatusData contains general system information returned by the "status" API call, such as the device identification number, type, software version, etc.
This structure is returned by the GetStatus function.
type SystemStatusData ¶
type SystemStatusData struct { CommandSource string `json:"command_source"` BatteryTargetPower float32 `json:"battery_target_power"` BatteryTargetReactivePower float32 `json:"battery_target_reactive_power"` NominalFullPackEnergy float32 `json:"nominal_full_pack_energy"` NominalEnergyRemaining float32 `json:"nominal_energy_remaining"` MaxPowerEnergyRemaining float32 `json:"max_power_energy_remaining"` MaxPowerEnergyToBeCharged float32 `json:"max_power_energy_to_be_charged"` MaxChargePower float32 `json:"max_charge_power"` MaxDischargePower float32 `json:"max_discharge_power"` MaxApparentPower float32 `json:"max_apparent_power"` InstantaneousMaxDischargePower float32 `json:"instantaneous_max_discharge_power"` InstantaneousMaxChargePower float32 `json:"instantaneous_max_charge_power"` GridServicesPower float32 `json:"grid_services_power"` SystemIslandState string `json:"system_island_state"` AvailableBlocks int `json:"available_blocks"` BatteryBlocks []struct { Type string `json:"Type"` PackagePartNumber string `json:"PackagePartNumber"` PackageSerialNumber string `json:"PackageSerialNumber"` DisabledReasons []interface{} `json:"disabled_reasons"` // TODO: Unclear what type these entries are when present. PinvState string `json:"pinv_state"` PinvGridState string `json:"pinv_grid_state"` NominalEnergyRemaining float32 `json:"nominal_energy_remaining"` NominalFullPackEnergy float32 `json:"nominal_full_pack_energy"` POut float32 `json:"p_out"` QOut float32 `json:"q_out"` VOut float32 `json:"v_out"` FOut float32 `json:"f_out"` IOut float32 `json:"i_out"` EnergyCharged float32 `json:"energy_charged"` EnergyDischarged float32 `json:"energy_discharged"` OffGrid bool `json:"off_grid"` VfMode bool `json:"vf_mode"` WobbleDetected bool `json:"wobble_detected"` ChargePowerClamped bool `json:"charge_power_clamped"` BackupReady bool `json:"backup_ready"` OpSeqState string `json:"OpSeqState"` Version string `json:"version"` } `json:"battery_blocks"` FfrPowerAvailabilityHigh float32 `json:"ffr_power_availability_high"` FfrPowerAvailabilityLow float32 `json:"ffr_power_availability_low"` LoadChargeConstraint float32 `json:"load_charge_constraint"` MaxSustainedRampRate float32 `json:"max_sustained_ramp_rate"` GridFaults []GridFaultData `json:"grid_faults"` CanReboot string `json:"can_reboot"` SmartInvDeltaP float32 `json:"smart_inv_delta_p"` SmartInvDeltaQ float32 `json:"smart_inv_delta_q"` LastToggleTimestamp time.Time `json:"last_toggle_timestamp"` SolarRealPowerLimit float32 `json:"solar_real_power_limit"` Score float32 `json:"score"` BlocksControlled int `json:"blocks_controlled"` Primary bool `json:"primary"` AuxiliaryLoad float32 `json:"auxiliary_load"` AllEnableLinesHigh bool `json:"all_enable_lines_high"` InverterNominalUsablePower float32 `json:"inverter_nominal_usable_power"` ExpectedEnergyRemaining float32 `json:"expected_energy_remaining"` }
SystemStatusData contains fields returned by the "system_status" API call. This contains a lot of information about the general state of the system and how it is operating, such as battery charge, utility power status, etc.
This structure is returned by the GetSystemStatus function.
type ToggleSupportedResponse ¶
type ToggleSupportedResponse struct {
ToggleAuthSupported bool `json:"toggle_auth_supported"`
}
type TroubleshootingProblemsData ¶
type TroubleshootingProblemsData struct {
Problems []interface{} `json:"problems"` // TODO: Unsure what type these values are when present
}
TroubleshootingProblemsData contains info returned by the "troubleshooting/problems" API call.
The format of the entries in the Problems list is currently unknown. If you have any examples, please let us know!
This structure is returned by the GetProblems function.