Home Assistant Presence Simulation

slashback100, updated 🕥 2023-03-20 13:35:32

Please :star: this repo if you find it useful

Presence Simulation


This Home Assistant component aim to provide a presence simulation in your home while you are away. It will turn on & off lights, switches, covers... based on your history.

How it works

It will look in the DB for the states history of all the entities configured in the component for a period corresponding to a delta variable defined in the component. It will apply to the entites the same state (and some attributes like brightness and rgb_color) as it was delta days ago, in order to simulate your presence. If the service is running longer than the number of days defined as the delta, the component will simply be reset and start over, until the stop service is called.

Supported entities domains: - light - cover - media_player - All domains for which entities have status on or off than can be turned on/off with service homeassistant.turn_on and homeassistant.turn_off (automation, switch, group...).


The history integration must be activated - which it is by default. The period kept in the DB should be bigger than the delta used in the simulation. The default number of days kept is 10 and this can be configured with the recorder integration.


Option 1

  • In your Home Assistant configuration directory (~/.homeassistant for instance), create a directory custom_components/presence_simulation and put the code in it.
  • Restart Home Assistant

Option 2

  • Go in your Home Assistant configuration directory (~/.homeassistant for instance)
  • git clone https://github.com/slashback100/presence_simulation.git. It will create the directory custom_components/presence_simulation
  • Restart Home Assistant

Option 3 (recommended)

  • Have HACS installed, this will allow you to easily manage and track updates.
  • Search for "Presence Simulation".
  • Click Install below the found integration.
  • Restart Home Assistant

NB: it can also be added as a custom repository if you have an issue with above procedure


  • In the UI, go in Configuration > Integration
  • Click on the '+' button
  • Search for "Presence Simulation"
  • Confirm:

accessibility text

  • Set the group of entities to be used in the simulation. It can be a group of lights, switches, covers, light groups, media_player or of any component that can be turned on and off with the service homeassistant.turn_on and homeassistant.turn_off. You can also setup several entities, separated with ','
  • Set the number of days of history the simulation will use (the delta)
  • Set the poll interval in seconds that determines how quickly the simulation notices that it has been requested to stop. Default is 30 seconds. Warning, the smaller the number you choose, the more computing process the component will take.
  • After the simulation, choose to restore the states as they were before the start of ths simulation
  • You can choose to randomize the activation/deactivation of your entities. '0' to disable this behaviour, or a period in seconds for the maximum of seconds the random switching will be done. This random period is added (or substracted) from the time the entity was actually switched on or off in your historical data.

You can edit these configurations afterwards by clicking on Options in the integration screen.

Use it

The component will create an entity called switch.presence_simulation. This entity will be set to on when the simulation is running. off otherwise. You have 2 ways of launching the simulation:

With the switch

Toggling the switch.presence_simulation will toggle the presence simulation.

With the services

Three services are available:

Start the simulation

The service presence_simulation.start will start the simulation and set the switch.presence_simulation entity to on. Optionally, you can reference a list of entities, a delta or choose to restore the states if you want to override the component configuration: entity_id: - group.outside_lights - light.living_room - light.hall delta: 5 restore_states: True random: 300

Stop the simulation

The service presence_simulation.stop will stop the simulation and set the switch.presence_simulation entity to off.

Toggle the simulation

The service presence_simulation.toggle will start or stop the simulation, depending on the current state of the switch.presence_simulation entity.

Buy me a coffee

Liked some of my work? Buy me a coffee (or more likely a beer)

Buy Me A Coffee


Simulate weekend days on public holidays

opened on 2023-02-09 12:12:17 by wigster

This is a bit of an edge case, but...

Frequently we're away from home for an extended period when there is a public holiday during the vacation. It's a bit strange when e.g. on Xmas day which happens to be a Wednesday the lights follow a standard Wednesday schedule instead of a weekend one.

For this sort of thing I am using the binary sensors from the workday platform, where you can have a sensor saying that in your jurisdiction you have a holiday today or there will be one tomorrow.

It would be great if the presence simulator had an option to simulate particular days of the week depending on the status of whether today is a holiday or tomorrow is a holiday -- usually some combination of last week's Friday/Saturday/Sunday.

Question: Possible to add more details to the logbook?

opened on 2023-01-13 15:42:41 by h4nnes

Hi, is it possible to add more details to the logbook when e.g. a light gets turned on by the simulation? Sometime I'm wondering why my light was on and nobody was at home and then I realize that the simulation was on ^^


Add robustness in functionality of keeping state after restart 2023-03-13 16:57:58

Preserve lights' color & temperature 2023-02-11 10:14:56

  • Fix #75
  • Fix #76

Fix #77 2023-02-08 10:38:51

Several entities possible + Polish translations 2022-07-04 08:53:36

Add possibility to configure several entities in the default configuration (#62) Add Polish translations

Version compatible with HA < 2022.7 and >=2022.7.* 2022-07-01 12:14:28

v1.18 Fix #57 to keep running if invalid entities are found 2022-06-10 14:54:56

GitHub Repository

homeassistant-components homeassistant historic presence-simulation hacs home-assistant home-automation presence simulation