hueshift 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/bin/hueshift +11 -0
- data/lib/hueshift/version.rb +1 -1
- data/lib/hueshift.rb +9 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e353ba79ceb8ac15f1773fef16e652f5fd9c2649
|
4
|
+
data.tar.gz: a5dc920ce5bc3be04cd1f9b1557522bea25da95c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 095741fc85c30ad2e5b5c0776a7bcdbb1bf6dc019212d4baedeba7ab48ef023b867914b88647fe81e2e97e3f961a354465c93760c17636dec6195aff2aa61aa8
|
7
|
+
data.tar.gz: 897d167eabd791ef2a72ca404eed5221f30833b238a538e967550be5ef32b1646a47b8ad4412e95a940ad4e462a83bfa403e0a9b0c213b250f3e141e9e6af282
|
data/.gitignore
CHANGED
data/bin/hueshift
CHANGED
@@ -5,7 +5,18 @@ require "slop"
|
|
5
5
|
|
6
6
|
include Hueshift
|
7
7
|
|
8
|
+
|
8
9
|
opts = Slop.parse do |o|
|
10
|
+
o.on "-s", "--server", "continually update color temperature" do
|
11
|
+
puts "Running in server mode. Press ctrl-C to stop."
|
12
|
+
|
13
|
+
trap "SIGINT" do
|
14
|
+
puts "Stopping..."
|
15
|
+
exit
|
16
|
+
end
|
17
|
+
|
18
|
+
redshift_server
|
19
|
+
end
|
9
20
|
o.on "-v", "--version", "print the version" do
|
10
21
|
puts Hueshift::VERSION
|
11
22
|
exit
|
data/lib/hueshift/version.rb
CHANGED
data/lib/hueshift.rb
CHANGED
@@ -2,7 +2,7 @@ require_relative "hueshift/version"
|
|
2
2
|
require "hue"
|
3
3
|
|
4
4
|
class Numeric
|
5
|
-
def scale(from
|
5
|
+
def scale(from: 0, to: 0)
|
6
6
|
from_min = from.first
|
7
7
|
from_max = from.last
|
8
8
|
to_min = to.first
|
@@ -23,7 +23,7 @@ module Hueshift
|
|
23
23
|
|
24
24
|
lights = client.lights
|
25
25
|
lights.each do |light|
|
26
|
-
next unless light.on?
|
26
|
+
next unless light.on? # Only adjust lights that are already on
|
27
27
|
|
28
28
|
transition_time = 10 * 10 # Transition times are in 1/10 second
|
29
29
|
state = { color_temperature: redshift_temperature }
|
@@ -31,6 +31,13 @@ module Hueshift
|
|
31
31
|
end
|
32
32
|
end
|
33
33
|
|
34
|
+
def redshift_server(sleepytime: 30)
|
35
|
+
loop do
|
36
|
+
redshift
|
37
|
+
sleep sleepytime
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
34
41
|
def redshift_temperature
|
35
42
|
check_redshift!
|
36
43
|
output = `redshift -l #{LAT}:#{LON} -t #{DAY_TEMP}:#{NIGHT_TEMP} -p`
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hueshift
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Justin Toniazzo
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-10-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|