Home » Blog » Automatic Presence Simulation in Home Assistant – How To / Tutorial

Automatic Presence Simulation in Home Assistant – How To / Tutorial

Hi! Wouldn’t it be nice if lights and switches in your house turn on and off automatically when you are away so that it seems that someone is still at home? You can do that with automatic presence simulation in Home Assistant. Let’s set this up!


⭐⭐⭐ NOTE: ⭐⭐⭐

This article accompanies a YouTube video. I wrote it for people who would rather read than watch a video. To keep doing this, I would like to ask you to check out the video, leave a comment under the video, give the video a thumbs up, and subscribe to my YouTube channel. This means that the video is offered more often to new visitors so that they also stay informed of the latest Home Assistant tutorials.

Thank you for your support!

Ed

Click here to watch the video

Introduction

This video has been on my list for a long time and I finally found the time to make it. One of the most powerful features of Home Assistant is that you can create automations to make Home Assistant perform tasks for you that you do not have to activate manually. And one of the powerful automations is to simulate presence in your house. To use this, you need to have HACS installed. You can visit this easy-to-follow video that explains how to install HACS in Home Assistant. Oh, and at the end of the video, I will show you the best unconventional presence simulation that doesn’t need any setup in Home Assistant ;).

How to Install the Presence Simulation Integration

The Presence Simulation Integration simulates the behavior of your lights and switches corresponding to how they behaved one or more days ago. So basically the lights and switches of your choice will turn on and off in the same way they did a couple of days ago. You can even add a random time so that the behavior differs slightly.

  • To install the Presence Simulation Integration, go to HACS and click on the Integrations tab.
  • Click on Explore And Download Repositories.
  • Search for Presence Simulation, and click on Presence Simulation.
  • Click Download.
  • Click Download again and wait until the Presence Simulation integration is installed.
  • Now restart Home Assistant by going to Settings and clicking on the three dots in the upper right corner.
  • Click Restart Home Assistant.
  • Click Restart Home Assistant again and wait for Home Assistant to restart.

Setting up a group of devices to simulate

Now that Home Assistant is restarted, we need to set up a group of devices that we want to simulate. There are multiple ways to do this, but the easiest way is to set up a light group using a helper. You might wonder why I choose a light group because you might think that you cannot add switches to a light group. But, surprise, you can add switches to a light group as well. It is possible to convert a switch to a light entity by using the “change device type of a switch” helper. To give you an example:

  • Go to Settings > Devices and Services.
  • Click on the Helpers Tab.
  • Click Create Helper.
  • Select “Change device type of a switch”.
  • and select a switch that you want to convert into a light entity.
  • In my case, it’s SW_PLUG_7.
  • Select the Light radio button and Click Submit.
  • When you open SW_PLUG-7 now, you’ll see that it turned into a light entity and you can add this plug to a light group as well.

So, let’s create the group that we want to use for our presence simulation.

  • Within the Helpers tab, click Create Helper.
  • Select Group.
  • Select Light Group.
  • Give your group a meaningful name like Presence Simulation Light Group.
  • Select the entities in the group which are the lights that you want to simulate.
  • Click Submit.

The light group that you are going to use in the Presence Simulation Integration is now created.

How to Set up the Presence Simulation Integration

Let’s set up the Presence Simulation integration.

  • For this, go to Settings > Devices and Services.
  • Click Add Integration.
  • Search for Presence Simulation.
  • Click Presence Simulation.
  • Enter the entity id of the group that you’ve just created. In this case, it’s light.presence_simulation_light_group.
  • You can enter a delta in days. By default, it’s 7 days, so the behavior of the lights in your light group will be the same as how they behaved a week ago.
  • You can also select a refresh interval. This determines how quickly the simulation notices that it has been requested to stop. The smaller the number you choose, the more computing process the component will take. So, leaving it to 30 seconds is fine for me.
  • If you tick the “Restore state after simulation” box, the states of your lights will be restored as they were before the start of this simulation.
  • And, you can choose to enter a random number of seconds. This random period is added (or substracted) from the time the entity was actually switched on or off in your historical data.
  • Click Submit.
  • Now restart Home Assistant.
  • After Home Assistant restarted, go to the integrations page again and open the Presence Simulation Integration.
  • You’ll see one entity. If you open the entity, you’ll see that it’s a switch. With this switch, you can toggle the Presence Simulation.

Your simulation is now set up!

Toggle Presence Simulation Automatically based on presence.

You can add the presence simulation switch to your Dashboard, but wouldn’t it be nice if the presence simulation was switched automatically based on whether someone is home or not? This way, you’ll never have to worry about turning on and off presence simulation. It’s actually very easy to set this up in Home Assistant.

Setting up the Automation

Now, let’s set up the automation that will automatically toggle presence simulation when everybody left the house or when someone arrives home. For this, we are going to check if someone is in the Home Zone.

  • Go to Settings > Automations and Scenes.
  • Click Create Automation.
  • Click Create New Automation.
  • In the Triggers part, click Create Trigger.
  • Select State.
  • Select the Home Zone in the entity field.
  • Enter zero in the to field. So, when there are 0 persons in your house, this trigger will be fired.
  • Go to the three dots in the upper right corner of the trigger.
  • Select Edit ID to add a Trigger ID. If you want to know more about trigger IDs, then please watch this video where I explain how they work.
  • Give your Trigger ID a meaningful name.
  • The trigger that should trigger when everybody left the house is now created.
  • We are now going to create a trigger that triggers when someone arrives home.
  • Click Add Trigger again.
  • Select Numeric State.
  • Select the Home Zone in the entity field.
  • Enter 0 in the above field. This way, this trigger will fire when someone arrives home.
  • We are going to give this trigger a trigger ID as well. It’s not really needed for the rest of the automation, but I think it’s good practice to always enter a trigger ID for a trigger.
  • Click on the three dots in the upper right corner of the trigger and select Edit ID.
  • Enter a meaningful name for the Trigger ID.
Adding the actions
  • Now go to the Actions area of the automation.
  • Click Add Action and select the If-then action.
  • Within “If” click on “Add Condition”.
  • Select Triggered By and select the Trigger ID Everybody Left that we’ve just created. So, when the trigger with Trigger ID “Everybody Left” is fired, the action with the “If” will be executed.
  • Click Add Action within “Then”.
  • Select Call Service.
  • Select “switch.turn_on” as the service.
  • Choose the entity switch.presence_simulation as the target. So, the switch for presence simulation will be turned on if everybody left the house.
  • Now click on “Add else”.
  • And click Add Action.
  • Select Call Service again.
  • Select switch.turn_off as the service.
  • And choose the entity switch.presence_simulation as the target. This way, the switch for presence simulation will be turned off if someone arrives home.
  • Click Save and give your automation a meaningful name.
  • Click Save.

Your automation is now set up and Presence Simulation will be toggled automatically when everybody left the house or when someone arrives home.

Downloading the Blueprint

You can type the code from the screen, or, if you buy me a coffee, you can save yourself some time by downloading the blueprint that I’ve created for this automation. The download link is in the description below.

Next to the switch, the presence simulation integration also creates some services to turn it on and off. You can view these services by going to the Developer Tools and going to the Services tab. Search for Presence Simulation and you’ll see the new services. You can choose target groups or devices using the services. These groups or devices will overrule the group that you’ve chosen by default in the integration.

The best presence simulation!

Oh, and I promised to show you the best unconventional Presence Simulation in Home Assistant that doesn’t need any additional setup… Are you ready for this? Here she is! My cat triggers all my motion sensors. You can’t get this behavior any more random than this!

I hope this Home Assistant presence simulation tutorial helped make your home more secure. If my videos help you and save you time, please consider becoming one of my sponsors just like these awesome people did. I need your help to keep this channel alive. You’ll find the links to sponsor me in the description below the video. And please do not forget to give this video a thumbs up and subscribe to my channel to make the channel grow. I’ll see you soon in my next video.

Bye Bye

home assistant, tutorial, automation, home automation, presence detection, presence simulation, simulation, security, home security


,

Back to all articles