-
-
Notifications
You must be signed in to change notification settings - Fork 247
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Detect missing or faulty bluetooth connection #65
Comments
All entities created by our component have the binary_sensor:
- platform: template
sensors:
bt_stuck:
friendly_name: "BT"
value_template: >-
{% set btvalues = [
states.sensor.mi_t_1.last_updated,
states.sensor.mi_t_2.last_updated,
states.sensor.mi_h_1.last_updated,
states.sensor.mi_h_2.last_updated]%}
{{ (as_timestamp(now())-as_timestamp(btvalues | max)) > 120 }}
device_class: problem
icon_template: >-
{% if is_state("binary_sensor.bt_stuck", "on") %}
mdi:bluetooth-off
{% else %}
mdi:bluetooth
{% endif %} However, there are still options - use the command line sensor in combination with a bash script (which starts and parses the output of the |
Thanks Alex! That binary sensor is exactly what I'm looking for. If I run the value_template in the Developer Tool / Template section, it returns "True" and "False" as expected. |
Looks like the sensor is not being automatically updated. sensor:
- platform: time_date
display_options:
- time The sensor changes state now, after two minutes of faulty bluetooth communication. |
Yes, I forgot about this feature of the operation of template sensors. The Summary yaml: sensor:
- platform: time_date
display_options:
- time
binary_sensor:
- platform: template
sensors:
bt_stuck:
friendly_name: "BT"
value_template: >-
{% set btvalues = [
states.sensor.mi_t_1.last_updated,
states.sensor.mi_t_2.last_updated,
states.sensor.mi_h_1.last_updated,
states.sensor.mi_h_2.last_updated]%}
{{ (as_timestamp(now())-as_timestamp(btvalues | max)) > 120 }}
device_class: problem
entity_id: sensor.time
icon_template: >-
{% if is_state("binary_sensor.bt_stuck", "on") %}
mdi:bluetooth-off
{% else %}
mdi:bluetooth
{% endif %} where |
Is it possible to more natively set a sensor state to unknown or unavailable after a configurable timeout? Similar to how mqtt let's us set : expire_after integer (Optional, default: 0) |
Is there a way to detect, in HA, if the component is unable to read data from bluetooth?
From what I see now, there is no indication that the bluetooth connection is broken (either the dondle is removed, drivers crashed, whatever).
I run HassIO in a VirtualBox VM from a Windows host, so the bluetooth device can, from time to time, become unavailable to VM.
The text was updated successfully, but these errors were encountered: