home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
73.56k stars 30.73k forks source link

device_tracker stays "home" in history and logbook #11564

Closed kurniawan77 closed 5 years ago

kurniawan77 commented 6 years ago

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
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

Traceback (if applicable):

Additional info: When device is set to hide: image

An other device that is not set to hide: image

ruippeixotog commented 6 years ago

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.

kurniawan77 commented 6 years ago

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.

ygarti commented 6 years ago

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

balloobbot commented 6 years ago

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:

ruippeixotog commented 6 years ago

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.

maxfarrior commented 6 years ago

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?

mueslo commented 6 years ago

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)

kennedyshead commented 6 years ago

You can close this @kurniawan77

mueslo commented 6 years ago

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

kennedyshead commented 6 years ago

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

mueslo commented 6 years ago

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

balloobbot commented 5 years ago

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:

SaturnusDJ commented 5 years ago

This issue is still present in 0.84.6.

dfkt80 commented 5 years ago

As mentioned above, still happening in 0.84.6.

SaturnusDJ commented 5 years ago

@balloob @cgarwood Hope you can post an update. 😃

SaturnusDJ commented 5 years ago

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

stale[bot] commented 5 years ago

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.