home_assistant-ble 1.1.0.pre.alpha.pre.19 → 1.1.0.pre.alpha.pre.20
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +3 -0
- data/README.md +7 -7
- data/example_config.yml +2 -1
- data/home_assistant-ble.service +1 -0
- data/lib/home_assistant/ble.rb +11 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 567820a2750982cf752c4563b8bdaa51480e2519
|
4
|
+
data.tar.gz: a1b64acff4bae209d87e3cc4f582e6c92880e138
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0ab5c0f51ff8a307ac57bb592a90b8fea61ef8bd3e43e02ad19afe893eac1cdea1841aa2de055b167ea763b281dadce1098d1ad21ede0f2c31de37c95e58529a
|
7
|
+
data.tar.gz: 8fd24882f68393a0ed73e0b4317700daf1a70d6a2f5763a1f2bc7bbc758d836fd32284c0d314fad2d439fc6fe4bb8b9aa88f82c9f559ee3307de71264a998f15
|
data/.rubocop.yml
CHANGED
data/README.md
CHANGED
@@ -35,12 +35,12 @@ sudo setcap 'cap_net_raw,cap_net_admin+eip' `readlink -f \`which ruby\``
|
|
35
35
|
### Configuration
|
36
36
|
|
37
37
|
```
|
38
|
-
interval: 30 # in seconds, interval between device scan
|
39
|
-
grace_period: 60 # in seconds, delay before considering a device has disappeared
|
40
|
-
home_assistant_url: http://localhost:8123 # url to contact home-assistant
|
41
|
-
home_assistant_password: xxxxx # non mandatory password to authenticate to home-assistant api
|
42
|
-
home_assistant_devices: # devices whose activity will be sent to home-assistant.
|
38
|
+
interval: 30 # in seconds, interval between device scan. Defaults to 30
|
39
|
+
grace_period: 60 # in seconds, delay before considering a device has disappeared. Defaults to 60
|
40
|
+
home_assistant_url: http://localhost:8123 # url to contact home-assistant. Defaults to http://localhost:8123
|
41
|
+
home_assistant_password: xxxxx # non mandatory password to authenticate to home-assistant api. Default is nil
|
42
|
+
home_assistant_devices: # devices whose activity will be sent to home-assistant. Default is empty (no tracked devices)
|
43
43
|
F0:5C:F4:EA:BF:C8: nut1 # [macaddress]: [identifier for home-assistant]
|
44
|
-
```
|
45
44
|
|
46
|
-
|
45
|
+
home_assistant_devices_file: /var/lib/hass/known_devices.yaml # read devices whose activity will be sent to home-assistant. Default is empty (devices from home-assistant are not tracked). This can easily replace home_assistant_devices setting.
|
46
|
+
```
|
data/example_config.yml
CHANGED
data/home_assistant-ble.service
CHANGED
data/lib/home_assistant/ble.rb
CHANGED
@@ -35,8 +35,17 @@ module HomeAssistant
|
|
35
35
|
end
|
36
36
|
|
37
37
|
def home_assistant_devices
|
38
|
-
|
39
|
-
config['
|
38
|
+
devices = {}
|
39
|
+
if config['home_assistant_devices_file']
|
40
|
+
YAML.load_file(config['home_assistant_devices_file']).each do |name, conf|
|
41
|
+
next unless conf['mac'] =~ /^(ble_|bt_)/i
|
42
|
+
next unless conf['track']
|
43
|
+
mac = conf['mac'].gsub(/^(ble_|bt_)/i, '').upcase
|
44
|
+
devices[mac] = name
|
45
|
+
debug "Adding #{mac} (#{name}) found in known_devices.yaml"
|
46
|
+
end
|
47
|
+
end
|
48
|
+
devices.merge!(config['home_assistant_devices']) if config['home_assistant_devices']
|
40
49
|
end
|
41
50
|
|
42
51
|
def run
|