Troubleshooting Issues with Home Assistant

I’m starting this thread for others to offer techniques and/or insight into troubleshooting potential problems in your HA set up.

There are a lot of “I don’t know what is happening. How can I figure this out?” type threads.

I wrote up a “guide” a little while back in a thread about troubleshooting why an automation wouldn’t run correctly so I figured I would copy it here to start the ball rolling.

Feel free to add your troubleshooting experiences here to help others who might be running into the same issues.

Hopefully by having a single thread dedicated to this we can help new people find the info they need without needing to ask the same questions over and over in a new thread. And then it helps us to not have to answer the same questions over and over. :wink:

The post editor required me to select a a topic for the thread so I picked “automation” since my first post will deal with that but don’t limit your posts to that one topic. Any troubleshooting procedures for any aspect of HA are welcome.

1 Like

AUTOMATIONS:

There are a few things to remember when troubleshooting automations.

  1. always run a config check. If that doesn’t show any errors then the automation code syntax is (pretty much) going to be fine. There are very rare occasions that I’ve seen the config checker say everything is valid but then when you restart/reload you will get a notifications that the automations can’t be loaded.
  2. Once you reload the automations or restart HA and the automation actually shows up in your states page or automations list then you know that the yaml is valid so you can move on past that concern.
  3. Always do a dummy check to make sure that the automation is actually turned on. Look in the states page and the automation should have a state of ‘on’. if it doesn’t then turn it on. If it’s off then the automation is disabled and will be prevented from running.
  4. At that point there can be only three things preventing the automation from carrying out the actions: there is a problem with the logic of the trigger, the condition, or the action (or something in multiple areas but we will assume for simplicity sake that there is only one logic error).
  5. The next thing to remember is that the config checker only checks the validity of the yaml syntax. It doesn’t (and can’t) check the logical structure of any included templates (aside from the basic structure of the required jinja2 template formatting - if/elif/else/endif, quotation marks, etc - those will also be checked by the config checker). But any errors inside your templates won’t show up anywhere until those templates are evaluated either after the trigger occurs in the case of a template in the conditions or after the conditions are satisfied in the case of the templates in the actions.

For example, if you are trying to add a string and an integer in a template the error won’t show up until that template is evaluated. then the error will be posted to the home-assistant.log file. (as a side note you should always default to looking at the home-assistant.log file and not look at the UI logs. They are getting better I guess but the home-assistant.log file will always be complete and correct). so…

  1. always check the home-assistant.log file. If there is nothing there then you can be sure it’s going to be a problem with the top level sections: trigger, conditions or actions. At that point there are a few techniques you can use to narrow things down a bit more.
  2. To test if it’s a problem in the actions section then you can manually execute the automation by opening it’s pop up box and hitting the execute button. If the actions run as expected then you know the problem is in the trigger or conditions. But as noted above there could be an error in any templates in the actions (like the fact that if the automation was triggered manually the “trigger” object doesn’t exist so that will cause errors and stop the actions from running). If the actions don’t run the check the logs. If there are no errors there then check the logic of the actions. There may be an improper service call being made or some other logical issue.
  3. if the actions run fine then the next thing to check is the conditions. The best way to do that (aside from the obvious putting your eyes on them for any obvious mistakes :wink:) is to trigger the automation from the services page in dev tools using the automation.trigger service. Then in the data section put in the entity id of the automation (entity_id: automation.whatever) and then add the option to not skip the conditions (skip_condition: false). That will check that the conditions are actually valid and will run (or not) the actions based on the evaluated status of the conditions. If the actions still run as expected then you know the conditions are fine. If not then you need to check those conditions (realizing they also suffer the same limitations if they contain trigger objects in any templates).
  4. If all of that works as expected then the only thing left is to check that the triggers are being satisfied.
  5. To validate any templates and ensure that they are actually returning the expected values you should get used to using the template editor in the dev tools.

You may already know some of this so apologies if so. But I figured I’d just be thorough. :slightly_smiling_face:

2 Likes

Hey finity if you put the guide in the first post of the topic anyone can add to it or help edit it.

I thought about that but I’m not entirely sure it matters in this case since (hopefully) there will be many more posts related to troubleshooting that won’t be able to be edited either.

Ideally this will result in one topic per post that adds troubleshooting info on different aspects of HA. If so then it will be easy to scroll thru the posts to look for a heading with the topic you are having troubles with.

What would be even better is if we could make the entire thread an editable “wiki-type” thing so that every post could be edited. That would make this a pretty useful thread.

I’m not sure if that’s possible or not and I’m not even sure how I would go about getting in contact with a web administrator to make it happen. I have had zero success any time I’ve tried to contact an admin to resolve other issues I’ve had with the forum.

But if you really think it would be useful to move it I will. Did you have an edit you want to make?

Thoughts?