Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /config/template.yaml
- - sensor:
- - name: "Bluetooth Connection"
- state: >
- {% set connected_devices = state_attr('sensor.moto_g_8_plus_bluetooth_connection', 'connected_paired_devices')[1:-1].split(',') %}
- {% set paired_devices = state_attr('sensor.moto_g_8_plus_bluetooth_connection', 'paired_devices')[1:-1].split(',') %}
- {% set device_names = {
- 'F4:B6:88:43:0D:BA': 'Headset V5200',
- '00:02:19:24:26:17': 'Bil Radio',
- '93:94:DB:ED:95:74': 'BT højtaler', <-------- PRØV AT FJERNE KOMMAET HER.
- '37:43:7D:99:F9': 'UKENDT MFP', <-------- PRØV AT FJERNE HELE DENNE LINIE
- } %}
- {% for device in connected_devices -%}
- {% if device in paired_devices %}
- {{ device_names[device] }} .
- {% elif loop.last %}
- NONE.
- {%- endif %}
- {%- endfor %}
- Giver følgende fejl i log:
- Logger: homeassistant
- Source: components/bluetooth_tracker/device_tracker.py:63
- First occurred: 24:52:27 (52 occurrences)
- Last logged: 01:02:28
- Error doing job: Task exception was never retrieved
- Traceback (most recent call last):
- File "/usr/src/homeassistant/homeassistant/components/bluetooth_tracker/device_tracker.py", line 192, in update_bluetooth
- await perform_bluetooth_update()
- File "/usr/src/homeassistant/homeassistant/components/bluetooth_tracker/device_tracker.py", line 156, in perform_bluetooth_update
- devices = await hass.async_add_executor_job(discover_devices, device_id)
- File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 52, in run
- result = self.fn(*self.args, **self.kwargs)
- File "/usr/src/homeassistant/homeassistant/components/bluetooth_tracker/device_tracker.py", line 63, in discover_devices
- result = bluetooth.discover_devices(
- File "/usr/local/lib/python3.9/site-packages/bluetooth/bluez.py", line 26, in discover_devices
- device_id = _bt.hci_get_route()
- OSError: [Errno 19] No such device
- OG:
- Logger: homeassistant.helpers.template
- Source: helpers/template.py:1779
- First occurred: 24:52:28 (2 occurrences)
- Last logged: 24:52:28
- Template variable warning: 'dict object' has no attribute ' 93:94:DB:ED:95:74' when rendering '{% set connected_devices = state_attr('sensor.moto_g_8_plus_bluetooth_connection', 'connected_paired_devices')[1:-1].split(',') %} {% set paired_devices = state_attr('sensor.moto_g_8_plus_bluetooth_connection', 'paired_devices')[1:-1].split(',') %} {% set device_names = { 'F4:B6:88:43:0D:BA': 'Headset V5200', '00:02:19:24:26:17': 'Bil Radio', '93:94:DB:ED:95:74': 'BT højtaler', '37:43:7D:99:F9': 'UKENDT MFP', } %} {% for device in connected_devices -%} {% if device in paired_devices %} {{ device_names[device] }} . {% elif loop.last %} NONE. {%- endif %} {%- endfor %}'
Add Comment
Please, Sign In to add comment