lightwaverf 0.9.0 → 0.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. data/lib/lightwaverf.rb +8 -3
  2. metadata +2 -2
data/lib/lightwaverf.rb CHANGED
@@ -154,7 +154,10 @@ class LightWaveRF
154
154
  crontab << '@reboot ' + executable + ' ' + room['name'] + ' ' + device['name'] + ' ' + device['reboot'] + ' > ' + out_file + ' 2>&1'
155
155
  end
156
156
  end
157
-
157
+ File.open( '/tmp/cron.tab', 'w' ) do | handle |
158
+ handle.write crontab.join( "\n" ) + "\n"
159
+ end
160
+ puts `crontab /tmp/cron.tab`
158
161
  'Saved config file ' + file
159
162
  end
160
163
 
@@ -497,15 +500,17 @@ class LightWaveRF
497
500
  end
498
501
 
499
502
  def update_state room, device, state, debug
503
+ update = false;
500
504
  config = self.get_config
501
505
  config['room'].each do | r |
502
506
  next unless r['name'] == room
503
507
  r['device'].each do | d |
504
508
  next unless d['name'] == device
509
+ update = d['state'] != state
505
510
  d['state'] = state
506
511
  end
507
512
  end
508
- self.put_config config
513
+ self.put_config config if update
509
514
  end
510
515
 
511
516
  # A sequence of events
@@ -855,7 +860,7 @@ class LightWaveRF
855
860
  # fix this with something like
856
861
  # if self.get_state event['state'] ! starts with F
857
862
 
858
- if event['type'] == 'device' and event['state'].first != 'o'
863
+ if event['type'] == 'device' and event['state'] != 'on' and event['state'] != 'off'
859
864
  debug and ( p 'Duplicating ' + event['summary'] + ' with ' + ( event['state'] ? 'state ' + event['state'] : 'no state' ))
860
865
  event['state'] = 'on' if event['state'].nil?
861
866
  end_event = event.dup # duplicate event for start and end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lightwaverf
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 0.9.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2015-10-05 00:00:00.000000000 Z
14
+ date: 2015-10-07 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: htmlentities