https://github.com/graddotdev/mh
The Go library to control the Magic Home LED strip light controller.
https://github.com/graddotdev/mh
go golang magic-home magic-home-control magichome
Last synced: about 2 months ago
JSON representation
The Go library to control the Magic Home LED strip light controller.
- Host: GitHub
- URL: https://github.com/graddotdev/mh
- Owner: graddotdev
- Created: 2020-12-12T17:42:11.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-11-20T10:45:03.000Z (over 1 year ago)
- Last Synced: 2025-04-11T20:19:04.542Z (about 2 months ago)
- Topics: go, golang, magic-home, magic-home-control, magichome
- Language: Go
- Homepage:
- Size: 8.79 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 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](https://golang.org/) installed (**version 1.15+ is required**), then you can use the below Go command to install `mh`.
```sh
$ go get -u github.com/gradddev/mh
```
## Quick Start```go
package mainimport (
"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.