Primitive alarm function - step one

I have a motion detector on the back of my house, which I want to, if triggered when the house is empty, to activate a number of lights and other entities, and then turn them back off, after 10 minutes.

I have grouped our device trackers:
And grouped the entities that I want to activate and de-activate:
And created an Input Boolean:
Which I believe that I have turned in to a “virtuel switch”:
And finally made these automations:
But, it seems like it isn’t working. Any ideas?

I know that I am probably over complicating it, but I am trying to keep the different things separate, to make sure that I can follow it.

The first automation is missing “condition:” But this should throw errors! Those errors should point you to what is wrong.

Thanks Pippyn, I caught the “condition” part, right after I posted. :slight_smile:

so it’s working now? or do you still have errors?

I’m not sure your “virtual switch” is right tbh. I’ve never seen multiple services for turn_on or turn_off.

Thx. I will give the switch one more look. I “stole it” from this guy:

Didn’t know you could do it like this.
But looking at your code in the same first automation is also;

 - condition: state

This doesn’t do anything and should also throw an error.
Btw what does the shell_command do?
Tbh I think you’re really overcomplicating this.

For people to more easily help you with the code it would best to actually paste the code into the forum as text as opposed to using a picture of an editor window. And make sure you properly format the code by using the instructions from the top of the page.

I don’t mind helping out but I don’t want to have to type everything out based on a picture you posted. it’s much more convenient to copy/paste/edit.

Thank you very much Finity. That is a good point. I was not aware of that.
I will post the code directly, when I get back home tomorrow, if it still does not work.

Thank you!!!

1 Like