Capture Device State and Return To Device State

I’m new to Home Assistant from Habitat and one of the most useful and powerful tools I used was to capture a device’s state in an automation. Example: A lights brightness and temperature. Then, after what needs to happen happens, being able to return to the devices state.

Example:

Capture lights state
Vibration triggers lights to rise in brightness, then drop in brightness, then rise again to set values
Return light to original state

It’s a simple example, but I use that example to let me know the cat is hitting it with his paw to come in.

Hopefully I’m not making an ass of myself and missed it in the automation menus. I have searched.

Scenes…

1 Like

Or more generic, trigger from state.
But in this case a scene is better

1 Like

There’s a reason for capturing a single device in an automation. Setting a scene for a single device is not efficient. Being able to grab that setting during an automation is. Also temp settings, and so on.

I know how scenes work, but thank you.

I figured that part - the link specifically pointed at the specific feature of HA’s specific implementation of scenes that are different that Hubitat or SmartThings where you can snapshot one or more devices into a temporary scene to hold a state programmatically… :wink: But - cool.

You must have done some research to come to that conclusion so how much overhead is there for creating a snapshot scene?

1 Like

So far, my research involves measuring the amount of time I’ve wasted looking for it. Perhaps my installation is broken.

I groaned at “You need to pass a scene_id in lowercase and with underscores instead of spaces,” then got tired of looking for snapshot_entities. I brought it up because I just want to be able to grab it from a drop down and use it and think others will find it useful.

I guess this thread is an example of why people give up on Home Assistant. Too many engineers and not enough people.

Based on your reply, your remark about inefficiency was merely speculation.

The more advanced aspects, of Home Assistant’s scripting, are not exposed in the Visual mode of the Automation/Script Editors to avoid overwhelming a novice user’s with a myriad of choices. In YAML mode, the editors support all scripting features but you have to read the documentation to know what they are.

Unless you are planning to give up, I doubt it drives people away. I’ve been a community member since 2018 and, despite various dire predictions about Home Assistant’s future unless it incorporates some mentioned feature, Home Assistant’s user-base has grown (significantly).

In your example, when should “Capture lights state” occur? In other words, what event should occur to initiate that first step?

My remark about inefficiency was based on time. This is something anyone can do in Hubitat from the top layer. I’m not learning to code YAML - I don’t have that kind of time… and it’s not an advanced thing unless it has to be coded. I guess that’s now my suggestion - make it simple to use in the automation’s top layer.

I’m not suggesting one feature would sink Home Assistant. I’m suggesting people’s attitude on this forum doesn’t help. First reply is one word and a link that doesn’t equal the suggestion, and I made it clear I’m new to HA - the implication being the suggestion is irrelevant because you can get on with YAML.

I know how successful HA is, but that doesn’t mean it’s not as successful as it could be. I saw the talk and how it has grown, but that doesn’t mean it couldn’t have grown more. I wonder how many of those downloads haven’t been touched after the first week of use.

I’m onboard for two reasons. First, I want to use some stuff Hubitat doesn’t support. I love my experience with Hubitat and use HA over the top of it. Hubitat runs all the basic automations that I need to run like clockwork and all of that stuff is through Zigbee, HA brings everything else together and I can do fun stuff with that. If HA becomes user-friendly and stable enough, I’ll likely port and Hubitat will become just a Zigbee/Z-Wave device. Right now, there’s a few big things I can’t do and my installation is inexplicably broken from, I think, an update and it’s in a realm outside my understanding. HE just works. For the record, I couldn’t be dealing with finding a Pi and all that, so I went ahead and picked up it up as a pre-made bundle on an Odroid N2. I also refuse to edit YAML. That’s just not for me. My coding days ended over a decade ago.

Chances are those running the shows are already thinking what I’m thinking: These are things that could reach a mass market outside of nerdy hobbyists. This stuff is the future, and a lot of people are super-aware now that putting your home in the hands of Google, Amazon, Apple, or Amazon is not ideal. HA bringing on user interface guy to help bring down the barrier to entry and developing voice control is as huge as everything being local. That’s why I want to use Apple Home until HA’s implementation does the basics easily and reliably and I can get it in every room. Except Hubitat’s implementation works and I can’t get HA’s to.

Anyway, I’m rambling. When should the Capture States occur? As an action.

For example, a translation of my cat doorbell example:

Trigger: Front Door Shock Sensor
Condition: between sunset and sunrise
Action 1: Capture State; Front Room TV Light 1, Front Room TV Light 2, Front Room Cabinet LED Strip, Kitchen Light Main, Garage Light Main
Action 2: Set Dimmer; Front Room TV Light 1, Front Room TV Light 2, Front Room Cabinet LED Strip; >50, Fade 3 Seconds.
Action 3: Restore State, Fade 3 Seconds
Action 4: Repeat Action 2
Action 5: Restore State

So, cat smacks the front door gate and the lights in rooms I might be in rise and drop in brightness twice as a notification - and I know to let him in because I’m his butler and he can’t be bothered to go around the back to the cat flap.

I also use it in a different slow flash pattern attached to a button in the bedroom as my wife is recovering from back surgery and if she’s in the bedroom and needs me it’s less intrusive than an audible notification but always gets my attention. You get the point, though, as use cases. Would useful for something like lowering the volume of TV/HiFi when the doorbell rings or a phone rings. Hi-Fi and TV is what I’ll likely do next as I have my IR remote hooked in to both.

I haven’t looked at Hubitat recently but I recall its automations can only be created via its UI (Rule Editor). Every single feature must be exposed via menus (at times they can be verbose because there’s a myriad of choices).

There was no “text version” of an automation so sharing an automation with others required posting screenshots of it. In other words, you couldn’t “copy-paste” someone’s automation, you had to reproduce it, step by step, from pictures.

Has this improved or is a screenshot still the only way to “share” an automation?

Actually, the first reply directed you to the exact feature that provides the ability to store/restore entity states. There was nothing in your first post that stipulated the feature you want must appear in the Automation Editor’s visual mode.

If you’re “new to HA” then reading the documentation is crucial. The link led you to the documentation. Later, you stated “I know how scenes work”. Your feature request gave the impression you weren’t aware of the ability to create/restore a snapshot scene so it’s natural to direct you to the scene documentation.

You replied to the initial reply by dismissing it as “not efficient” (without explanation) followed by an idea that although clear in your mind (expose the feature as a menu option) was expressed by a less clear “Being able to grab that setting during an automation is.”

Respectfully, this thread would’ve been a lot shorter had your first post simply requested to enhance the Automation Editor:

Please permit creating a snapshot scene in visual mode.

I don’t think there’s a text version of automations. Automations are super easy to set up to a point - easier to work out than HA, and the menu system allows you to do just about everything you need in a good logical flow. I would say it’s more powerful for people that don’t want to learn to code and they sell the hardware in one neat inexpensive box that lowers the barrier to entry. HA is more powerful overall, but the barrier to entry to be able to unlock that is higher. Much higher. If HA can bridge that gap, the skies the limit. If I was automating a house for rent or a client, it would be Hubitat for being a full easy package to use and updates never break anything. For a hobby, HA is surely king and has the potential to be the go-to - the open source set up is also an attractive flavor. - All this is just one average reasonable tech-savvy person’s opinion based on limited experience with HA and using Hubitat for around two years.

Yes, I could have been clearer. I’ll hold my hands up. I’ll also point out that “new to HA” should be obvious someone isn’t coding in YAML. Very few people will be entering HA already coding YAML or wanting to.

So there’s no easy way to share an automation other than by showing someone a picture of it.

Writing YAML is quite far from “coding” but I get your point. You’re steeped in Hubitat and expect the same experience in Home Assistant.

When I started with Home Assistant, I wasn’t at all familiar with YAML (and the Automation Editor was far less functional than its current self). After seeing the many examples of automations and scripts in the documentation and forum, expressed in YAML, it was clear that it would be advantageous to learn it.

No one is obliged to learn it but they’ll be at a disadvantage if they don’t. Doubly disadvantaged if they also avoid learning the Jinja2 templating language … but that’s a separate discussion.

1 Like

No there isn’t an easier way to share an automation as far as I know. Can’t say I’ve wanted or needed to, so I can’t say for sure without going and looking.

YAML is close enough. I’m not “steeped in Hubitat,” I’m the end user the HA menu system is aimed at. I want to use YAML as much as I want to use a markup language for my day job - I want to get on with writing not dick around. I mean, damn… I learned BASIC way back in the day so I could program games from magazines and find and fix errors, then HTML and markup later so I could build a website for my business. I wouldn’t dream of learning a code or language now to do either. I understand why people love that stuff, and all power to them, but… nope.

The aim here, for me anyway, is to automate stuff and run the house, not turn it into a time consuming hobby for a hobby’s sake. I’ll equate it with something else I like which is listening to music. If I spend all my time worrying about the system, I’m not listening to and enjoying the music.

That’s kind of one of my HA tests. Either it will grow to suit that more and more, or it won’t and it’s not for me. Right now, from my looking into it over the past however long, I see its evolution as becoming more and more for the end user. Things like it auto-detecting stuff, HACS, the dashboards, and starting to have its own voice assistant capability is gold. But things like having to figure out why my installations SSDP is broken is a pain point. I guess the real difference is HA is more comprehensive and open source, but still in early adoption stage (when you consider its usability for the end user) while Hubitat just always works. I love the idea of HA, hence I’m here.

Gosh… if you just spent your time reading how yaml works then you would have been done about halfway through typing your posts.
Yes really.

You get a lot of help from HA and the little things you need to type manually is generally less than the description/name of the automation.

2 Likes

Way to miss the point and prove another.

… because clearly you are right and all (estimated) 500.000 users are wrong.
Yes.

Every now and then there are people coming here and saying yaml is too hard and impossible to learn and all that.
We have seen and heard it before.
As Taras pointed out, there are far to many options to be able to make clickable menus for it.
Making clickable options just limits the potential.
Adding more limits to the system makes people ask for more clickable options which is hard work to add and makes it less user friendly.
It’s just a negative spiral.

What the GUI offers if good enough for most automations, if you want to go more advanced then learn how to make advanced automation (i.e. yaml/jinja/templates).

I see the core of this feature request as bad for HA since you want to add more clickable options that is not needed.
You want to learn how to drive a car but not sit in the car.

[quote=“Hellis81, post:17, topic:491620”]
because clearly you are right and all (estimated) 500.000 users are wrong.
Yes.[/quote]

Imagine how many people it would be if it wasn’t for the self appointed gatekeepers such as yourself.

Every now and then there are people coming here and saying yaml is too hard and impossible to learn and all that.

There’s a clue there.

We have seen and heard it before.

Look! Another clue!

Making clickable options just limits the potential.

Then should tell Nabu Casa to fire the UI guy they just took on then.

and makes it less user friendly.

I do hope I can get my eyes to roll back again.

What the GUI offers if good enough for most automations, if you want to go more advanced then learn how to make advanced automation (i.e. yaml/jinja/templates).

Who appointed you gatekeeper?

I see the core of this feature request as bad for HA since you want to add more clickable options that is not needed.

You mean that you don’t need.

You want to learn how to drive a car but not sit in the car.

No, I just want to be able to capture/snapshot states from the UI and think it would likely benefit others that don’t want to use YAML or just knock up automations.

2 Likes

During the last few years there has been a handful of people that insist that yaml is too hard, everyone else has just learned or asked for help until they learned.

So yes we could have had 500.005 users, dang what a missed opportunity.

1 Like

I’m just going to assume your trolling now. I like to think nobody is that ignorant without choosing to be. Perhaps you’re lazy and didn’t read the words and have low reading comprehension skill because it was you that brought up finding things too hard, not me. Either way, though, well done – Home Assistant just lost another user. I don’t have time for a community that treats newcomers with contempt.