Documentation
¶
Index ¶
- Constants
- func BrokerIndexFromPortalID(portalID string) int
- func BrokerURL(brokerIndex int) string
- func ConnectBroker(broker, username, password string) (*brokerConnection, error)
- func Login(username, password string, opts ...LoginOption) (*vrmSession, error)
- func LoginAsDemo() (*vrmSession, error)
- func MapTemplate(templateText string, replacements map[string]string) (string, error)
- type DiagnosticsResponse
- type HTTPClient
- type InstallationsResponse
- type LoginOption
- type LoginRequest
- type StatsResponse
- type SystemOverviewResponse
- type URLParams
- type UsersResponse
Examples ¶
Constants ¶
View Source
const ( // Widgets WidgetGraph string = "Graph" WidgetVeBusState string = "VeBusState" WidgetMPPTState string = "MPPTState" WidgetBatterySummary string = "BatterySummary" WidgetSolarChargerSummary string = "SolarChargerSummary" WidgetBMSDiagnostics string = "BMSDiagnostics" WidgetHistoricData string = "HistoricData" WidgetIOExtenderInOut string = "IOExtenderInOut" WidgetLithiumBMS string = "LithiumBMS" WidgetMotorSummary string = "MotorSummary" WidgetPVInverterStatus string = "PVInverterStatus" WidgetStatus string = "Status" WidgetAlarm string = "Alarm" WidgetGPS string = "GPS" WidgetHoursOfAC string = "HoursOfAC" DemoUserID int = 22 )
Variables ¶
This section is empty.
Functions ¶
func BrokerIndexFromPortalID ¶
func ConnectBroker ¶
func Login ¶
func Login(username, password string, opts ...LoginOption) (*vrmSession, error)
Example ¶
package main import ( "github.com/rs/zerolog/log" "victron/vrm" ) func main() { session, err := vrm.Login("username", "password", vrm.WithSMSToken("123456")) if err != nil { log.Error().Err(err).Msg("login failed") } _ = session.Logout() }
Output:
func LoginAsDemo ¶
func LoginAsDemo() (*vrmSession, error)
Types ¶
type DiagnosticsResponse ¶
type DiagnosticsResponse struct { Success bool `json:"success"` Records []struct { ID uint `json:"id"` Device string `json:"Device"` Instance uint `json:"instance"` Description string `json:"description"` SiteID uint `json:"idSite"` Timestamp uint `json:"timestamp"` FormatWithUnit string `json:"formatWithUnit"` DBusServiceType json.RawMessage `json:"dbusServiceType"` DBusPath json.RawMessage `json:"dbusPath"` FormattedValue json.RawMessage `json:"formattedValue"` DataAttributeID uint `json:"idDataAttribute"` DataAttributeEnumValues []struct { Name string `json:"nameEnum"` Value json.RawMessage `json:"valueEnum"` } `json:"dataAttributeEnumValues"` } `json:"records"` NumRecords uint `json:"num_records"` }
type InstallationsResponse ¶
type InstallationsResponse struct { Success bool `json:"success"` Records []struct { Name string `json:"name"` SiteID int `json:"idSite"` UserID int `json:"idUser"` PVMax int `json:"pvMax"` ReportsEnabled bool `json:"reports_enabled"` AccessLevel int `json:"accessLevel"` Timezone string `json:"timezone"` Owner bool `json:"owner"` Geofence string `json:"geofence"` GeofenceEnabled bool `json:"geofenceEnabled"` DeviceIcon string `json:"device_icon"` Alarm bool `json:"alarm,omitempty"` LastTimestamp int `json:"last_timestamp,omitempty"` Tags []struct { TagID int `json:"idTag"` Name string `json:"name"` } `json:"tags,omitempty"` TimezoneOffset int `json:"timezone_offset,omitempty"` Extended []struct { DataAttributeID int `json:"idDataAttribute"` Code string `json:"code"` Description string `json:"description"` FormatWithUnit string `json:"formatWithUnit"` RawValue json.RawMessage `json:"rawValue"` TextValue string `json:"textValue"` FormattedValue string `json:"formattedValue"` } `json:"extended,omitempty"` CurrentTime string `json:"current_time,omitempty"` } `json:"records"` }
type LoginOption ¶
type LoginOption func(*LoginRequest)
func WithSMSToken ¶
func WithSMSToken(smsToken string) LoginOption
type LoginRequest ¶
type StatsResponse ¶
type StatsResponse struct { Success bool `json:"success"` Records struct { Pc [][]json.RawMessage `json:"Pc"` } `json:"records"` Totals struct { Pb float64 `json:"Pb"` Pc float64 `json:"Pc"` Gb float64 `json:"Gb"` Gc float64 `json:"Gc"` Pg float64 `json:"Pg"` Bc float64 `json:"Bc"` Kwh float64 `json:"kwh"` } `json:"totals"` }
type SystemOverviewResponse ¶
type SystemOverviewResponse struct { Success bool `json:"success"` Records struct { Devices []struct { Name string `json:"name"` ProductCode string `json:"productCode"` ProductName string `json:"productName"` FirmwareVersion string `json:"firmwareVersion,omitempty"` LastConnection uint `json:"lastConnection"` Class string `json:"class"` LoggingInterval uint `json:"loggingInterval"` LastPowerUpOrRestart uint `json:"lastPowerUpOrRestart,omitempty"` Instance uint `json:"instance,omitempty"` } `json:"devices"` UnconfiguredDevices bool `json:"unconfigured_devices"` } `json:"records"` }
type UsersResponse ¶
type UsersResponse struct {
Success bool `json:"success"`
}
Click to show internal directories.
Click to hide internal directories.