I am using room assistant in 3 locations around the house I have managed to create value sensors to extract the distances measured by each. I would now like to use a <5 to ditimine if I’m in that room or not. Here is my config
sensor:
- platform: mqtt_room
device_id: 342d24e9aa9f
name: 'BLE James'
state_topic: 'room_presence'
timeout: 5
away_timeout: 60
- platform: template
sensors:
ble_james_downstairs:
friendly_name: "BLE James Downstairs"
value_template: >-
{% if is_state('sensor.ble_james', 'downstairs') %}
{{states.sensor.ble_james.attributes.distance}}
{% endif %}
ble_james_upstairs:
friendly_name: "BLE James Upstairs"
value_template: >-
{% if is_state('sensor.ble_james', 'bedroom') %}
{{states.sensor.ble_james.attributes.distance}}
{% endif %}
ble_james_outside:
friendly_name: "BLE James Outside"
value_template: >-
{% if is_state('sensor.ble_james', 'patio') %}
{{states.sensor.ble_james.attributes.distance}}
{% endif %}
From these sensor I get the distances in the states
I am now trying to create a sensor that will tell me where I am by which one is < 5
UI Sensor to show which location I am in the house
james_castle_location:
friendly_name: "Kingia Castle Location"
value_template: >-
{% if is_state('sensor.ble_james_downstairs', '< 5') %}
Downstairs
{% elif is_state('sensor.ble_james_bedroom', '< 5') %}
Bedroom
{% elif is_state('sensor.ble_james_patio', '< 5') %}
Outside
{% elif is_state('device_tracker.galaxy_s8', 'home') %}
Just Arrived
{% else %}
Not Home
{% endif %}