How do I find entities that are missing or misspelled?

I have had instances in the configuration.yaml when I have removed entities or misspelled them and it didn’t cause any errors. It did however made sensors / groups / automations and other components not work as intended.

Is there a way to check my configuration for entities in component configuration that do not exist?

You can see all your entities in the “States” developer tool:

Can that help my find the misspelled entities like this one in a action in a automation?

  action:
    - service: switch.turn_off
      entity_id: switch.misspelled_entity_that_doesn't_exist

Here’s how I did this:

#1 Get the list of the entities mentioned in my config files.

find /config -type f \( -name "*.yaml" -o  -name "*.py" \) -exec egrep  -r -e '(switch|light|sensor|camera|device_tracker|group|input_boolean|input_number|input_select|input_text)\.' {} \; |\
  sed 's/\(\(switch\|light\|binary_sensor\|sensor\|camera\|device_tracker\|group\|input_boolean\|input_number\|input_select\|input_text\)\.[a-z_0-9][a-z_0-9]*\)/\n\1/ig' |\
  sed 's/\(\(switch\|light\|binary_sensor\|sensor\|camera\|device_tracker\|group\|input_boolean\|input_number\|input_select\|input_text\)\.[a-z_0-9][a-z_0-9]*\).*/\1/ig' |\
  sort | uniq |\
  grep '\.' |\
  egrep -vw 'light.toggle|light.turn_off|light.turn_on|switch.is_off|switch.is_on|switch.toggle|switch.turn_off|switch.turn_on'

#2 Get the list of existing entities in HA
In the /developer-tools/template execute the following:

{% for state in states %}
    "{{- state.entity_id -}}
{% endfor %}

#3 Compare the two lists

An addon/integration/appdaemon that could compare all automations, scripts, etc to active/known entity id’s would be awsome. Hell, I’d settle for a Blueprint.

Has anyone found a viable and nice possibility for this?

Watchman will hunt down entities in your yaml that do not exist or are unavailable:

1 Like