3 ms·
HA is _very_ good for integrating stuff, mostly due to it being the de facto standard for DIY home automation. Basically if something has any kind of API that c
by theshrike79 3y ago
HA is _very_ good for integrating stuff, mostly due to it being the de facto standard for DIY home automation. Basically if something has any kind of API that can be accessed in any way, someone has already made a HA integration for it.
On the other hand, it's absolutely crap at doing complex automations. The Web UI gives me heartburn any time I need to make it do anything else than simple "if temperature is over 40 on this, do this" things.
The UI does make complex automations _possible_ for non-programmers. But for me, every time I click on the UI or attempt to "program" using the convoluted YAML syntax I keep thinking "this would've been like 5 lines in an actual language...".
Thus: I use Node RED for the more complex stuff paired with an external program I made that connects to the HA Mosquitto server and pokes stuff directly when needed.
- katbyte 3y agoYea I kinda wish you could just write code for it. I’d even accept writing it in python as that’s what ya is written in (as I too don’t like python)
- dingledork69 3y agoPyscript adds rich Python scripting to HASS : https://github.com/custom-components/pyscript https://github.com/custom-components/pyscript An example script: @state_trigger("security.rear_motion == '1' or security.side_motion == '1'") @time_active("range(sunset - 20min, sunrise + 20min)") def motion_light_rear(): """Turn on rear light for 5 minutes when there is motion and it's dark""" task.unique("motion_light_rear") log.info(f"triggered; turning on the light") if light.outside_rear != "on": light.turn_on(entity_id="light.outside_rear", brightness=255) task.sleep(300) light.turn_off(entity_id="light.outside_rear") It's what made me ditch node red after going down the same path.
- Denvercoder9 3y agoThere's also NetDaemon for those who prefer C#: https://netdaemon.xyz/ https://netdaemon.xyz/
- Larrikin 3y agoCan anyone comment on whether Pyscript vs AppDaemon is the better path? It felt like to me as someone that codes as a living PyScript was the better choice, but I also only ever used Python in college and grad school, and just haven't had the time to investigate a difference between the two and wanted to just get started. Using PyScript seems easy but it also feels like its just the main authors preferred way of working and is pretty buggy outside of how he likes to work in Jupyter notebooks The Home Assistant community seems to have the entire gambit of people who can't code at all, the people who never coded professionally and make riduclously complex things like the fabled Excel accountants, to the professional developers doing stuff for fun, but nobody actually shares anything worthwhile outside of awful YAML and youtubes about awful YAML.
- mrmlz 3y agoI'm currently using AppDaemon for a couple of webparsing-scripts. That has worked just fine without touching it for... well over a year by now. But i have a nagging feeling that i should probably use PyScript instead.. If anyone has a more thorough analysis i'm open to hear it..
- dingledork69 3y agoFor what it's worth, I don't use the Jupyter notebooks. Just have a folder somewhere with python scripts that get reloaded as I edit them.
- Larrikin 3y agoI've found that it just feels like I'm fighting a river to go up stream if I don't incorporate the web browser + Jupyter work flow that the author likes. Auto complete for discovery just refuses to work in PyCharm and VSCode for me. The way PyScript is setup seems to be a strange bespoke system that kind of breaks the import system between files, type safety only sort of works sometimes, and just other quirks where I seem to just have to get used to all of the red underlines if I want to use an IDE as part of my development process. But it still seems to be best option for allowing me to use any libraries in the ecosystem, gets rid of boilerplate, and the author is actively maintaining it. I didn't really find any other viable options outside of Python that would let me actually code my automations without yaml or a GUI. I was very excited when I found a Kotlin implementation, KHome, but by the time I found it, it was already a seemingly dead project.
- OJFord 3y agoWhere is that stored? My beef with NodeRed was that it's not very git/manual-change/file friendly - random IDs and minor change in UI causing a large on-disk shuffle. Even if I use a UI for making a modification sometimes, I want to be able to commit a clean diff like: sensorLightBackdoor: - timeActive: range(sunset - 20min, sunrise + 20min) + timeActive: range(sunset, sunrise) Or whatever. Which obviously I can do with python, as long as it's stored neatly in config in a .py file, or even if embedded in HA yaml or something?
- dingledork69 3y ago> Where is that stored In a `pyscript/*.py` file, so you can open it with a full blown IDE and use all your usual comforts, and commit the results to git.
- OJFord 3y agoAwesome, thanks, this may be the push I needed back into HomeAssistant. :)