A number of my automations have ‘failed to set up’, but the error message just contains the entity ID.
e.g. Error:`Unknown device ‘6a63aff0108849a4a235a181283131e0’
Firstly, I wanted to check if these error messages would show the device name if one had been set?
If the error message doesn’t show the device name even if one has been set, is there a way to search - using the device ID, to get the device name?
123
(Taras)
July 25, 2024, 4:10pm
2
Copy-paste the following template into the Template Editor.
{{ device_attr('6a63aff0108849a4a235a181283131e0', 'name') }}
If it returns null
then it means Home Assistant can’t find a device with that id.
Reference
Templating - Devices
Thank you @123 that returned a ‘null’, which makes sense as the automation has failed to set-up because the device with that ID can’t be found.
My challenge is trying to figure out which device and / or trigger I originally used to set up the automation. Perhaps I should put a feature request in for the system to store the device name as well as the ID
123
(Taras)
July 25, 2024, 5:18pm
4
If it’s null
then the supplied device_id doesn’t exist so there’s no name for it stored anywhere.
One or more of your automations refer to a device that no longer exists by the device_id it was originally assigned .
The device was either removed from your system or replaced by another (which was assigned a different device_id).
For future reference, you may wish to review the following community guide:
Background
When you start writing automations, a device trigger seems the obvious choice. Everybody knows what a device is and it comes at the top of the UI dropdown list.
[image]
It works… but it is certainly not a “great way to start” because it is storing up problems for the future. Far better to use an entity, with state or numeric_state.
Device_id problems
The yaml will be longer and harder to follow, which may make maintenance difficult, especially a few months down the line when y…
You can use a text editor to seach the automations.yaml
file for instances of the device_id. This will lead you to the appropriate automation(s).
My thanks again @123 .
I take note of the ‘best practice’ and will amend the automations as suggested
My challenge remains not having enough context with the error message to know what the original (now missing) devices / triggers might have been
123
(Taras)
July 25, 2024, 6:18pm
6
I agree there’s not much of a clue as to where to look for the broken references. If faced with the same situation, I would do what I suggested above (search automation/script files with text editor).