Go package for interacting with the "ELK" Bluetooth Low Energy RGB LED Controller

Go interactions for the ELK-BLEDOM RGB LED Controller

This repository contains information on the common (and cheap) ELK-BLEDOM Bluetooth Low Energy RGB LED controller, as well as a Go package for interacting with it.

Bluetooth interactions have been reverse engineered from the Android app. See PROTOCOL.md for more information on both the hardware and how it can be controlled.

Example

func main() {
	ctx, cancel := context.WithCancel(context.Background())
	d := device.NewBleDomRGBController(ctx, device.Options{})

	if err := d.Connect(time.Duration(time.Minute)); err != nil {
		panic(err)
	}

	gracefulTermination(cancel, d)

	// Don't terminate until device has been cleanly shutdown
	defer func() {
		fmt.Println("waiting for device disconnection")
		d.Done()
		fmt.Println("device disconnected: terminating app")
	}()

	// Configure state polling; retrieve state every 30 seconds and log
	// it to stdout.
	d.PollState(time.Duration(30)*time.Second, func(state []byte) {
		fmt.Println("recieved latest state from device", state)
	})

	fmt.Println("setting brightness to maximum")
	d.WriteCommand(device.BrightnessCommandFromValue(96)) // 96%

	i := 1
	t := time.NewTimer(time.Second)
	for {
		select {
		case <-ctx.Done():
			fmt.Println("context cancelled: stopping commands")
			t.Stop()
			return
		case <-t.C:
			cmd := commands[i%len(commands)]
			fmt.Println("changing colour: ", cmd.Red, cmd.Green, cmd.Blue)
			d.WriteCommand(cmd)

			i = i + 1
			t.Reset(time.Second)
		}
	}
}

See colours.go.

Owner
Fergus
Software and DevOps Engineer. Interested in Infosec. Tinkers a lot in his garage. Enjoys Electronics. Usually writing Go or C. Learning Erlang.
Fergus
Similar Resources

Pulumi-hcp - A Pulumi provider for interacting with the Hashicorp Cloud Platform

Terraform Bridge Provider Boilerplate This repository contains boilerplate code

Dec 5, 2022

Annotated and kubez-autoscaler-controller will maintain the HPA automatically for kubernetes resources.

Kubez-autoscaler Overview kubez-autoscaler 通过为 deployment / statefulset 添加 annotations 的方式,自动维护对应 HorizontalPodAutoscaler 的生命周期. Prerequisites 在 kuber

Jan 2, 2023

network-node-manager is a kubernetes controller that controls the network configuration of a node to resolve network issues of kubernetes.

network-node-manager is a kubernetes controller that controls the network configuration of a node to resolve network issues of kubernetes.

Network Node Manager network-node-manager is a kubernetes controller that controls the network configuration of a node to resolve network issues of ku

Dec 18, 2022

A controller to create K8s Ingresses for Openshift routes.

route-to-ingress-operator A controller to create corresponding ingress.networking.k8s.io/v1 resources for route.openshift.io/v1 TODO int port string p

Jan 7, 2022

A Kubernetes Terraform Controller

A Kubernetes Terraform Controller

Terraform Controller Terraform Controller is a Kubernetes Controller for Terraform, which can address the requirement of Using Terraform HCL as IaC mo

Jan 2, 2023

Carrier is a Kubernetes controller for running and scaling game servers on Kubernetes.

Carrier is a Kubernetes controller for running and scaling game servers on Kubernetes.

Carrier is a Kubernetes controller for running and scaling game servers on Kubernetes. This project is inspired by agones. Introduction Genera

Nov 25, 2022

A fluxcd controller for managing remote manifests with kubecfg

kubecfg-operator A fluxcd controller for managing remote manifests with kubecfg This project is in very early stages proof-of-concept. Only latest ima

Nov 1, 2022

Write controller-runtime based k8s controllers that read/write to git, not k8s

Git Backed Controller The basic idea is to write a k8s controller that runs against git and not k8s apiserver. So the controller is reading and writin

Dec 10, 2021

The k8s-generic-webhook is a library to simplify the implementation of webhooks for arbitrary customer resources (CR) in the operator-sdk or controller-runtime.

k8s-generic-webhook The k8s-generic-webhook is a library to simplify the implementation of webhooks for arbitrary customer resources (CR) in the opera

Nov 24, 2022
EdgeLog Lightweight ELK
EdgeLog Lightweight ELK

EdgeLog is a lightweight log management system, which is based on DevOps idea and is totally developed by ourselves.

Nov 6, 2022
Package bright-golang is a client for the Bright App energy monitoring API.

Go client library for the Bright API Package bright-golang is a client for the Bright App energy monitoring API. Not all the API endpoints are impleme

Jan 5, 2022
Image clone controller is a kubernetes controller to safe guard against the risk of container images disappearing

Image clone controller image clone controller is a kubernetes controller to safe guard against the risk of container images disappearing from public r

Oct 10, 2021
A Controller written in kubernetes sample-controller style which watches a custom resource named Bookstore

bookstore-sample-controller A Controller written in kubernetes sample-controller style which watches a custom resource named Bookstore. A resource cre

Jan 20, 2022
Kepler (Kubernetes-based Efficient Power Level Exporter) uses eBPF to probe energy related system stats and exports as Prometheus metrics
Kepler (Kubernetes-based Efficient Power Level Exporter) uses eBPF to probe energy related system stats and exports as Prometheus metrics

kepler Kepler (Kubernetes Efficient Power Level Exporter) uses eBPF to probe energy related system stats and exports as Prometheus metrics Architectur

Dec 26, 2022
A golang CTF competition platform with high-performance, security and low hardware requirements.
A golang CTF competition platform with high-performance, security and low hardware requirements.

CTFgo - CTF Platform written in Golang A golang CTF competition platform with high-performance, security and low hardware requirements. Live Demo • Di

Oct 20, 2022
Provide task runtime implementation with pidfd and eBPF sched_process_exit tracepoint to manage deamonless container with low overhead.

embedshim The embedshim is the kind of task runtime implementation, which can be used as plugin in containerd. With current shim design, it is used to

Dec 18, 2022
Client extension for interacting with Kubernetes clusters from your k6 tests.

⚠️ This is a proof of concept As this is a proof of concept, it won't be supported by the k6 team. It may also break in the future as xk6 evolves. USE

Jan 2, 2023
A 'kubectl' plugin for interacting with Clusternet.

kubectl-clusternet A kubectl plugin for interacting with Clusternet. Installation Install With Krew kubectl-clusternet can be installed using Krew, pl

Aug 14, 2022
Go module for interacting with public ECR repositories

go-publicecr go-publicecr is a module for listing ECR image tags on a public ECR repository. Why go-publicecr The official Go SDK does not support int

Nov 24, 2021