Migrate proximity to sensor entities (#29223)

* migrate to sensor entities

* adjust according to latest updates in parent PR

* Apply suggestions from code review

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* Apply suggestions from code review

* fix order of possible states

---------

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
This commit is contained in:
Michael 2024-01-24 13:40:12 +01:00 committed by GitHub
parent fe092b8261
commit 00d5e5d491
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -13,7 +13,7 @@ ha_codeowners:
- '@mib1185' - '@mib1185'
--- ---
The `proximity` integration allows you to monitor the proximity of devices or persons to a particular [zone](/integrations/zone/) and the direction of travel. The result is an entity created in Home Assistant which maintains the proximity data. The `proximity` integration allows you to monitor the proximity of devices or persons to a particular [zone](/integrations/zone/) and the direction of travel.
This integration is useful to reduce the number of automation rules required when wanting to perform automations based on locations outside a particular zone. The [zone](/docs/automation/trigger#zone-trigger) and [state](/docs/automation/trigger#state-trigger) based triggers allow similar control but the number of rules grows exponentially when factors such as direction of travel need to be taken into account. This integration is useful to reduce the number of automation rules required when wanting to perform automations based on locations outside a particular zone. The [zone](/docs/automation/trigger#zone-trigger) and [state](/docs/automation/trigger#state-trigger) based triggers allow similar control but the number of rules grows exponentially when factors such as direction of travel need to be taken into account.
@ -22,23 +22,30 @@ Some examples of its use include:
- Increase thermostat temperature as you near home - Increase thermostat temperature as you near home
- Decrease temperature the further away from home you travel - Decrease temperature the further away from home you travel
The Proximity entity which is created has the following values: ## Sensors
- `state`: Distance from the monitored zone (in `unit_of_measurement`) The following sensor entities will be created.
- `dir_of_travel`: Direction of the closest device or person to the monitored zone. Values are:
- `not set` ### Distance
- `arrived`
- `towards` For each tracked device or person, a sensor showing the distance from the monitored zone in a unit depending on your [Home Assistant Unit System](/docs/configuration/basic) selection is created.
- `away_from` You can use the [Min/Max](/integrations/min_max) integration to determine the nearest and furthest distance.
- `unknown`
- `stationary` ### Direction of travel
- `unit_of_measurement`: Measurement of distance. Values are:
- `km` For each tracked device or person, a sensor showing the direction of travel to or from the monitored zone is created. Possible states are:
- `m`
- `mi` - `arrived`
- `yd` - `away_from`
- `ft` - `stationary`
- `nearest`: The device or person which is nearest to the zone - `towards`
- `unknown`
### Nearest device
A sensor showing the device or person which is nearest to the monitored zone is created.
## Configuration
To enable this integration in your installation, add the following to your `configuration.yaml` file: To enable this integration in your installation, add the following to your `configuration.yaml` file: