Regarding .Py Files and How to use Them

I am new to HA so I am just seeking some information. I see a lot of .py files in the HA component Github. Are those required to be some place in HA for things to work? I know some put them a directory called “custom_components” but there does not seem to be any rhythm or reason why they are there. Is there a certain way they have to be put into that directory for them to work? I have searched on the forum and seen where many have suggested some of them but no direction on what to do with them. Any help would be great! Thanks ahead.

Are you wanting to use the default compoenents? If so they are loaded by adding the configuration per the applicable component instructions.

.py files are scripts using the Python scripting language.
Home Assistant is written using the Python language.

Right so just use what is on the component pages? Then best not to even worry about those .py files then?

Yeah I understand that part but what are these files for? Does HA pull them if you have the component set in Configuration.yaml the way the component page states?

Yes, configure per the component page. Unless you are specifically modifying for your use or creating a new component you can ignore all the .py files.

When you enter a component in your configuration.yaml file, HA will pull in the required files and setup the component.

What you see in GitHub is the entire Home Assistant software. When you install Home Assistant it will pull the files it needs from that repository, and put them where it needs. You don’t need to do anything with them.

Ah! Got it now, cool thanks I was a bit confused on those. Thanks for setting me straight.

Roger that! thanks

Jumping in with a question:

I saw a .py-file that is supposed to replace(?) the samsungtv component.
How do I add that to my system. (I’m new on HA and rassberry Pi/Linux so please give me a push in the right direction).

Regards, Mårten

Look at CUSTOM COMPONENTS