API for changing entities

I’m looking into writing a python script for bulk renaming entities to make it easier to switch back and forth between OpenZWave and Z-Wave JS. It doesn’t look like you get this level of control with the built-in python_script system. I’m wondering if anyone could point me to an API or interface that could do this programmatically.

Ideally this would remain a simple single script and not a whole custom component but I’m open to all options.

One idea I have is to log the requests made by the web interface and write a script to pretend to be coming from the browser. But ideally if there’s a more direct python api that’d be nice.

Are you suggesting there’s a REST API for changing entity names? I might be missing it, but I don’t see it in the documentation.

The frontend uses a websocket message of type config/entity_registry/update from what I see in the Chrome inspector:

  "type": "config/entity_registry/update",
  "entity_id": "sensor.basement_motion_temperature",
  "name": null,
  "icon": null,
  "area_id": null,
  "new_entity_id": "sensor.basement_motion_temperature_2",
  "id": 29

I don’t see that documented but seems straightforward enough to reverse engineer.