How to avoid configuration collisions when using cookbook/contributed code

I’ve been following along with the “creating an alarm clock” thread:

What’s the best way to cut/paste code into my yaml without running into collisions? For ex, the contributed code has an input_boolean and I already have booleans in my yaml. Do I need to move these necessary booleans into my input_boolean: definitions? Or can I keep all of this related code together somehow? It looks like the “splitting configuration” route still tends to keep sensors with sensors, booleans with booleans…

My 2 cents on this is that you should never copy-paste into a YAML file at all (only exception being from one of yours to another of yours).

You should always try to understand cookbook entries and contributed code and implement it in you configuration on your own. That way you will learn more, be able to fix things by yourself and actually reduce errors (by not getting any errors like you mentioned above)

Cheers

So maybe a better example would be when you want to keep variable definitions near the code that uses them. Like with that alarm clock, I cna see where I might want to keep the enable/disable variable near the code that uses it - for clarity.

But I’m reading your response as “no - that’s not how it works”. Which is fine - I can also see why defining variables together in one place is a good idea.

Okay I see what you want to do now. Sadly AFAIK the default implementation of YAML in python can handle this and as you already mentioned it would be a pain to handle with split configurations.

I tend to use comments in my multiple files if I reference / rely on stuff from other files. A comment can be done with a single “#” at the beginning of the line.

Cheers