greenbank

package module
v0.0.0-...-762a11b Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2021 License: Apache-2.0 Imports: 4 Imported by: 0

README

This is an Wi-Fi gateway for GreenBank G-Switch.

When it begins running, it will start an http server and listen on port 2304 by default, then scan the switches around.

Visit http://{{ip}}:2304/status and you will get a switch list like this:

{"24:71:89:0a:31:95":{"mac_address":"2471890a3195","light1":true,"light2":false,"light3":false,"pair_flag":false,"product_type":0,"DialAddress":"24:71:89:0a:31:95"}}

You can control your light by a command like this:

http://192.168.1.191:2304/control?light2=0&mac_address=2471890a3195

Documentation

Index

Constants

View Source
const (
	ServiceUUID        = "f000aa6404514000b000000000000000"
	CharacteristicUUID = "f000aa6604514000b000000000000000"

	Light1 = 0
	Light2 = 1
	Light3 = 2

	WriteValueLight1ON  = 0x51
	WriteValueLight1OFF = 0x90
	WriteValueLight2ON  = 0x13
	WriteValueLight2OFF = 0x52
	WriteValueLight3ON  = 0x15
	WriteValueLight3OFF = 0x54
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Device

type Device struct {
	Mac         string      `json:"mac_address"`
	Light1      bool        `json:"light1"`
	Light2      bool        `json:"light2"`
	Light3      bool        `json:"light3"`
	PairFlag    bool        `json:"pair_flag"`
	ProductType ProductType `json:"product_type"`
}

func NewDeviceByAdvertisementData

func NewDeviceByAdvertisementData(data []byte) (*Device, error)

func (*Device) SetLight

func (d *Device) SetLight(dialAddress string, lightNumber int, status bool) error

type ProductType

type ProductType uint8
const (
	ProductTypeTouch1   ProductType = 0
	ProductTypeTouch2   ProductType = 1
	ProductTypeTouch3   ProductType = 2
	ProductTypeRollCtrl ProductType = 3
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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