Trådfri (from GUI) failing and stopping startup

Hi!

I’m a HA beginner but I’ve managed to set up everything I set out to with my devices, some scripts, automations etc. all running on a raspberry pi 4 running raspbian and using the home assistant supervised install script.

The vast majority of my devices are Ikea Trådfri devices and I set those up using the GUI (smooth!).
After adding a script through the GUI and finding out it didn’t add an ID I could call from iOS Shortcuts I went in and edited the scripts.yaml file to add an ID and then restarted the HA service, that’s literally the only change from the previous boot, but somehow my home assistant setup is now completely broken and the service cannot be started.

I’ve commented out almost all of my config.yaml file but to no avail so I started looking at the log file, this is my log output:

2020-05-06 17:57:39 ERROR (MainThread) [homeassistant.components.switch] Error while setting up tradfri platform for switch
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 186, in _async_setup_platform
    await asyncio.gather(*pending)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 295, in async_add_entities
    await asyncio.gather(*tasks)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 421, in _async_add_entity
    raise HomeAssistantError(f"Invalid entity id: {entity.entity_id}")
homeassistant.exceptions.HomeAssistantError: Invalid entity id: switch.
2020-05-06 17:58:01 WARNING (SyncWorker_0) [homeassistant.components.icloud.account] Pending devices, trying again in 15s
2020-05-06 17:58:02 ERROR (MainThread) [homeassistant.core] Error doing job: Exception in callback async_setup_entity_restore.<locals>._write_unavailable_states(<Event homeassistant_start[L]>) at /usr/src/homeassistant/homeassistant/helpers/entity_registry.py:572
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/asyncio/events.py", line 88, in _run
    self._context.run(self._callback, *self._args)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_registry.py", line 604, in _write_unavailable_states
    states.async_set(entry.entity_id, STATE_UNAVAILABLE, attrs)
  File "/usr/src/homeassistant/homeassistant/core.py", line 994, in async_set
    state = State(entity_id, new_state, attributes, last_changed, None, context)
  File "/usr/src/homeassistant/homeassistant/core.py", line 736, in __init__
    f"Invalid entity id encountered: {entity_id}. "
homeassistant.exceptions.InvalidEntityFormatError: Invalid entity id encountered: switch.. Format should be <domain>.<object_id>

I’ve no idea how to proceed now? I’d like to at least try to remove and readd the trådfri platform from the GUI and see if that helps, but since I can’t get to the GUI I don’t know how?
I’m also perplexed since everything was working before, but could this be due to a number of my trådfri devices using emojis as their names in the Ikea Trådfri Gateway?

Ok so I managed to find a row in the /usr/share/hassio/homeassistant/.storage/core.entity_registry file listing a switch with the ID “switch.” I renamed that (just adding a suffix).

Restarted the service using

ha core restart

As well as reboot but to no avail, the log file now reads:

2020-05-06 18:33:31 WARNING (SyncWorker_11) [homeassistant.components.icloud.account] Pending devices, trying again in 15s