Advertisement
JLindvig

Untitled

Jan 26th, 2022
1,148
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. {% set connected_devices = state_attr('sensor.redmi_9t_bluetooth_connection', 'connected_paired_devices')[1:-1].split(',') %}
  2. {% set paired_devices = state_attr('sensor.redmi_9t_bluetooth_connection', 'paired_devices')[1:-1].split(',') %}
  3. {% set device_names = {
  4.   'FF:FC:33:54:04:36': 'Høretelefoner',
  5.   'EN_ANDEN_MAC_ADDR': 'En anden lækker enhed'
  6. } %}
  7.  
  8. {% for device in connected_devices -%}
  9.   {% if device in paired_devices %}
  10.     {{ device_names[device] }} er tilsluttet
  11.   {% elif loop.last %}
  12.     Intet tilsluttet.
  13.   {%- endif %}
  14. {%- endfor %}
Advertisement
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement