Core: device_tracker stays "home" in history and logbook

Created on 10 Jan 2018  路  17Comments  路  Source: home-assistant/core

Home Assistant release (hass --version):
0.60.0

Python release (python3 --version):
Python 3.5.3

Component/platform:
device_tracker/ history/ logbook

Description of problem:
device_tracker stays "home" in history and logbook if set to hide_if_away: true in known_devices.yaml. Device has correct state in States, shown as "not_home".

Other devices that are set to hide_if_away: false are being shown as "not_home"/ "away" in history and logbook as expected.

Expected:
Show as "not_home" / "away" in history and logbook when device is offline.

Problem-relevant configuration.yaml entries and steps to reproduce:

known_devices.yaml
samsung_ue60ku6000:
  hide_if_away: true
  track: true

###

raspberrypi:
  hide_if_away: false
  track: true

```yaml
configuration.yaml
recorder:
purge_interval: 2
purge_keep_days: 5

history:
include:
domains:
- sensor
- switch
- media_player
- light
- device_tracker
- climate
- sun

logbook:
include:
domains:
- automation
- sensor
- switch
- media_player
- light
- device_tracker

1. set hide_if_away: true in known_devices.yaml
2. 
3. 

**Traceback (if applicable):**
```bash

Additional info:
When device is set to hide:
image

An other device that is not set to hide:
image

device_tracker stale

Most helpful comment

I found out that this happens because HA doesn't record history for any entity that is hidden. When hide_if_away is defined, any device that changes to "not home" becomes a hidden entity, and as such events and state changes stop being recorded until the device gets "home" again.

Even though this is a case where recording hidden devices is particularly relevant, I think that the issue is a bit more general: we should be able to log and store history for every device, regardless of whether the device is hidden in the UI. I can think of several reasons why users may want to record history without clogging their dashboards with information that they do not need regularly.

All 17 comments

I found out that this happens because HA doesn't record history for any entity that is hidden. When hide_if_away is defined, any device that changes to "not home" becomes a hidden entity, and as such events and state changes stop being recorded until the device gets "home" again.

Even though this is a case where recording hidden devices is particularly relevant, I think that the issue is a bit more general: we should be able to log and store history for every device, regardless of whether the device is hidden in the UI. I can think of several reasons why users may want to record history without clogging their dashboards with information that they do not need regularly.

Indeed! And if we don't want to log and store history for this particular device we can set to exclude in log or history.

i am experiencing the same issue in 0.64.1 and in the logbook

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.

Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment :+1:

I can confirm that this issue is still present in 0.70.0 and is still relevant for me, even though I worked around this by relying on Custom UI for their client-side scripting features.

Having the logbook registry of the components tied to their UI visibility is still a very strange design decision to me.

So this is why my device_trackers wouldn't change in the history tab. Changing hide_if_away to true fixed the issue immediately. Devices whose state is not_home now show as such in the history tab.

Issue is present in 0.72.0.

As @ruippeixotog said, it's odd that the history information is based on UI visibility. The history component should get its information from the same place the UI is getting its information. I wonder if the new Lovelace UI will affect this?

I didn't have this issue previously, but for some reason it has now started occuring for me (0.78, it's possible I just never noticed it before)

You can close this @kurniawan77

@kennedyshead what exactly does your PR have to do with this issue?

The ping command did not work in standby, its now reverted to sending an empty KEY in the remote to check if its on.

This issue is about device_tracker in general, not some samsung media
player.

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.

Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment :+1:

This issue is still present in 0.84.6.

As mentioned above, still happening in 0.84.6.

@balloob @cgarwood
Hope you can post an update. 馃槂

In case switched to Lovelace, using https://www.home-assistant.io/lovelace/entity-filter/ is a solution. No need to hide anymore.

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates.
Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 馃憤
This issue now has been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ofuangka picture ofuangka  路  3Comments

i-am-shodan picture i-am-shodan  路  3Comments

TheZoker picture TheZoker  路  3Comments

kirichkov picture kirichkov  路  3Comments

aweb-01 picture aweb-01  路  3Comments