gotracerwifi

package module
v0.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 24, 2021 License: LGPL-3.0 Imports: 4 Imported by: 0

README

Go Tracer WiFi

A Go package to communicate with an EPSolar Tracer A/AN charge controller equipped with the eBox-Wifi-01

Only tested with EPSolar Tracer3210AN equipped with the eBox-Wifi-01

Example

package main

import (
	"encoding/json"
	"github.com/pterm/pterm"
	"github.com/Gaz492/gotracerwifi"
	"time"
)

func main()  {
	tracer, err := goTracerWiFi.Status("192.168.1.181", "8088", 5 * time.Second)
	if err != nil {
		pterm.Fatal.Println(err)
	}

	response, err := json.Marshal(tracer)
	if err != nil {
		pterm.Error.Println(err)
		return
	}
	pterm.Info.Println(string(response))
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Battery

type Battery struct {
	Voltage       float32 `json:"voltage"`
	Current       float32 `json:"current"`
	MaxVoltage    float32 `json:"max_voltage"`
	MinVoltage    float32 `json:"min_voltage"`
	Temp          float32 `json:"temp"`
	BatteryStatus string  `json:"battery_status"`
	ChargeStatus  string  `json:"charge_status"`
}

type Consumed

type Consumed struct {
	Day    float32 `json:"day"`
	Month  float32 `json:"month"`
	Annual float32 `json:"annual"`
	Total  float32 `json:"total"`
}

type Energy

type Energy struct {
	Generated Generated `json:"generated"`
	Consumed  Consumed  `json:"consumed"`
}

type Generated

type Generated struct {
	Day    float32 `json:"day"`
	Month  float32 `json:"month"`
	Annual float32 `json:"annual"`
	Total  float32 `json:"total"`
}

type Load

type Load struct {
	Voltage float32 `json:"voltage"`
	Current float32 `json:"current"`
	Power   float32 `json:"power"`
	Status  string  `json:"status"`
}

type Response

type Response struct {
	Solar     Solar     `json:"solar"`
	Battery   Battery   `json:"battery"`
	Load      Load      `json:"load"`
	Stats     Stats     `json:"stats"`
	Timestamp time.Time `json:"timestamp"`
}

func Status

func Status(ip string, port string, timeout time.Duration) (r Response, err error)

type Solar

type Solar struct {
	Voltage float32 `json:"voltage"`
	Current float32 `json:"current"`
	Power   float32 `json:"power"`
}

type Stats

type Stats struct {
	Energy Energy `json:"energy"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL