loxhill / go-vee Goto Github PK
View Code? Open in Web Editor NEWAn unofficial Go wrapper for the Govee API.
License: Other
An unofficial Go wrapper for the Govee API.
License: Other
I noticed the documentation doesn't have any example of a State Request. Browsing through the code I noticed there was a structure for state requests. I think it would be nice to have a couple of methods for State() such as GetPoweredState() and IsConnected(). I managed to get the information this way:
stateRequest := c.Client.Device(c.Address, c.Model).State()
// {Code:200 Message:Success Data:{Device:..... Model:H5083 Properties:[map[online:true] map[powerState:off]] Devices:[]}}
rsp, err := c.Client.Run(stateRequest) // govee.GoveeResponse
if rsp.Code != 200 {
err = fmt.Errorf("State request failed: %q", rsp.Message)
} else {
fmt.Println("\tMAC :", rsp.Data.Device)
fmt.Println("\tModel :", rsp.Data.Model)
fmt.Println("\tOnline :", rsp.Data.Properties[0]["online"])
fmt.Println("\tPowered:", rsp.Data.Properties[1]["powerState"])
}
return err
But I am ot sure if that is the proper way, especially the use of Data. Devices[]
. I only have ONE Govee device so not much I can experiment with.
Other than that I am pretty satisfied, thanks for sharing this useful library. I know there are others but I tried this one and liked it, so it is the one I am using in my pet home project.
Any way of interacting with the Govee Thermometer & Hygrometers?
So far, I've implemented the Lights, Plugs and Switches endpoints.
I'd like to include the Appliance endpoints, but I don't have a Govee appliance. Would someone be willing to contribute this? Currently, the only device I can see these endpoints would apply to is the Govee Smart Tower Fan.
Docs: https://govee-public.s3.amazonaws.com/developer-docs/GoveeDeveloperAPIReference.pdf
Given a known MAC address and a device model for a light fixture, I perform client.ListDevices()
and every Device
object is fully initialized.
However, if I call client.Device(address, model)
the returned Device
instance is only partly initialized. In that case the Device
and is empty and both Controllable
and Retrievable
are false whereas Address
, Model
etc. are properly returned. For that device Controllable
& Retrievable
are true when using ListDevices()
.
Now the foundation is in place, we need some tests. Let's try and aim for 80% test coverage.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.