Coder Social home page Coder Social logo

keylightctl's Introduction

keylightctl

A command line tool for controlling Elgato Key Lights and Key Light Airs.

A library for interacting with the lights yourself is available at endocrimes/keylight-go.

Example

[keylightctl(master)] $ ./bin/keylightctl describe --all
+---+--------------------------+-------------+------------+-------------+
| # | NAME                     | POWER STATE | BRIGHTNESS | TEMPERATURE |
+---+--------------------------+-------------+------------+-------------+
| 0 | Elgato\ Key\ Light\ 861A | on          |         50 |         295 |
+---+--------------------------+-------------+------------+-------------+
[keylightctl(master)] $ ./bin/keylightctl switch --light 861A off               
[keylightctl(master)] $ ./bin/keylightctl describe --all         
+---+--------------------------+-------------+------------+-------------+
| # | NAME                     | POWER STATE | BRIGHTNESS | TEMPERATURE |
+---+--------------------------+-------------+------------+-------------+
| 0 | Elgato\ Key\ Light\ 861A | off         |         50 |         295 |
+---+--------------------------+-------------+------------+-------------+
[keylightctl(master)] $ ./bin/keylightctl switch --light 861A --brightness 25 on
[keylightctl(master)] $ ./bin/keylightctl describe --all                        
==> Found no matching lights during discovery
[keylightctl(master)] $ ./bin/keylightctl describe --all
+---+--------------------------+-------------+------------+-------------+
| # | NAME                     | POWER STATE | BRIGHTNESS | TEMPERATURE |
+---+--------------------------+-------------+------------+-------------+
| 0 | Elgato\ Key\ Light\ 861A | on          |         25 |         295 |
+---+--------------------------+-------------+------------+-------------+
[keylightctl(master)] $ 

keylightctl's People

Contributors

caxica avatar endocrimes avatar pbdeuchler avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

keylightctl's Issues

network issue talking to lights (after discovery)

I can discover my light via discovery, but I'm not quite sure what's going on when actually trying to manipulate:

vladimir@clownshoes:~/Downloads$ keylightctl discover
  Starting discovery
  - Elgato\ Key\ Light\ Air\ 9240
  Found 1 light(s) during discovery

vladimir@clownshoes:~/Downloads$ keylightctl describe --all
==> Failed to fetch light options (Elgato\ Key\ Light\ Air\ 9240), err: Get "http://elgato-key-light-air-9240.local.:9123/elgato/lights": dial tcp: lookup elgato-key-light-air-9240.local. on 127.0.0.53:53: no such host

vladimir@clownshoes:~/Downloads$ keylightctl switch -light 9240 on
==> Failed to fetch light options (Elgato\ Key\ Light\ Air\ 9240), err: Get "http://elgato-key-light-air-9240.local.:9123/elgato/lights": dial tcp: lookup elgato-key-light-air-9240.local. on 127.0.0.53:53: no such host

Note that I can ping elgato-key-light-air-9240.local. without problems from the machine (with IP 192.168.50.52); I can also open the URL given by the error and get a json doc in my browser.

(Thanks for building this!)

Please add troubleshooting instructions

Hello and thanks for the great project! As a Linux user, I am really happy to not have to rely on the Android app to control my key light.

There were some things I needed to figure out to make keylightctl work, and it would be if some troubleshooting notes could be added to the README. Here's a summary of my notes:

  1. If keylightctl discover does not find your devices, you need to make sure that your firewall allows mdns. For firewalld, use sudo firewall-cmd --list-all and check that 'mdns' is included in the 'services' listing. If not, add it with sudo firewall-cmd --add-service mdns
  2. If your devices are added but describe and switch fail with errors such as dial tcp: lookup elgato-key-light-XXXX.local.: no such host, then your resolver may not support mDNS. If using systemd-resolve, you need to manually configure global mDNS resolution and and per-interface mDNS resolution, see for instance https://unix.stackexchange.com/questions/459991/how-to-configure-systemd-resolved-for-mdns-multicast-dns-on-local-network .

Build fails on CentOS 8.3

Description

The README doesn't describe how to build the project or indicate what platforms it was built or tested on. I saw there was a GNUmakefile so I tried running make build but it fails on CentOS 8.3.2011. I saw there was a binary release file so I tried using that and it failed to run as well.

Steps to reproduce build failure

$ git clone [email protected]:endocrimes/keylightctl.git
Cloning into 'keylightctl'...
Warning: Permanently added the RSA host key for IP address '192.30.255.112' to the list of known hosts.
remote: Enumerating objects: 1288, done.
remote: Counting objects: 100% (1288/1288), done.
remote: Compressing objects: 100% (811/811), done.
remote: Total 1288 (delta 532), reused 1191 (delta 436), pack-reused 0
Receiving objects: 100% (1288/1288), 1.82 MiB | 7.78 MiB/s, done.
Resolving deltas: 100% (532/532), done.

$ cd keylightctl

$ make build
==> Fixing source files with gofmt...
==> Removing old development build
==> Building dist/linux_amd64/keylightctl...
vendor/golang.org/x/crypto/ed25519/ed25519_go113.go:22:2: cannot find package "." in:
        /home/cvoltz/projects/keylightctl/vendor/crypto/ed25519
../../go/src/crypto/tls/cipher_suites.go:18:2: cannot find package "." in:
        /home/cvoltz/projects/keylightctl/vendor/golang_org/x/crypto/chacha20poly1305
../../go/src/crypto/tls/key_agreement.go:20:2: cannot find package "." in:
        /home/cvoltz/projects/keylightctl/vendor/golang_org/x/crypto/curve25519
../../go/src/net/http/h2_bundle.go:46:2: cannot find package "." in:
        /home/cvoltz/projects/keylightctl/vendor/golang_org/x/net/http2/hpack
../../go/src/net/http/h2_bundle.go:47:2: cannot find package "." in:
        /home/cvoltz/projects/keylightctl/vendor/golang_org/x/net/idna
../../go/src/net/http/h2_bundle.go:48:2: cannot find package "." in:
        /home/cvoltz/projects/keylightctl/vendor/golang_org/x/net/lex/httplex
../../go/src/net/http/request.go:30:2: cannot find package "." in:
        /home/cvoltz/projects/keylightctl/vendor/golang_org/x/text/unicode/norm
../../go/src/net/http/request.go:31:2: cannot find package "." in:
        /home/cvoltz/projects/keylightctl/vendor/golang_org/x/text/width
vendor/golang.org/x/sys/unix/affinity_linux.go:10:2: cannot find package "." in:
        /home/cvoltz/projects/keylightctl/vendor/math/bits
make[1]: *** [GNUmakefile:36: dist/linux_amd64/keylightctl] Error 1
make: *** [GNUmakefile:54: build] Error 2

I did try running go get but that didn't resolve the problem:

$ go get
go: downloading golang.org/x/crypto v0.0.0-20200427165652-729f1e841bcc
go: downloading github.com/mattn/go-colorable v0.1.4
go: downloading github.com/mitchellh/cli v1.1.1
go: downloading github.com/endocrimes/keylight-go v0.0.0-20200428145519-32eb29fbd1d4
go: downloading github.com/posener/complete v1.1.1
go: downloading github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db
go: downloading github.com/jedib0t/go-pretty v4.3.0+incompatible
go: downloading github.com/mattn/go-isatty v0.0.11
go: downloading github.com/fatih/color v1.9.0
go: downloading github.com/bgentry/speakeasy v0.1.0
go: downloading github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310
go: downloading github.com/oleksandr/bonjour v0.0.0-20160508152359-5dcf00d8b228
go: downloading golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd
go: downloading github.com/hashicorp/go-multierror v1.0.0
go: downloading github.com/go-openapi/strfmt v0.19.5
go: downloading golang.org/x/net v0.0.0-20200425230154-ff2c4b7c35a0
go: downloading github.com/mattn/go-runewidth v0.0.9
go: downloading github.com/hashicorp/errwrap v1.0.0
go: downloading github.com/miekg/dns v1.1.29
go: downloading github.com/go-openapi/errors v0.19.2
go: downloading go.mongodb.org/mongo-driver v1.0.3
go: downloading github.com/mitchellh/mapstructure v1.1.2
go: downloading github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a
go: downloading github.com/go-stack/stack v1.8.0
../../Dropbox/projects/pkg/mod/golang.org/x/[email protected]/ed25519/ed25519_go113.go:22:2: package crypto/ed25519 is not in GOROOT (/home/cvoltz/go/src/crypto/ed25519)
../../go/src/crypto/tls/cipher_suites.go:18:2: package golang_org/x/crypto/chacha20poly1305 is not in GOROOT (/home/cvoltz/go/src/golang_org/x/crypto/chacha20poly1305)
../../go/src/crypto/tls/key_agreement.go:20:2: package golang_org/x/crypto/curve25519 is not in GOROOT (/home/cvoltz/go/src/golang_org/x/crypto/curve25519)
../../go/src/net/http/h2_bundle.go:46:2: package golang_org/x/net/http2/hpack is not in GOROOT (/home/cvoltz/go/src/golang_org/x/net/http2/hpack)
../../go/src/net/http/h2_bundle.go:47:2: package golang_org/x/net/idna is not in GOROOT (/home/cvoltz/go/src/golang_org/x/net/idna)
../../go/src/net/http/h2_bundle.go:48:2: package golang_org/x/net/lex/httplex is not in GOROOT (/home/cvoltz/go/src/golang_org/x/net/lex/httplex)
../../go/src/net/http/request.go:30:2: package golang_org/x/text/unicode/norm is not in GOROOT (/home/cvoltz/go/src/golang_org/x/text/unicode/norm)
../../go/src/net/http/request.go:31:2: package golang_org/x/text/width is not in GOROOT (/home/cvoltz/go/src/golang_org/x/text/width)
../../Dropbox/projects/pkg/mod/golang.org/x/[email protected]/unix/affinity_linux.go:10:2: package math/bits is not in GOROOT (/home/cvoltz/go/src/math/bits)

Steps to reproduce run failure

$ wget https://github.com/endocrimes/keylightctl/releases/download/0.0.3/keylightctl_0.0.3_Linux_x86_64.tar.gz
--2021-01-27 08:51:45--  https://github.com/endocrimes/keylightctl/releases/download/0.0.3/keylightctl_0.0.3_Linux_x86_64.tar.gz
Resolving github.com (github.com)... 140.82.113.4
Connecting to github.com (github.com)|140.82.113.4|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://github-production-release-asset-2e65be.s3.amazonaws.com/259867071/26a64a00-4ea3-11eb-8c4f-d7f0565e7b15?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20210127%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20210127T145146Z&X-Amz-Expires=300&X-Amz-Signature=c5363a11a6d89c6f0ad72d092d94585afbd22b6a1495bb5ef6b255e2b7e8d4d5&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=259867071&response-content-disposition=attachment%3B%20filename%3Dkeylightctl_0.0.3_Linux_x86_64.tar.gz&response-content-type=application%2Foctet-stream [following]
--2021-01-27 08:51:46--  https://github-production-release-asset-2e65be.s3.amazonaws.com/259867071/26a64a00-4ea3-11eb-8c4f-d7f0565e7b15?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20210127%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20210127T145146Z&X-Amz-Expires=300&X-Amz-Signature=c5363a11a6d89c6f0ad72d092d94585afbd22b6a1495bb5ef6b255e2b7e8d4d5&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=259867071&response-content-disposition=attachment%3B%20filename%3Dkeylightctl_0.0.3_Linux_x86_64.tar.gz&response-content-type=application%2Foctet-stream
Resolving github-production-release-asset-2e65be.s3.amazonaws.com (github-production-release-asset-2e65be.s3.amazonaws.com)... 52.216.244.76
Connecting to github-production-release-asset-2e65be.s3.amazonaws.com (github-production-release-asset-2e65be.s3.amazonaws.com)|52.216.244.76|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 3409133 (3.3M) [application/octet-stream]
Saving to: ‘keylightctl_0.0.3_Linux_x86_64.tar.gz’

keylightctl_0.0.3_Linux_x86_64.tar.gz                100%[=====================================================================================================================>]   3.25M  9.56MB/s    in 0.3s

2021-01-27 08:51:48 (9.56 MB/s) - ‘keylightctl_0.0.3_Linux_x86_64.tar.gz’ saved [3409133/3409133]

$ tar xvfz keylightctl_0.0.3_Linux_x86_64.tar.gz
LICENSE.md
README.md
keylightctl

$ ./keylightctl describe --all
-bash: ./keylightctl: No such file or directory

$ ls -l keylightctl
-rwxr-xr-x. 1 cvoltz cvoltz 8998912 Jan  4 08:40 keylightctl

Figure out testing

With some minor refactoring most parts of this could be tested pretty effectively.

Discovery is already an interface, and separating loading data from displaying it is generally a good idea.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.