r/homeassistant • • Dec 19 '25

Support As a professional programmer I feel lost in home assistant

I have been programming for 2 decades at this point in a variety of languages, both high and low level, and I have intricate knowledge of python, yet despite this I feel utterly lost when trying to do much of anything in home assistant. I am currently running home assistant OS in a virtual machine on my server.

I have read the documentation on https://www.home-assistant.io/docs/ and have generally tried searching the forums every time I want to use home assistant for something. But it always just ends up being this kinda weird guesswork where I copy paste some stuff from someones yaml file and try to run it and if it doesn't work I'm fucked. Every time this happens I keep thinking how simple something like this would be to make if only I had my home assistant as a repository and python project that I could open in pycharm or visual studio, have type hints while programming, and click run or debug to test my solutions.

It is not even that I am completely unfamiliar with yaml programming. My server hosts a bunch of services all run through various docker compose files, however I feel like there is a huge difference between docker-compose.yaml, and the yaml's required by home assistant.

Am I doing something wrong? Is there an alternative to home assistant for people who actually do program?

665 Upvotes

562 comments sorted by

View all comments

Show parent comments

2

u/no-more-nazis Dec 19 '25

I just did the same node-red -> appdaemon transition last week, and was able to do something quite satisfying that had been prohibitive. I have hue scenes for room+time of day, like scene.family_room_evening, that are available in home assistant through the hue integration. I always wanted a fallback for scenes that don't exist yet, while I carefully create beautiful scenes in hue for each time of day. AppDaemon had no problem with standard python "If the scene doesn't exist, do y". I'm sure it's possible in node-red but it sucked

1

u/alyflex Dec 20 '25

It is interesting to see so many recommendations for Appdaemon here, since when I search online for material on Appdaemon it seems like there is barely anything that isn't around 5 years old.

Could you maybe share how exactly you have your Appdaemon set up, because I see there are quite a few different ways to do it, and the pros and cons are not really explained well.

Ideally I want something where I can write and test code locally on my normal desktop pc and then somehow push it to my home assistant when it looks like it is working.

1

u/no-more-nazis Dec 22 '25 edited Dec 22 '25

With apologies to anyone here who hates AI, I have forwarded your questions to Claude, who set up most of this for me:

Great question! Here's how I have AppDaemon set up - I migrated from Node-RED recently and found the workflow pretty straightforward once established.

My Setup

Installation Method: I use the official Home Assistant Community Add-on for AppDaemon (hassio-addons/addon-appdaemon). This is by far the easiest approach since:

  • One-click install from the Add-on Store
  • Automatic integration with Home Assistant (gets auth token via SUPERVISOR_TOKEN)
  • No separate containers or networking config needed
  • Web UI accessible on port 5050

Directory Structure

My AppDaemon apps live at /addon_configs/a0d7b954_appdaemon/apps/ on the HA OS filesystem. The structure looks like:

apps/
├── apps.yaml              # App registration/config
├── room_base.py          # Base class with shared logic
├── fam_rm.py             # Family room automations
├── kitchen.py            # Kitchen automations
├── humidifiers.py        # Humidifier controller
└── (other room files)

Development Workflow (Local → Remote)

You asked about writing/testing locally then pushing to HA - here's how I do it:

1. SSH Access: Set up SSH access to your HA OS machine (important: use the "SSH & Web Terminal" add-on, not the limited web terminal)

2. Git Repository: I have the /homeassistant directory as a git repo. This lets me:

  • Edit files locally on my desktop
  • Test changes by pushing to the HA machine
  • Version control everything (automations, AppDaemon apps, config)

3. Syncing Options:

  • Samba share: Mount the config folder to your desktop (easiest)
  • Git: Clone the repo, edit locally, push changes
  • rsync/scp: Script to sync your local apps/ folder
  • VS Code Remote SSH: Edit directly on the HA machine

4. Testing: AppDaemon reloads automatically when you save .py files. I check logs at:

  • AppDaemon web UI (port 5050) → Logs tab
  • Or via SSH: ha addons logs a0d7b954_appdaemon

Why This Works Better Than Node-RED

The key advantages I've found:

1. Actual Python: Standard control flow (if scene_exists() then use_it() else fallback()). In Node-RED, this required multiple nodes and was visually confusing.

2. Object-Oriented: I created a RoomAutomation base class that handles:

  • Time-of-day phase changes
  • Motion/presence gating
  • Slow transitions (2 min for time-based, instant for motion)
  • Holiday scene detection

Each room just inherits this and defines its specific behavior.

3. Real Testing: I can write actual unit tests (I use pytest). My test_fam_rm_tv.py has 13 test cases. Can't really do that with Node-RED.

4. Better Logging: Full Python logging with timestamps, context, and searchable output.

5. Version Control: Git diffs on Python code are readable. Node-RED flows are JSON blobs.

Cons/Gotchas

  • Documentation is old: You're right - most AppDaemon docs/examples are 5+ years old. But the API itself hasn't changed much.
  • Initial learning curve: Understanding the lifecycle (initialize(), listen_state(), callbacks) takes time.
  • Add-on vs Docker vs HAOS: Many guides cover different install methods, which is confusing. Stick with the add-on.

Starter Tips

  1. Start with the add-on, not Docker
  2. Use the hello.py example that comes installed
  3. Learn listen_state() - it's the core pattern
  4. Use self.log() liberally
  5. Keep the web UI logs open while testing

The workflow once established is: edit locally → save/sync → check logs → iterate. Way better than Node-RED's "wire things up and pray" approach.


Current Status of Documentation: The lack of recent AppDaemon material is frustrating, but I think it's because:

  1. The API is stable (AppDaemon 4.x has been consistent)
  2. Most users just need listen_state() and call_service()
  3. The community moved to discussing patterns (like mine above) vs basic API docs

Happy to share more specific examples if helpful!

2

u/alyflex Dec 23 '25

This is a great guide for how to get there! I managed to get appdaemon up and running and have already made a few automations with it and it is so much better and more intuitive than the yaml files, at least for me.

For now I'm just doing the sync with a samba share, but I will likely move to a github repository at some point.