Hey folks - I’ve setup HA after a year or two away when I moved. I’m using HA Core + Docker (so I don’t have the easiest access to integrations, but I’m open to shifting if there is a good case to do so).
I know the team made a ton of progress on automation. What’s the current best practice for creating a simple state machine who’s state is displayed in the interface? I know Home-Red but dearly hoping I don’t need to spin it up given all the progress we’ve had on HA.
I’m chasing the old hobbyhorse of “dishwasher state” with a simple vibration sensor (it has good sensitivity and resets “Detected” to “Clear” every ~5 seconds):
10+ minutes of vibration triggered = “Running” state
No vibration for 10 min after Running state = “Done” state
First short vibration after Done state= “Opened/Unloaded” state
Any vibrations atleast 4 hours after Opened/Unloaded state = “To be run” state
create the input select helper then write the automation: yes
state diagram tool: no
something to help: yes - community.home-assistant.io - you should check it out
Drat I was hoping HA had some of these basics covered!
Do you have a recommended state diagram-ish tool or best practice? Obviously I’ve checked the community, and there isn’t a best practice easily found. Everybody does it a different way
Why do we insist on reinvention of the wheel? Ah well.
i’d just do it in direct automation. it’s not at all hard.
i don’t think there’s an issue of reinvestion of the wheel, it’s more a question of prioritization… of all the things that the team could work on, is this the best leveraged? i’d argue “no”.
but hang on a sec, and i’ll throw a sample together for you…
these can easily be combined into 1, but i’m doing them separately in part because it shows how directly and easily the description you put above translates to the code:
You mentioned this can be combined into one automation - what’s the best way to do that? (Don’t need a full example, just a pointer so I can dig into the docs).
doing the 4th is a very simple pattern match from the rest… i’m leaving it as an exercise for you because it’s simple and if you’re gonna be in this ha world, you shouldn’t be afraid of such simple automations…
or maybe someone else will come along and just hand you the last fish… but i hope that handing you 3 and having you figure out how to do the 4th is the best thing…
i’d recommend you do the 4th and have it all working before you try to combined.
but the way to combine them is to do a trigger id. to have all the triggers together (an automation can have many different triggers)… assign an id for each trigger. then do the corresponding thing depending on which trigger is fired. it’s not really any better than doing 4 different atomic automations like this. but some people like to have just 1… even if it’s more complex.
again, if this is your first go writing automation, i’d strongly encourage you to get the 4 working independently, then work to combine them if you want…
Thanks - I did a bunch of these a few years ago, but syntax etc. often changes. Super helpful! I have it up and running. Def want to integrate into once automation though. Will play with this trigger id thing.
This didn’t exist the last time I fooled w HA! Appriciate it.
Man … we really need a good written guide to best practices for common HA tasks. Wild that it’s all somewhere deep in various forum discussions (of varying ages!)
however the reality is that ha is soo flexible that there are a ton of common ha tasks. many of them are consolidated into blueprints (e.g. motion detection)…