Newbie question: return lights to previous state

I have a few RGBWW lights and created some scenes. I also have a ring doorbell. If someone rings the bell, I want the light to flash red for a few seconds, and then return to their previous state/color. How can I do this?

hehe, I’m actually doing the same with a new Ring doorbell … and had the same question…

the way I do it is to have a ‘normal state’ scene ( normally lights off, etc ). when the bell rings, I activate the alert scene, after 1’ I go back to the ‘normal state’ scene.

hope this helps!

Thats how I do it now, but frankly thats not good enough, especially since I want to use this also in places that dont really have a “default”, like my mancave or even bathroom. Given the complexity and abilities of this platform, surely this would be a trivial task. I just dont know how :slight_smile:

THere is a python script written by another member here (@pnbruckner) that should do what you want. You can find it here:

https://github.com/pnbruckner/homeassistant-config/blob/c65f9051ac657477fdec89360dd7ce29a126e71e/docs/light_store.md

Thanks, Ill look in to that. But man, Im getting the feeling HA is not for me. I spent the better part of a week reading, learning, watching youtube clips, writing pages of yaml code, flashing firmwares to my bulbs, just to be able to toggle lights on and off and almost everything beyond that seems impossible or even harder. I mean, things like slow fading lights, flashing lights on alert, or this, seems so frigging basic given the hoops you have to jump through. Or being able to see which light scene is currently selected in lovelace. Everything is a struggle and you need a PhD to get it working. Im not a real coder, but think if I coded some spaghetti code in python from scratch, using just tasmota rules and URL commands, with perhaps a a few IFTTT webhooks, Id have it done so much faster.

You have the wrong sort of lights :slight_smile:

These are all easily do-able just by calling effects for Lifx lights.

e.g. a script I call from my doorbell alert automation:

flash_lights_purple:
  sequence:
  - condition: state
    entity_id: alarm_control_panel.house
    state: disarmed
  - service: light.lifx_effect_pulse
    data:
      entity_id:
      - light.lifx_mstr_bed_1
      - light.lifx_lounge_middle_left
      - light.lifx_lounge_middle_right
      - light.lifx_kitchen_1
      - light.lifx_kitchen_4
      - light.lifx_bar_1
      - light.lifx_cinema_1
      - light.lifx_hallway
      - light.lifx_ensuite
      rgb_color: [255,0,255]
      period: 1
      cycles: 2
      mode: blink
1 Like

If I have the wrong lights, the wrong doorbell, the wrong security camera, the wrong thermostat… makes you wonder.

Thing is though, I flashed my lights with an opensource firmware that I mistakenly believed would allow me to do just about anything I want.

As for your lifx script; does that revert to its previous state? If not, its no help and why would I spend 43 euro on a RGBWW bulb when I bought my Teckins for ~8 ?

well you’ve received 2 solutions to your quest already.

Both are completely valid ways of doing so, and helping you do the other things you want also.

I would add the possibility of scenes. compose 2 scenes, and call these based on the automatic scheme you describe and you’re set.

So many possibilities in this ‘complex’ environment, you’ve got to pick the one thats suits you best. No such thing as an easy solution for everything, because everyone needs something else.

Which is almost always possible in HomeAssistant… needs some investigating though. And stamina sometimes.

does that revert to its previous state

At the end of the effect, yes it does.

And my comment was kind of facetious. I don’t expect you to replace all your devices.

You could look into ESPhome as a replacement firmware for Tasmota on your lights though. It has a few effects that should do flashing and revert to original state.

Scenes isnt a solution. My living room has 3 scenes, an ambient, bright and movie scene. When an alert triggers a flash, how does my script know what scene to revert to?

finity’s solution should work, but I cant seem to get any custom components to work. Ill figure it out eventually, but I dont understand this is not possible “out of the box”. Surely everyone who has light switches and sensors or other other triggers has this issue? If you trigger a light on movement for a few minutes, what do you do when that timer expires, just turn it off hoping no one manually turned it on?

scenes are a solution. A scene describes an entity, or several entities in a certain state. see https://www.home-assistant.io/integrations/scene/

a room doesn’t have a scene…unless you call these scene.livingroom_ambient, scene.livingroom_bright and scene.livingroom_movie which would be my suggestion. In each scene you set the entities and their desired state.

you described the logic in your first post, so write that into an automation and call the scenes appropriately.

What about setting a scene as a kind of temp variable in the automation, then action the flashing or whatever, then set the temp scene back. Sorry that is badly explained - in pseudo code:

trigger:
   doorbell rings
action:
    scene.create 
        data:
            scene_id: temp
            light.lounge
               state: template to copy current state
               brightness: template to copy current brightness
    do flashing stuff
    scene.turn_on:
        scene_id scene.temp
2 Likes

But I set those scenes manually, depending on if Im watching a movie, or talking to friends in the living room, or not being in the living room or whatever. So again, how would HA know which scene to revert to?

nickrout

Aaaah… Ok, yes, I think that is exactly what I need. Thanks! And sorry Marius, seems like scenes are indeed the solution, I just didnt realize you could create them on the fly based on current states.

I am not 100% sure that you can use a template though, it might fail there, and my code is not fully baked, in fact the oven is not up to temperature and I need to read three more recipes before it is going to even look like baking…

why do things manually if you can automate them. Thats what Home-assistant is for…

still if you must set it manually, you can have an input_select set to that scene, and the automation can then check that input_select, and decide what scene to revert to later the flashings done.

input_select.scene with options Movie, Ambient, bright.

have the automation set the scene again with a template:

service: scene.turn_on
data_template: >
  entity_id: scene.livingroom_{{states('input_select.scene')|lower}}

of the top of my head, probably needs finetuning but you get the drift.

1 Like

Do you have a camera in your living room and run tensor flow to detect if you are reading a book and adjust the light accordingly, or do you just flip a switch or ask alexa/almond/google to set the lights?

Thanks. That goes straight over my head for now, I just dont get templates yet, but glancing over the documentation of input_select, it sounds like a global variable and it may be a solution also for other things I had been looking for, like various for climate control “states”(home/[email protected]/away/vacation/… ). Il do some more reading…

that would be a great idea :wink:

1 Like

That works if you only want your lights in a certain scene.

If you have carefully crafted the lights manually for the moment, but because it is just for this place and time, then the doorbell goes, you lost your settings.

correct, I merely reflected on OP’s description of his scenes for the livingroom.

I like the new option for creating scenes in the fly, which can be very useful for these sudden situations indeed

I can live with that limitation for now. Doing some more googling, it appears your “template on the fly” solution, while it sounds like a good and obvious solution, will not work:

Unless something changed between then and now, but the github issue is still open, so I guess not.