Tool to scan one's config file!

Just wondering if anyone has as a pet project a tool which they’ve used to scan their config file and compare it to the entities in dev states? (or similar)

(I have a recurring error in my log: Error during template condition: UndefinedError: 'None' has no attribute 'attributes' which I can’t possibly hope to ever find based on that scant bit of info among 257 automations.) I keep hoping that in the next release of HA the error will get more verbose so I can track down the faulty automation!

Another tool which would be quite useful would be a tool to sort one’s automations by say trigger or action. To group similar automations together.

Try vsc (padding)

Visual Studio Code? Would that do any of what I was wondering about? Looks more like an advanced and very nifty configurator? Would love to be wrong! :stuck_out_tongue:

VSC is basically a text editor (not sure what you mean by configurator other than the UI Notepad equivalent)
With the Home Assistant Add-In, plus things like Rainbow Spacing And Rainbow Brackets you get syntax warnings, hints for incorrect spacing and it makes it easier to find unmatched bracket pairs.

A PR about non-existant entities has just been approved into HA to give warnings of such into your logs - so that may help you too

BUT … the error you list specifically mentions a template problem.
You should not have a template in every automation but you may also have them in scripts and sensors
Using VSC you point it at your config directory and it loads and scans everything
View the ‘Problems’ (Ctrl+Shift+M) and you can see which bits it doesn’t like. Or you can open each file and look for red hightlighted sections.
You can also (say as in this case) serch for ‘{{’ and every instance in your config will be listed.
Perform a binary divide and comment out half your template config
Test for errors, if your config check passes the the mistake is in the other half, uncomment half what’s left
if it fails then you know your mistake is still in the uncommented sections, swap the comments but uncomment half whats left.
Continue till you find your error.

You should test config after each ‘edit’ as then you know where you’ve been working and where the error must lie.

Edit: It will also make a stab at listing autocomplete entities but you must name your entities consistently to make best use of it

2 Likes

Ah thanks! Looks cool, but sadly, it wilnae run on my Pi
Food for thought, though!

Also re:my config - the config scanner check is actually fine with my config.yaml, it’s only when the automation is actually executed does the problem manifest itself. So veeery tricky to find. Hopefully as you say this new PR might help!

The hassio addon is not compiled to run on an arm processor, so no it won’t run on a pi.
I installed mine on my workstation amd/Intel.
Then you point it at your config folder, there are plenty of guides

So if you ‘run an automation’ you get the error, so you know which is causing the problem ???