Help Getting Started

Hi All,

I’m struggling to get started with developing for Home Assistant. Not so much the coding aspect, though I’m not even there yet. I do have fair amount of programming experience in C languages and Python, but I don’t have experience working on an open source and large project such as Home Assistant.

First off, what I’m interested in developing right away is support for TP-Link light bulbs. Honestly, I think it’s mostly there in the pyHS100 file and just a “component” file is needed. (A tangential question is where is the pyHS100 in the HA distribution? I can find it other places on the Internet.) I’m also interested in understanding the development environment because I think I’ll be able to better understand how to configure HA on the top level. I find the documentation challenged, so being able to go through the source code will help. If it does help, then I can possibly provide more examples and contribute to the documentation - at least with the components I use.

Some basic questions:

  1. What’s the best IDE to work with? Maybe more basic - do you typically use an IDE to develop for HA? On other projects I’ve used MS Visual Studio, PyCharm, Idle, etc. My current configuration is with PyCharm only because I thought that was a good way to go with a large project.
  2. What’s the right way to create a new component, such has the TP-Link light bulb? I’ve read creating a custom-component directory and adding the component file there. That makes sense, but do then I Run HA from PyCharm? Should I copy the new component over to my HA server and restart it?
  3. Is anyone willing to share their general (or as specific as you would like) flow for developing for HA? I think that would be very useful.

Thanks!

First of all you should (and you probably already) have a look at Starting with Development.

As for your three questions:

  1. That’s a matter of personal taste. I started out with PyCharm, but now switched to Visual Studio Code. It doesn’t really matter and even the Windows Notepad would suffice. I recommend an IDE with integrated linting though.
  2. I always copy an existing platform / component that’s similar to what I want my project to do. Then edit it to actually do what I want it to do. I guess that’s a rather lazy approach. :smiley:
  3. I guess you can combine step 1 and 2. The rest depends on your setup. I have a dedicated Debian VM running the latest dev-branch of HASS. So I simply deploy my local code to the VM, restart HASS and then hope everything is working.
  1. I’ve used notepad++ for most of my stuff so far but I’m going to be moving to Visual Studio Code soon because I’ve started doing Python stuff at work and I need to be significantly more exact.

  2. My flow is pretty simple at the moment. I use a windows machine for development/github/etc, then I transfer the files over to a debian Virtual Machine and manually run HASS there. I also keep my dev configuration extremely bare-bones.

I’d like to set up an IDE for development of hass components and was wondering what you ended up with.

The information out there is pretty sparse and I like PyCharm for the IDE because of all the extra features it offers (I use Visual Studio Code for everything else).

Thanks in advance for sharing.

Regards,
Michal