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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 49673b0a9f605d5e0423a1a45702c96d59761a88
4
- data.tar.gz: 02a6eb335635fc24ba377e8dea90d044731e9e9c
3
+ metadata.gz: e353ba79ceb8ac15f1773fef16e652f5fd9c2649
4
+ data.tar.gz: a5dc920ce5bc3be04cd1f9b1557522bea25da95c
5
5
  SHA512:
6
- metadata.gz: 62aa7a794837509e8a25ed6a6536e24afdb750a129c7502ad878c1596422a829142e1ab770a3213e1d5d44d6402f1146908457eb8961bb4abeeda8a89f50758a
7
- data.tar.gz: 6171c889e1ee72e6e31013efddda2833bf73bbbfadbf62a418c2600c6d5890647d6c0eff9f016ec67ad3e3ebfb20db5927e746ca25a1ad4b4ba09f55227c1e65
6
+ metadata.gz: 095741fc85c30ad2e5b5c0776a7bcdbb1bf6dc019212d4baedeba7ab48ef023b867914b88647fe81e2e97e3f961a354465c93760c17636dec6195aff2aa61aa8
7
+ data.tar.gz: 897d167eabd791ef2a72ca404eed5221f30833b238a538e967550be5ef32b1646a47b8ad4412e95a940ad4e462a83bfa403e0a9b0c213b250f3e141e9e6af282
data/.gitignore CHANGED
@@ -7,3 +7,4 @@
7
7
  /pkg/
8
8
  /spec/reports/
9
9
  /tmp/
10
+ *.gem
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
@@ -1,3 +1,3 @@
1
1
  module Hueshift
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
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:, to:)
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.1.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-09-26 00:00:00.000000000 Z
11
+ date: 2015-10-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler