News for hackers. Stuff that matters.
Re:Run Your Home on a Raspberry Pi by gregable on Wednesday February 02, 2022 @02:18PM (#30182568)
For folks here I strongly recommend installing the appdaemon integration and just writing python scripts. The downside is there is a good bit of learning curve and time investment just to get the hello world going (turn on a light at sunset?).

Once you are there, you can write shared libraries, abstract away whatever you want, have legit tests, and just do anything you would normally want in your coding environment (vscode, auto-formatters, source control, etc). Obviously not the right recommendation for a consumer system, but if you are like me and feel more comfortable with a programming language, it's the way to go.

Re:Run Your Home on a Raspberry Pi by rcarmo on Wednesday February 02, 2022 @04:37PM (#30184400)
I can do that with homebridge-mqtt (I just stopped doing it in Python because Node-RED did what I needed and gave me a dead easy chart for temperature sensors).
Re:Run Your Home on a Raspberry Pi by ornornor on Wednesday February 02, 2022 @03:07PM (#30183244)
Fully agree.

Interested about the tests though. I’m not a professional python developer but would love automated tests for my appdaemon code. How did you set it up, and how do you run the tests?

Re:Run Your Home on a Raspberry Pi by gregable on Saturday February 05, 2022 @06:56PM (#30227680)
I used https://pypi.org/project/appdaemon-testing/. You can write a simple test file which does things like sets a device state, then asserts that services were called or whatnot.

It doesn't test that the service calls are correctly written, just that they were made. So, very useful for unit testing syntax / logic, but not a full end-to-end integration test solution. Still, with python being an interpreted language, this is super useful. I don't want to have to wait for it actually to be sunset to determine I have a syntax error in that branch of the code, for example.

I don't actually have the tests running on the HA device. I have them on my desktop where I develop the appdaemon scripts, and then I copy only the scripts over to HA. I'm sure there are multiple ways to do it.

Re:Run Your Home on a Raspberry Pi by ornornor on Sunday February 06, 2022 @01:16AM (#30229959)
Thank you, that’s helpful.