home_assistant-ble 1.4.0.pre.alpha.pre.44 → 1.4.0.pre.alpha.pre.48

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: dac99efc77b9277dd24d04358f95666bc0175d07
4
- data.tar.gz: 14027f12248c9a5cbac9831ebdf0aeaf52940a3a
3
+ metadata.gz: e70a505266edab18f2a422f4427c9838e07913eb
4
+ data.tar.gz: dde03a39be711f158c0cfae7fbd970f99e7ba7b0
5
5
  SHA512:
6
- metadata.gz: 938e8dca97845776800d8b9705bb92ec0225985cb36a8bf728ab92d4b817985d6264b4cc9f193ecc4e263019a9a419d70b3f039d3c00b2a88e647575545e3095
7
- data.tar.gz: 539c82f629532879ee628bf70f0d5a23f3e6d8f1042aeb664cd85f44f1d4d21cc37b4523560f9552fd63b99df2f2b05c5beff4e1a26d53d51bb1555e01129197
6
+ metadata.gz: 352414b6e5899233cd254f8de3d295d55eba44815c710bd38ac125e7157efc42e716ec814c04dd0adb9e523e6abccc74242e9c096d9db00c84ada8dbeba3ce84
7
+ data.tar.gz: 61a644bd7d1301b550a39b71eb21285cacfb104632faeea154bc7a278d51c3aa2f79707942c29cfffea9ac76c1001f08845d71e207542c54c4454fc34245d37b
@@ -9,6 +9,21 @@ require 'yaml'
9
9
  $stdout.sync = true
10
10
  $stderr.sync = true
11
11
 
12
+ def shut_down
13
+ @detector.clean_all_devices
14
+ $stdout.puts 'Quitting'
15
+ end
16
+
17
+ Signal.trap('INT') do
18
+ shut_down
19
+ exit
20
+ end
21
+
22
+ Signal.trap('TERM') do
23
+ shut_down
24
+ exit
25
+ end
26
+
12
27
  config_file = ARGV.shift
13
28
  config = {}
14
29
  if config_file
@@ -17,6 +32,6 @@ else
17
32
  $stderr.puts 'No configuration file specified, will use all default values'
18
33
  end
19
34
 
20
- detector = HomeAssistant::Ble::Detector.new(config)
35
+ @detector = HomeAssistant::Ble::Detector.new(config)
21
36
 
22
- detector.run
37
+ @detector.run
@@ -71,6 +71,14 @@ module HomeAssistant
71
71
  end
72
72
  end
73
73
 
74
+ def clean_all_devices
75
+ known_devices.keys.each do |name|
76
+ known_devices.delete(name).tap do
77
+ home_assistant_devices[name] && update_home_assistant(home_assistant_devices[name], :not_home)
78
+ end
79
+ end
80
+ end
81
+
74
82
  private
75
83
 
76
84
  def log(message)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: home_assistant-ble
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.0.pre.alpha.pre.44
4
+ version: 1.4.0.pre.alpha.pre.48
5
5
  platform: ruby
6
6
  authors:
7
7
  - Grégoire Seux
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-04-18 00:00:00.000000000 Z
11
+ date: 2017-04-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler