Skip to content
/ mh Public

The Go library to control the Magic Home LED strip light controller.

Notifications You must be signed in to change notification settings

gradddev/mh

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mh

mh is a library written in Go (Golang) for controlling Magic Home LED Strip Controller.

Installation

To install mh package, you need to install Go and set your Go workspace first.

The first need Go installed (version 1.15+ is required), then you can use the below Go command to install mh.

$ go get -u github.com/gradddev/mh

Quick Start

package main

import (
	"log"
	"net"
	"os"
	"time"

	"github.com/gradddev/mh"
)

func main() {
	ip := net.ParseIP(os.Getenv("DEVICE_IP"))
	timeout := 3 * time.Second
	controller := mh.NewController(mh.Config{
		IP:      ip,
		Timeout: timeout,
	})
	rgbw, err := controller.GetRGBW()
	if err != nil {
		log.Panicln(err)
	} else {
		log.Println(rgbw)
	}
}

See mh_test.go for various usage examples.

About

The Go library to control the Magic Home LED strip light controller.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages