Giter Site home page Giter Site logo

ha-composite-tracker's Introduction

Composite Device Tracker Platform Composite Device Tracker

This integration creates a composite device_tracker entity from one or more other entities. It will update whenever one of the watched entities updates, taking the "last seen" (and possibly GPS and other) data from the changing entity. The result can be a more accurate and up-to-date device tracker if the "input" entities update irregularly.

It will also create a sensor entity that indicates the speed of the device.

Currently any entity that has "GPS" attributes (gps_accuracy or acc, and either latitude & longitude or lat & lon), or any device_tracker entity with a source_type attribute of bluetooth, bluetooth_le, gps or router, or any binary_sensor entity, can be used as an input entity.

Installation

With HACS

hacs_badge

You can use HACS to manage the installation and provide update notifications.

  1. Add this repo as a custom repository. It should then appear as a new integration. Click on it. If necessary, search for "composite".

    https://github.com/pnbruckner/ha-composite-tracker
    

    Or use this button:

    Open your Home Assistant instance and open a repository inside the Home Assistant Community Store.

  2. Download the integration using the appropriate button.

Manual

Place a copy of the files from custom_components/composite in <config>/custom_components/composite, where <config> is your Home Assistant configuration directory.

NOTE: When downloading, make sure to use the Raw button from each file's page.

After it has been downloaded you will need to restart Home Assistant.

Versions

This custom integration supports HomeAssistant versions 2023.7 or newer.

Configuration

Composite entities can be created via the UI on the Integrations page or by YAML entries.

To create a Composite entity via the UI you can use this My Button:

add integration

Alternatively, go to Settings -> Devices & services and click the + ADD INTEGRATION button. Find or search for "Composite", click on it, then follow the prompts.

The remainder of this section describes YAML configuration. Here is an example YAML configuration:

composite:
  trackers:
    - name: Me
      entity_id:
        - entity: device_tracker.platform1_me
          use_picture: true
        - device_tracker.platform2_me
        - binary_sensor.i_am_home
  • default_options (Optional): Defines default values for corresponding options under trackers.

    • require_movement (Optional): Default is false.
    • driving_speed (Optional)
  • trackers: The list of composite trackers to create. For each entry see Tracker entries.

Tracker entries

  • entity_id: Specifies the watched entities. Can be an entity ID, a dictionary (see Entity Dictionary), or a list containing any combination of these.
  • name: Friendly name of composite device.
  • id (Optional): Object ID (i.e., part of entity ID after the dot) of composite device. If not supplied, then object ID will be generated from the name variable. For example, My Name would result in a tracker entity ID of device_tracker.my_name. The speed sensor's object ID will be the same as for the device tracker, but with a suffix of "_speed" added (e.g., sensor.my_name_speed.)
  • require_movement (Optional): true or false. If true, will skip update from a GPS-based tracker if it has not moved. Specifically, if circle defined by new GPS coordinates and accuracy overlaps circle defined by previous GPS coordinates and accuracy then update will be ignored.
  • driving_speed (Optional): Defines a driving speed threshold (in MPH or KPH, depending on general unit system setting.) If set, and current speed is at or above this value, and tracker is not in a zone, then the state of the tracker will be set to driving.
  • entity_picture (Optional): Specifies image to use for entity. Can be an URL or a file in "/local". Note that /local is used by the frontend to access files in <config_path>/www (which is typically /config/www.) You can specify file names with or without the "/local" prefix. If this option is used, then use_picture cannot be used.

Entity Dictionary

  • entity: Entity ID of an entity to watch.
  • all_states (Optional): true or false. Default is false. If true, use all states of the entity. If false, only use the "Home" state. NOTE: This option is ignored for entities whose source_type is gps for which all states are always used.
  • use_picture (Optional): true or false. Default is false. If true, use the entity's picture for the composite. Can only be true for at most one of the entities. If entity_picture is used, then this option cannot be used.

Watched device notes

Used states

For watched non-GPS-based devices, which states are used and whether any GPS data (if present) is used depends on several factors. E.g., if GPS-based devices are in use then the 'not_home'/'off' state of non-GPS-based devices will be ignored (unless all_states was specified as true for that entity.) If only non-GPS-based devices are in use, then the composite device will be 'home' if any of the watched devices are 'home'/'on', and will be 'not_home' only when all the watched devices are 'not_home'/'off'.

Last seen

If a watched device has a "last seen" attribute (i.e. last_seen or last_timestamp), that will be used in the composite device. If not, then last_updated from the entity's state object will be used instead.

The "last seen" attribute can be in any one of these formats:

Python type description
aware datetime In any time zone
naive datetime Assumed to be in the system's time zone (Settings -> System -> General)
float, int, str A POSIX timestamp (anything accepted by homeassistant.util.dt.utc_from_timestamp(float(x))
str A date & time, aware or naive (anything accepted by homeassistant.util.dt.parse_datetime)

Integrations known to provide a supported "last seen" attribute:

Miscellaneous

If a watched device has a battery_level or battery attribute, that will be used to update the composite device's battery_level attribute. If it has a battery_charging or charging attribute, that will be used to udpate the composite device's battery_charging attribute.

device_tracker Attributes

Attribute Description
battery_level Battery level (in percent, if available.)
battery_charging Battery charging status (True/False, if available.)
entities IDs of entities that have contributed to the state of the composite device.
entity_picture Picture to use for composite (if configured and available.)
gps_accuracy GPS accuracy radius (in meters, if available.)
last_entity_id ID of the last entity to update the composite device.
last_seen Date and time when current location information was last updated.
latitude Latitude of current location (if available.)
longitude Longitude of current location (if available.)
source_type Source of current location information: binary_sensor, bluetooth, bluetooth_le, gps or router.

Speed sensor Attributes

Attribute Description
angle Angle of movement direction (in degrees, if moving.)
direction Compass heading of movement direction (if moving.)

Examples

Example Full Config

composite:
  default_options:
    require_movement: true
    driving_speed: 15
  trackers:
    - name: Me
      driving_speed: 20
      entity_id:
        - entity: device_tracker.platform1_me
          use_picture: true
        - device_tracker.platform2_me
        - device_tracker.router_my_device
        - entity: binary_sensor.i_am_home
          all_states: true
    - name: Better Half
      id: wife
      require_movement: false
      entity_picture: /local/wife.jpg
      entity_id: device_tracker.platform_wife

ha-composite-tracker's People

Contributors

pnbruckner avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ha-composite-tracker's Issues

add country_code to device_trackers attributes

please consider adding the attribute country_code to the device_tracker. I was hoping since you've enabled the external library for calculating the timezone, this would also provide the country_code in the data to be added.

country_code is very useful data to base other presence login in, and, except for the core mobile_app device_tracker, none of the device_trackers provide it.

Of course, not all devices have the mobile app installed, and that's where custom integrations come into play.

As a matter of fact I've been using an AD app (importing from geopy) for some time to get the additional attributes into the core device_trackers, but as of late this has somehow stopped to be reliable. Seems the core device_trackers update even without statechange and delete the additional attributes.

Adding country_code to the Composite integration would be a fine enhancement which I hope could be do-able.

thanks for considering

Add all_states GUI setup per composite entry

Hi,

Let me start mentioning how much I appreciate the integration and its updates since a long time!

Can you support with advising where is the all_states configuration stored, and how can you change it, once absorbed in the GUI? Is in the db? That said, easiest and most useful development for everyone would be to have the all_states option implemented in the GUI, most importantly in the config after the setup workflow.

To expand, a few weeks back, misunderstanding the all_states settings, I added it as true for all the inputs of the composite items yaml. I started seeing myself not_home and alarms triggering when WiFi is disconnected, even though rarely, once a week or less. The integration updated and absorbed the yaml config, which I removed as per HA warning. Now, items are tied to the all_states=true, but this cannot be changed in the items configuration, there's only the entities and the require movement option. Funnily enough, somehow the not_home effect is now a 2-5 times daily issue and for myself and my flatmate too, which became quite an urgency to resolve 🙈

Thanks very much in advance.

Crazy speed data - like 2,200km/h

Hey @pnbruckner - First of all thanks for this integration.

I have just installed this and I am using it to combine 2 GPS device trackers that both work well (HA companion app and icloud3 integration).

The main reason for using this is to have a speed sensor for my iphone. Generally it works ok but I am getting the occasional crazy speed - like over 2000 km/h :-)

Can you help me to trouble shoot this or is it something I will have to live with (or find a way to deal with the bogus data)?

I need accurate speed data as I am trying to create an open source and data privacy based system for monitoring my teenage son's driving. Basically life 360 but home grown.

ImportError: cannot import name 'open_binary' from 'importlib_resources' with Core 2023.7.2

Installed 2023.7.2 and composite 2.8.2 will not load. Redownloaded via HACS and same error.

Invalid Config error
Error during setup of component composite
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/setup.py", line 288, in _async_setup_component
result = await task
^^^^^^^^^^
File "/config/custom_components/composite/init.py", line 218, in async_setup
await hass.async_add_executor_job(create_timefinder)
File "/usr/local/lib/python3.11/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/composite/init.py", line 205, in create_timefinder
from timezonefinderL import TimezoneFinder
File "/usr/local/lib/python3.11/site-packages/timezonefinderL/init.py", line 3, in
from .timezonefinderL import TimezoneFinder
File "/usr/local/lib/python3.11/site-packages/timezonefinderL/timezonefinderL.py", line 8, in
from importlib_resources import open_binary
ImportError: cannot import name 'open_binary' from 'importlib_resources' (/usr/local/lib/python3.11/site-packages/importlib_resources/init.py)

Verified my configuration.yaml

composite:
  trackers:
    - name: User 1 Phone WiFi At Home
      time_as: device_or_local
      entity_id:
        - binary_sensor.user_1_phone_wifi_at_home
    - name: User 2 Phone WiFi At Home
      time_as: device_or_local
      entity_id:
        - binary_sensor.user_2_phone_wifi_at_home

advanced setup?

I am trying to setup a advanced location based sensor working with the device BSSID.

What I want to achieve,

Display an area name based on BSSID
eg. 12:34:33:11:cc:ab = Living Room / 23:ab:55:fc:22:12 = Kitchen etc.
When the device is not connected to a BSSID, display the state as “Away”
This to specifically be a “Device Tracker” allowing me to assign it to a User.
When the user is “Away”, switch to the GPS location of the device.
Where im at

Using the composite device_tracker integration, I have managed to convert sensors to device trackers allowing me to assign them to the Users as device trackers. This currently shows as “Unknown” as im assigning the BSSID sensor directly to the compose device_tracker as the entity and I guess it cannot determine the home or away state.
Where I am stuck:

I need to somehow create a template sensor or something that determines the BSSID and assigns the name to that sensor, then assign that sensor the compose device_tracker sensor.
Can someone help me with this as I can only seem to create template sensors to convert to a “Unit of Measurement”.

Also, is it possible to display the entities based on a weight, IE, when connected to Wifi, dislplay the BSSID entity, when wifi is disconnected, then use the GPS device tracker?

Thanks

Device position not set

I have a device that appear in HA map but is not a device_tracker object (it is a sensor, sensor.trackit_child). Is has the following attributes:

Capture d’écran du 2023-12-20 15-42-45

How can I use it in ha-composite-tracker to be able to use it as a device_tracker ?

Currently I set up this:

composite:
  trackers:
    - name: Child
      time_as: device_or_local
      entity_id:
        - entity: device_tracker.composite_child
          use_picture: true
        - sensor.trackit_child

But position is still set as unknown.

Thanks for your help.

Generate a virtual "Family" Sensor just for presence at home

Hi,

would it be possible to create a composite family presence Sensor that only gets the status home or away depending on the other composite sensors for my family-members ? at the momet the family sensor gets the latest update and not just home or nor ?

Would it possible to make some zones ignorable like in the proximity sensor ?

ignored_zones:
  - "me @ Vienna"
  - "me @ Salbzurg"

Greetings
Kilowatt

Notify no longer interacting with device tracker.

I have an automation, it is split into 2x sub-routines (actions), that do the following:

First Action:

variables:
  target: |
    {% set x = trigger.to_state.attributes.source %} {{ states[x].object_id }}
alias: Sets the target of the notification to the person who triggered the event.

Second Action:

service: notify.mobile_app_{{ target }}
data:
  title: Shopping List
  message: >-
    {{ trigger.to_state.attributes.friendly_name }}, please review items that
    are needing purchase. Check them off when done.
  data:
    group: shopping-notification-group
    channel: Shopping
    notification_icon: mdi:cart
    color: "#A6FF96"
    clickAction: /lovelace-mushroom/house-mobile
    subtitle: Items are needed!
    car_ui: true
alias: Dispatch notification to person who entered Shopping Precinct

I am now, as of latest core update, getting the following. See attached.

I believe there were tracker changes in the latest update but as I am not a experienced coder I am uncertain if they are related.

Here are my details:

Core
2024.4.3
Supervisor
2024.04.0
Operating System
11.5
Frontend
20240404.2

Screen Shot 2024-04-21 at 8 53 51 pm

Question: bayesian support?

Small question: will you also support bayesian inference? I know it is possible with a binary sensor but in my head it makes more sense to directly integrate it in the composite device tracker.

feature request: prioritize specific entities for "home" state

I have a Problem using the composite tracker in combination with a binary sensor that is checking the MAC Adress is on a specific network and the homeassistant companion app.
The companion app does not seem to work reliable on Iphone so a feature to "prioritize" specific entities that are used on my sensor would be very helpful.
My WiFi Sensor is very accurate so I would like to proritize this sensor for the "home" state (or even in general) - like "if the sensor shows I am home - the composite sensor is "home" even if the companion app shows that I am away. Using the all_states attribute you imlemented a couple month ago does not for this problem :/ - It seems that the companion aü".

If you want I can implement such a feature and I will create a pull request - if you dont have time to create such a feature in the new year or whenever :)

~j54j6

GPS/Reouter combination issue

I want to combine two device tracker, lets call them "app" and "wifi". "app" is the ios companion app and "wifi" the tracker of my phone provided by the router.
If I only use the wifi trigger it works as expected- wifi switches to away -> composite_me switches to away and reverse.
However, if I include the app sensor, it stays home. Despite the composites showing "15 minutes ago" and the wifi "10 minutes ago". It even says last entity id = wifi.
Here is my config:

composite:
  tz_finder: timezonefinder<6
  tz_finder_class: TimezoneFinderL
  default_options:
    time_as: device_or_local
    require_movement: true
  
  trackers:
    - name: Me
      id: composite_me
      require_movement: true
      entity_id:
        - device_tracker.wifi
        - device_tracker.app

Shouldn't it switch to away or am I missing something?
(HA OS, installed via HACS)

Home Assistant 2023.7.2 results in invalid config

I have had composite installed for quite some time. Worked in HA 2023.7.1. Just updated to 2023.7.2 and now composite integration will not load.

I get this in my notifications:

image

This is my composite configuration in configuration.yaml

composite:
  trackers:
    - name: scott_composite
      time_as: device_or_local
      entity_id:
        - device_tracker.scott_alexander

Any ideas to try?

Thanks,

Scott

no entity for composite device tracker

My HW / HA config:

arch | armv7l
-- | --
dev | false
docker | false
hassio | false
os_name | Linux
os_version | 4.19.97-v7+
python_version | 3.7.3
timezone | Europe/Warsaw
version | 0.108.8
virtualenv | true

configuration.yaml:

composite:

device_tracker: !include includes/devtrack.yaml

devtrack.yaml:

- platrorm: composite
  name mycomposite
  time_as: device_or_local
  require_movements: false
  entity_id:
    - device_tracker.myphone
    - device_tracker.google_maps_xxxxxxxxxxxxxxxxxxxxx

log:

2020-04-24 13:17:55 DEBUG (SyncWorker_19) [custom_components.composite] Process requirements suceeded: timezonefinderL==4.0.2
2020-04-24 13:18:09 DEBUG (SyncWorker_6) [custom_components.composite.device_tracker] Updating device_tracker.mycomposite from device_tracker.google_maps_xxxxxxxxxxxxxxxxxxxxx
2020-04-24 13:18:30 DEBUG (SyncWorker_1) [custom_components.composite.device_tracker] Updating device_tracker.mycomposite from device_tracker.myphone

but I can't find an device_tracker.mycomposite entity in HA :(
No device_tracker.mycomposite in developer tools/states

Add option to specify "last seen" attribute name

Currently the integration looks for last_seen or last_timestamp. But there may be entities that provide the same information in an attribute with a different name. Rather than having to update the integration to support those entities, add an option that allows the user to specify the name of the attribute.

Another option might be (in addition to, or instead of, the above option) to allow the user to specify a template for extracting the information. This would serve the same purpose as the above, but would also allow the data to be converted in case it is in an unsupported format, or is wrong in some way but can be "fixed".

The template option does have potential downsides...

First, the core team seems to want any data added to an existing integration to go into a separate sensor entity (no matter how much it should be an attribute. See comment from core PR for GPSLogger that wasn't accepted.) Since such an entity would update independently of the composite's input entity, there would be no way to guarantee it would have the correct value when the input entity updates and the composite integration processes that update.

Along the same lines, using any other entities would have the same problem; i.e., every entity updates independently, each creating their own state_changed event, and there's no way to know when all relevant entities are "done" updating. If the user is not careful, the resulting composite entity could have short-lived incorrect states as all the entities referenced in the template update.

cached_property was used from composite, this is a deprecated alias

running HA 2025.5. beta cycle reveals:

Logger: homeassistant.backports.functools
Bron: helpers/deprecation.py:206
Eerst voorgekomen: 10:26:11 (1 gebeurtenissen)
Laatst gelogd: 10:26:11

cached_property was used from composite, this is a deprecated alias which will be removed in HA Core 2025.5. Use functools.cached_property instead, please report it to the author of the 'composite' custom integration

seems the integrations still works as expected.

Speed calculation error for composite when individual trackers do not have same error

Hello Phil. Me again!

Thought I'd start a new thread/issue for this. My testing setup is as follows and I noticed a speed spike today that I can't understand.

  1. composite for HA device tracker (single entity)
  2. composite for iCloud device tracker (single entity)
  3. composite with HA and iCloud together (2 entities)

Today I see a speed spike (error) on 3 but not seeing this on either 1 or 2 - so that is weird, right?

I would expect to see the glitch in one of the underlying trackers. Not sure what I can do to try to track this down. I will see if it happens again without making any changes to my setup.

Chart below. Also see the good progress I am making picking up speeding events in HA.

dash 2

After updating Life360 platform - wrong "battery" attribute

Recently Life360 platform was updated.
One of the changes was that battery attribute now is battery_level.
I guess this is a reason why currently the Composite platform reports a wrong battery level value.

Update: it happens sometimes.
And currently the composite platform in my setup depends on Life360 device_trackers only.

If there is nothing wrong with the composite platform and the recent changes in Life360 did not affect the composite platform - I will keep searching for my internal problems.

Deprecated constants which will be removed in HA Core 2025.1

Hi!

HA logs have the following mention that some of the constants used will be deprecated in a year. Thanks already beforehand if you have the time to fix this in the near future @pnbruckner !

Logger: homeassistant.components.device_tracker
Source: helpers/deprecation.py:205
Integration: Device tracker ([documentation](https://www.home-assistant.io/integrations/device_tracker), [issues](https://github.com/home-assistant/core/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+device_tracker%22))
First occurred: 17:48:27 (8 occurrences)
Last logged: 17:48:27

SOURCE_TYPE_BLUETOOTH was used from composite, this is a deprecated constant which will be removed in HA Core 2025.1. Use SourceType.BLUETOOTH instead, please create a bug report at https://github.com/pnbruckner/ha-composite-tracker/issues
SOURCE_TYPE_BLUETOOTH_LE was used from composite, this is a deprecated constant which will be removed in HA Core 2025.1. Use SourceType.BLUETOOTH_LE instead, please create a bug report at https://github.com/pnbruckner/ha-composite-tracker/issues
SOURCE_TYPE_GPS was used from composite, this is a deprecated constant which will be removed in HA Core 2025.1. Use SourceType.GPS instead, please create a bug report at https://github.com/pnbruckner/ha-composite-tracker/issues
SOURCE_TYPE_ROUTER was used from composite, this is a deprecated constant which will be removed in HA Core 2025.1. Use SourceType.ROUTER instead, please create a bug report at https://github.com/pnbruckner/ha-composite-tracker/issues

Stop Working from 0.113.3

Hi,
I have your custom component on my Raspbeery Pi from many time and I never had problems.
Sunday 2 August I installed version 0.113.3 and it stop to work.
In particular I have this settings:

platform: composite
name: key_tracker_enrico
time_as: local
entity_id:
  - binary_sensor.key_tracker_enrico #generato da ESP Home
interval_seconds: 10
consider_home: 600

Binary sensor is working fine, but device tracker never follow him.

If I look in Developer tools i see that the type is "gps" but it's false.
In real it's a binary sensor:

source_type: gps latitude: xx.yyyyyyyy longitude: zz.wwwwww gps_accuracy: 0 entity_id: binary_sensor.key_tracker_enrico last_entity_id: binary_sensor.key_tracker_enrico friendly_name: key tracker enrico

Thanks for your work

Question: Is it possible to use a binary_sensor Class presence with this integration

Hey,

I'm a newbie to Homeassistant and didn't found any problems like mine on google so hope you can help me :)

I wan't to integrate a wifi state compared with the companion App in one device tracker. For this I've created a binary sensor with the HACS Integration eap225 (Link: https://github.com/roger1233/TPLinkEAP225-Home-assistant-custom-component).
This is working without any problems but if I want to give the state to the Composite device tracker It wont work even if I rejoin my wifi to trigger the devicetracker listener...

I've created the following device tracker:
EAP225 integration in configuration.yml

binary_sensor:
  - platform: eap225
    name: binary_sensor.justin_phone_in_wifi
    mac: 64:a2:00:71:a2:4c

device_tracker

device_tracker:
  - platform: composite
    name: me
    time_as: device_or_local
    entity_id:
      - binary_sensor.justin_phone_in_wifi

I've also had an entry in the knowndevices.yaml with track:true but this doesnt work either...
If I also add the companion App to the tracker it work well (for the companion App) but the binary sensor is still be ignored...
The Homeassistant log doesn*t include any relevant information... So I think it is basicly correct configured.

Hope you can help me :) - and thank you for this great integration ^^

j54j6

Add consider_home option

Hi

From reading the docs of this integration, I cannot see an option to add a consider_home time (for example 180 seconds). I know it could be done when using automations, however, the built-in device tracker integration of HA offers exactly that.

I have been using the HA integrated device_tracker integration, however since the Unify Router integration does not seem to be reliable anymore, I'm looking for new options, without rewriting all my automations :)

Thanks

HACS?

I'm looking for composite-tracker in HACS and I'm not finding it. Did something change there?

No module named 'custom_components.composite.const'

using the latest version of the Custom integration this is logged on config check:

Schermafbeelding 2020-03-16 om 11 36 39

I have 6 trackers as you can see... have only updated the custom integration file itself, and didn't change anything to the configuration files. HA 106.6

and an error in the log for each, see my post on the community: https://community.home-assistant.io/t/composite-device-tracker-platform/67345/322

update

this is worse, going back to the previous release still shows the error on config check:

Schermafbeelding 2020-03-16 om 12 07 46

Could this be cause by updating ha 106.5 to 106.6??

please have a look?
thanks

Entity_Id vs Entities

The documentation speaks of a breaking change, migrating entity_id to entities. The current version doesn't seem to support this so I'm confused.

DB contains records with same state

Here is a "states" table for one device_tracker entity:

изображение

Look at the "attributes_id" column.
Here just 2 entries with different attribute_id:

изображение

изображение

A difference is only in "last_seen" attribute.
In this particular example it was a tracker for Apple watch - this device is usually not "visible" & rarely changes it's state.
In case of another device there could be LOTS of records in DB.

Is it possible to exclude the last_seen from DB & not store a new record when only this attribute is changed?

Feature Request: Zone Prioritization

Hi! Great add-on, thanks for making it.

It'd be nice if, when any of the entities attached to a composite tracker were detected outside of specified zones, then those entities take priority.

Said another way, it'd be nice if there was a

device_tracker:
- platform: composite
  name: me
  time_as: device_or_local
  require_movement: true
++low_priority_zones: Home, Park
  entity_id:
    - device_tracker.phone
    - device_tracker.keys
    - device_tracker.wallet
    - device_tracker.backpack

where low_priority_zones was a list of Zones that was only registered as the current location when all four trackers were there.

Composite Integration Won't Start

The latest 2.8.3 timezone fixes do not correct the issue. This was a yaml configuration that has worked without issue/change for at least six months and broke within the last few weeks with one of the HA updates (not sure which). An update to the latest version of the composite tracker (2.8.3 as of this writing) and a reboot did not fix the issue. The integration hangs on startup and never loads.
image
image
image
image

HA v2024.5 - WARNING - cached_property was used from composite

This warning is showing up in HA v2024.5.

WARNING (ImportExecutor_0) [homeassistant.backports.functools] cached_property was used from composite, this is a deprecated alias which will be removed in HA Core 2025.5. Use functools.cached_property instead, please report it to the author of the 'composite' custom integration

MultipleInvalid: length of value must be at least 1 for dictionary value @ data['composite']['trackers']

sorry to report a breaking error in the 3.0.0b1 prerelease. After updating a restart wont go past this:

Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/usr/src/homeassistant/homeassistant/__main__.py", line 221, in <module>
    sys.exit(main())
             ^^^^^^
  File "/usr/src/homeassistant/homeassistant/__main__.py", line 209, in main
    exit_code = runner.run(runtime_conf)
                ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/runner.py", line 188, in run
    return loop.run_until_complete(setup_and_run_hass(runtime_config))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/asyncio/base_events.py", line 653, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/runner.py", line 154, in setup_and_run_hass
    hass = await bootstrap.async_setup_hass(runtime_config)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/bootstrap.py", line 147, in async_setup_hass
    config_dict = await conf_util.async_hass_config_yaml(hass)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/config.py", line 501, in async_hass_config_yaml
    await merge_packages_config(hass, config, core_config.get(CONF_PACKAGES, {}))
  File "/usr/src/homeassistant/homeassistant/config.py", line 1078, in merge_packages_config
    merge_list = _identify_config_schema(component) == "list"
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/config.py", line 976, in _identify_config_schema
    default_value = module.CONFIG_SCHEMA({module.DOMAIN: key.default()})[
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/voluptuous/schema_builder.py", line 272, in __call__
    return self._compiled([], data)
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/voluptuous/schema_builder.py", line 595, in validate_dict
    return base_validate(path, iteritems(data), out)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/voluptuous/schema_builder.py", line 433, in validate_mapping
    raise er.MultipleInvalid(errors)
voluptuous.error.MultipleInvalid: length of value must be at least 1 for dictionary value @ data['composite']['trackers']

device_tracker.nothing_phone_1 missing gps attributes

I get the following error in my log and the sensor does not always update correctly.
My phone is using the HA app (thus relies on GPS) but is sending the zones only instead if specific coordinates.

This error originated from a custom integration.

Logger: custom_components.composite.device_tracker
Source: custom_components/composite/device_tracker.py:614
Integration: Composite (documentation, issues)
First occurred: 25 October 2023 at 23:27:18 (1 occurrences)
Last logged: 25 October 2023 at 23:27:18

device_tracker.nothing_phone_1 missing gps attributes

Stale GPS location is accepted

I've added a composite device using the trackers for the app, Unifi and nmap. Turns out if the app goes offline it is still counted as as being currently active and at home. I've confirmed this happens when:

  • Phone is in aeroplane mode
  • Phone has left the house and WiFi network, and there is no cloud integration to reach Home Assistant to update location

The composite tracker has require_movement: true but this has no effect as there are no updates to the location and the stale location is treated as still valid. The only fixes appear to be:

  • Remove app from device list, or
  • Ensure external URL is functioning (cloud or VPN access) for a location ping from outdoors

The see service is not supported for this entity ...

ERROR Message at startup:

Protokolldetails ( ERROR )
Logger: homeassistant.components.device_tracker
Source: components/device_tracker/legacy.py:184
Integration: Geräte-Tracker (documentation, issues)
First occurred: 13:03:02 (2 occurrences)
Last logged: 13:11:07

Configuration

- platform: composite
    name: XIAOMI-HANDY-RENI
    time_as: device_or_local
    require_movement: true
    entity_id:
      - device_tracker.xiaomi_handy_reni

Device Info

source_type: router
is_wired: false
hostname: RedmiNote4-timeoutno
mac: 'XX:XX:XX:XX:XX:XX'
name: XIAOMI-HANDY-RENI
oui: XiaomiCo
_is_guest_by_uap: false
ap_mac: 'XX:XX:XX:XX:XX:XX'
authorized: true
essid: XXXXXXXXXXX
ip: XX.X.X.XXX
is_11r: false
is_guest: false
noted: true
qos_policy_applied: true
radio: ng
radio_proto: ng
vlan: 0
friendly_name: XIAOMI-HANDY-RENI

System

Frontend-Version: 20200603.3 - latest
arch	x86_64
dev	false
docker	false
hassio	false
installation_type	Home Assistant Core
os_name	Linux
os_version	5.4.0-37-generic
python_version	3.8.2
timezone	Europe/Vaduz
version	0.111.4
virtualenv	true
Lovelace
dashboards	2
mode	yaml
resources	23
views	9

What am I doing wrong with the configuration, because all other devices work perfectly.
How can I fix the error ?
Thanks

Integration needs a reload when entity becomes unavailable

Hi, first of all - I love the idea of this integration, I really do. Actually, I've been hoping it could become another layer of resilience for my home setup. Here's what is my current issue.

I want to use Composite Tracker to diversify home/not_home status based on more than one entity so that if one of them becomes unavailable, the status would be still reported correctly.

My current sample configuration:

composite:
  default_options:
    require_movement: false
  trackers:
    - name: Karol
      id: karol
      entity_id:
        - entity: device_tracker.karol_s_iphone
        - entity: binary_sensor.karol_s_iphone_wifi_at_home

device_tracker.karol_s_iphone - comes from Unifi integration
binary_sensor.karol_s_iphone_wifi_at_home - comes from template sensor and is update when HA companion app connects/disconnects to/from my home WiFi.

The problem is that when I disable Unifi integration / device_tracker.karol_s_iphone becomes unavailable (there are some issues ongoing with current firmware when such things happen randomly and quite often), Composite Tracker stops reacting to changes of tracker that is still available / binary_sensor.karol_s_iphone_wifi_at_home.

Are my observations correct? Would it be complicated to add logic that skips the entities that are unavailable?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.