Device_tracker do not works

I have a HOME ASSISTANT 0.60 and Hassio, I wish to activate the device_tracker function to check if people are at home or away.

in configuration.yaml I wrote…

device_tracker:
  - platform: nmap_tracker
    hosts: 192.168.1.30-32
    home_interval: 10
    interval_seconds: 5
    track_new_devices: no

It generated the know_devices.yaml file with the two phones connected to my wifi router

aabbccddeeffgg:
  hide_if_away: false
  icon:
  mac: AA:BB:CC:DD:EE:FF
  name: Samsung_S8
  picture:
  track: true
  vendor: SAMSUNG ELECTRO-MECHANICS(THAILAND)

gghhiijjkkll:
  hide_if_away: false
  icon:
  mac: GG:HH:II:JJ:KK:LL
  name: Huawei_P8
  picture:
  track: true
  vendor: HUAWEI COMMUNICATIONS

but … it show me that they are always “at home”
…even if I turn off the phones

Can anyone help me???

Not that it’s likely to affect your issue, but track_new_devices is not the correct option anymore.

Should be:

 new_device_defaults:
      track_new_devices: True
1 Like

this is for netgear and it can write in several ways…

for nmap…

New script… same result… always “at_home”

device_tracker:
  - platform: nmap_tracker
    hosts: 192.168.1.30-32
    home_interval: 10
    new_device_defaults:
      track_new_devices: True
      hide_if_away: False

just for curiosity…
you wrote that when you put your device offline it is detected as online.
in your configuration you wrote:

home_interval: 10

that means that for 10 minutes the device is considered at home.
did you wait more than 10 minutes before putting again your device online?

opps… I left the default value of the example… now I changed it to 1

My wife huawei is detected correctly… it is off nad show not_home
My Samsung S8 is always detected at home …but it is off

Now I restarted Home Assistant again… and it seem to works fine!

Many thanks andyinno for suggestions

you’re welcome.
Just keep in mind that lowering too much that value is prone to give false away states.
I configured it with an higher timeout (4 minutes) and paired it with bluetooth tracking.

something like:

device_wifi:
    mac: XX:XX:XX...

  device_bt:
    MAC: BT_XX:.....


group_person_A:
  - device_tracker.device_wifi
  - device_tracker.device_bt

this helps you because if wifi or bt are detected at home your “group” person is at home.

Good suggestion!
I have to insert these lines in configuration.yaml?
if I have 2 phones… will be:

device_wifi_1:
  - mac: AA:BB:CC:DD:EE:FF

device_wifi_2:
  - mac: GG:HH:II:JJ:KK:LL

device_bt_1: 
  - mac: BT_AA:BB:CC:DD:EE:FF

device_bt_2: 
  - mac: BT_GG:HH:II:JJ:KK:LL

group.person_A:
  - device_tracker.device.wifi_1
  - device_tracker.device.bt_1
  - device_tracker.device.wifi_2
  - device_tracker.device_bt2

Yes, something like that.
Keep in mind that what’s inside known_devices.yaml can be autogenerated.
I wrote my example by hand without checking my home assistant configuration.

the group part must be placed in group.yaml file if you are using it. Otherwise in configuration.yaml.
check here how to group entities together:

I did the configuration using devices found in know_devices.yaml

now confguration is…

device_tracker:
  - platform: nmap_tracker
    hosts: 192.168.1.30-32
    home_interval: 5
    interval_seconds: 10
    consider_home: 10
    new_device_defaults:
      track_new_devices: True
      hide_if_away: False
  - platform: bluetooth_tracker
    home_interval: 5
    interval_seconds: 10
    consider_home: 10
    new_device_defaults:
      track_new_devices: True
      hide_if_away: False

and in groups…

  presence:
    name: Presence
    entities:
      - device_tracker.samsung_s8_wifi
      - device_tracker.samsung_s8_bt
      - device_tracker.huawei_p8_wifi
      - device_tracker.huawei_p8_bt
      - device_tracker.xiaomi_redmi_wifi
      - device_tracker.xiaomi_redmi_bt

but… bluetooth state change continuosly (every 10 seconds) from Home to Away… it is not stable… even if they are within 1 meter of the raspberry …why???

my config is something like this:

device_tracker:
  - platform: nmap_tracker
    hosts:
      - 192.168.1.100-110
    track_new_devices: yes
    home_interval: 4
  - platform: bluetooth_tracker

I don’t see any unwanted state change on bluetooth also at ~15 meters from the pi.

The 10 seconds that you made on the bluetoot_tracker looks suspicious. I won’t scan too often. If you miss one scan you have false positives.
If you have wifi at 5 minutes, why scan bluetooth so often?
I would make both 5 minutes.

The idea behind this configuration is that if wifi or bluetooth fails, the other can report correctly.

the truth table for the group is always

ON ON => ON
ON OFF => ON
OFF ON => ON
OFF OFF => OFF

Instead of check for a device at home, you have to test if the group is at home or away.

I changed configuration…

device_tracker:
  - platform: nmap_tracker
    hosts: 192.168.1.30-32
    home_interval: 5
    consider_home: 10
    new_device_defaults:
      track_new_devices: True
      hide_if_away: False
  - platform: bluetooth_tracker

but continue to have false change of state many times for minute… look the video
https://drive.google.com/file/d/0B2KBYBGjrHlaa3ZSQjZKUENES1lrZ2tnZlVRN3drQnVNbnln/view?usp=sharing

can you explain me what are the diferences between :
home_interva
interval_seconds
consider_home:

The first time it toggle from Home to not home is at the same time for both bt and wifi. The second time only on wifi.
It does not happen with my configuration. I know that bt can be more unstable and depends on the phone type.

As said before: you are using the consider_home at 10 seconds. That’s your toggling trigger.
If you leave it out like the configuration that I wrote to you it won’t happen in my opinion.

Finally it seem to works fine!!!

device_tracker:
  - platform: nmap_tracker
    hosts: 192.168.1.30-32
    home_interval: 5
    new_device_defaults:
      track_new_devices: True
      hide_if_away: False
  - platform: bluetooth_tracker

It detect a phone disconnected from wifi after 5 minutes and when I re-connected it in about 15 seconds.

Thanks a lot andyinno!!!

Now I wish to create the code to arm alarm… conditioned to

  • “away” state of wifi and bt
  • “no presence” detected from my 4 Xiaomi Aqara Smart Human Body Sensor
  • and… ???
    any suggestion?

I have the exact setup that you are wanting to accomplish.
I am using this app posted by @runningman84 that I would like to thank.

At the moment it works without any modification. I would like to make a couple of changes and I didn’t check until now how to send the notification. I set it up yesterday.

I am quite happy with it for the moment and I would like to recommend it.

regards
Andrea

PS: from which part of Italy are you from?
PPS: I think that if you set up correctly the device tracker you should set as solved this post and open another one with a new title, new subject, new task…

I live in north-east Italy near Udine.

AlarmSystem is a interesting app. I opened a new thread about

I’m in a small town near Bergamo.

If you think this is solved, set the post with the correct solution as “correct answer” :wink: