Skip to content

Instantly share code, notes, and snippets.

@AlexxIT
Created August 30, 2020 09:18
Show Gist options
  • Save AlexxIT/8bc8c6b0802dfcfd13aee733134a8343 to your computer and use it in GitHub Desktop.
Save AlexxIT/8bc8c6b0802dfcfd13aee733134a8343 to your computer and use it in GitHub Desktop.
Home Assistant remove Device automation
# custom component: https://github.com/AlexxIT/PythonScriptsPro
python_script:
automation:
trigger:
platform: event
event_type: device_registry_updated
action:
service: python_script.exec
data_template:
device_id: "{{ trigger.event.data.device_id }}"
source: |
registry = hass.data['device_registry']
device = registry.async_get(data['device_id'])
if device and device.name_by_user == 'delete':
registry.async_remove_device(data['device_id'])
@AlexxIT
Copy link
Author

AlexxIT commented Aug 30, 2020

  1. Install custom component: https://github.com/AlexxIT/PythonScriptsPro
  2. Add this automation to config
  3. Configuration > Devices > Select Device > Gear (top right coner) > rename device to delete

Для удаления устройства его нужно переименовать в delete

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment