4 ms·
I am in the same situation as you. I also have a tolerant wife that "understands" that the lights are available 90% of the time (but when they are, it is magic)
by BrandoElFollito 6y ago
I am in the same situation as you. I also have a tolerant wife that "understands" that the lights are available 90% of the time (but when they are, it is magic).
Have you considered AppDaemon for automations? https://appdaemon.readthedocs.io https://appdaemon.readthedocs.io
I tried to use the YAML based solutions but YAML is not done for that and anything more complicated is not doable (or at least without a super-complex code) - this is usually a few line sin Python in AD.
I would love to be able to use the presence automations but my wife ad children, for reasons that are beyond my understanding, sometimes switch off the wifi to use their data plan. The GPS tracking was draining the battery too much last time I tried (but I have to try again).
- Dumbdo 6y agoAlternatively Homeassistant also offers an integration for Node Red, which feels a bit odd to work with at first but I learned to love it more and more. I never really bothered to learn Homeassistants YAML automation syntax. https://nodered.org/ https://nodered.org/
- OJFord 6y agoI wish NodeRed had a YAML (or whatever) syntax though, something git-friendly; that it was a viewer/editor for a sane human-readable text format. (As I recall, it's JSON with lots of long numeric IDs for each node, semantic data also mixed with presentational - coordinates for how you laid it out in the visual editor, etc.)
- BrandoElFollito 6y agoYes, this is also why I got rid of it when giving a try. This is not maintainable outside of the GUI
- theshrike79 6y agoNodeRED keeps its stuff in a single directory, which can be backed up easily. Also the state can be fully restored with just the contents of that directory. It's not git-friendly though, no easy way of versioning stuff really.
- spdustin 6y agoIf you enable Node-RED "Projects" [0], you not only get git-friendly flow configs, but can have them automatically push to remote repos. [0]: https://nodered.org/docs/user-guide/projects/ https://nodered.org/docs/user-guide/projects/
- OJFord 6y agoYou got me excited for a second, but that seems just to be a UI for people that don't know what 'a git' is, and `commit -a`-ing of changes, in the same non-'git-friendly sane human-readable plaintext format' I was complaining about. I know what git is, so I can already `git commit -a -m 'Updated nodes'` if that's what I wanted, but it isn't, I want logical diffs that show me what I did and why; not spurious ID changes because I accidentally moved a node visually a millimetre or two.
- spdustin 6y agoIt does give you a better diff option, actually. :) It may not meet your needs, but it will show you a diff between commits that is more context-aware for Node-RED.
- input_sh 6y agoI can't come up with any automations related to my home that are difficult to do in YAML. I'm more interested in getting rid of IFTTT/Zapier/way-too-messy-Python-scripts, but that'll probably wait until winter holidays.
- BrandoElFollito 6y agoMy typical automation that is cumbersome with YAML is with RF433 switches. I have plenty of wall switches (say - 20) that emit a signal AAAAAABBBBBB, I am only interested in the BBBBB part, and then I need to match this with an action. Sometimes (usually) this is a toggle, sometimes a on, sometimes an off, sometimes something else. This is easy to do in Python (the list if kept as a dict with actions, there are three lines, one for each action), but gets very verbose with YAML.
- alach11 6y agoCould you use the combination of wifi and GPS. If the device leaves wifi, check GPS in 5 minutes.
- piquadrat 6y agoThere's also PyScript, a custom component that allows you to write automations in Python. The docs have a bunch of nice examples that give you an idea how it looks. https://github.com/custom-components/pyscript https://github.com/custom-components/pyscript https://hacs-pyscript.readthedocs.io/en/stable/tutorial.html#an-example-using-triggers https://hacs-pyscript.readthedocs.io/en/stable/tutorial.html...
- BrandoElFollito 6y agoExcellent timing, thanks! I am looking at possibly replacing AppDaemon as we speak. This is a great software, bit it is really distinct from HA and simple automations require quite a bit of code anyway. I was thinking about having a mixed mode: the very simple automations (covers up at 9:00) would go into the YAML and more complicated would use the Python scripting described here: https://www.home-assistant.io/integrations/python_script/ https://www.home-assistant.io/integrations/python_script/ (also from automations, but the real work would be done in the script) Now I see with your comment that there is a HACS component as well - have you compared both and chose one of them for some specific reason?
- BrandoElFollito 6y agoOK, following up on my last comment - pyscript is teh way to go. One can import anything and the functions are very light, decorated etc. It looks like a very good solution for more complicated automation (and for simple ones as well, it is just two lines)
- piquadrat 6y agoExactly, that's what I like about pyscript: it is a great alternative for simple YAML automations, but it also allows for complex logic that would be impossible or very cumbersome with YAML.