2020/01/16

Using nmap to do presence-detection

Based on these two posts.
- https://www.home-assistant.io/integrations/nmap_tracker/
- https://www.home-assistant.io/integrations/person/

1. add these lines to configuration.yaml
device_tracker:
  - platform: nmap_tracker
    # global config
    interval_seconds: 15
    consider_home: 180
    new_device_defaults:
      track_new_devices: false
      hide_if_away: false
    # config for nmap_tracker
    hosts: # network address to scan
      - 192.168.1.1/24
    home_interval: 10 # if it is home, not scan this device at least 10 mins
    exclude: # not to scan this device
      - 192.168.1.1
2. restart hass.io
3. check known_devices.yaml in Configurator, this file will be auto generated.
original:
11_22_33_44_55_66:
  hide_if_away: false
  icon:
  mac: 11:22:33:44:55:66
  name: 11 22 33 44 55 66
  picture:
  track: false

22_22_33_44_55_66:
  hide_if_away: false
  icon:
  mac: 22:22:33:44:55:66
  name: 22 22 33 44 55 66
  picture:
  track: false

updated:
me:
  hide_if_away: false
  icon:
  mac: 11:22:33:44:55:66
  name: me
  picture:
  track: true

her:
  hide_if_away: false
  icon:
  mac: 22:22:33:44:55:66
  name: her
  picture:
  track: true
4. go Configuration -> Persons, Click on the account, and select Track Device, in this case, choose device_tracker.me
5. If someone doesn't have the account in hass.io, go to Configurator and edit configuration.yaml.
Add these lines and then restart hass.io
person:
  - name: Her
    id: her1224 # this must be unique.
    device_trackers:
      - device_tracker.her
6. go Configuration -> Persons to check if add successfully.

沒有留言:

張貼留言