How can I make the presence sensor in this card to appear like the rest of the entities? I suspect that it is a Device Class selection, but none of the built-in classes looks right.
The sensor is the status from an ESP8266-01 in the Jeep. When it connects the status goes “on”. When the Jeep is away, or out of range of my WiFi, it goes “off”. But to save the Jeep battery, I put the ESP to sleep- two minutes asleep, 15 sec awake. So the input_text is set by an automation that looks for the status to be “off” for three minutes before setting to “away”.
Use this instead of the input text and automation:
template:
- binary_sensor:
- name: "Jeep Presence"
device_class: connectivity # to look the same as the others.
state: "{{ is_state('binary_sensor.your_esp_jeep_status_sensor_here', 'on' }}"
delay_off: "0:03:00"
Thanks. I am learning here and your replies are appreciated. I can see where making the test of the status do all the work instead of an automation would be more straightforward.
I must be a slow learner because I am just becoming comfortable with automations. Templates are the next black art I need to learn.
I need to work on the template because the input_text and automation also triggers from “off” to “on” with no delay. “On” to “off” has the delay so that the deep-sleep of the ESP isn’t confused for “Away”.
Also, where would I put the template?
alias: set jeep presence
description: ''
trigger:
- platform: state
entity_id: binary_sensor.jeep_status
from: 'on'
to: 'off'
for:
hours: 0
minutes: 3
seconds: 0
- platform: state
entity_id: binary_sensor.jeep_status
from: 'off'
to: 'on'
condition: []
action:
- service: input_text.set_value
data:
value: |
{% if is_state('binary_sensor.jeep_status', 'on') %}
Home
{% else %}
Away
{% endif %}
target:
entity_id: input_text.jeep_presence
mode: single
No you don’t. That’s exactly what delay_off: "0:03:00" does in the template binary sensor I posted. It switches on instantly but won’t turn off unless the state is off continuously for three minutes.
It goes in your configuration.yaml file like other integrations. With template: hard against the margin.