Add Mockupancy routines.
Add routines to simulate occupancy when we are away.
- Vacation mode and mocupancy scenes to simulate being here.
- alias: 'Get Random Time'
trigger:
platform: time
after: '21:00:00'
action:
- service: input_slider.select_value
data_template:
entity_id: input_slider.hour
value: '{{ (range(22, 23) | random) }}'
- service: input_slider.select_value
data_template:
entity_id: input_slider.random_minute
value: '{{ (range(30, 45) | random) }}'
Then simply use that in your light turn off automation:
- alias: 'Turn lights off'
trigger:
platform: template
value_template: '{{ now.hour == (states.input_slider.random_hour.state | int) and now.minute == (states.input_slider.random_minute.state | int) }}'
action:
- service: light.turn_off
data:
entity_id: light.hue_color_lamp_1
- alias: AUTO ON (MOTION) Downstairs Bathroom Light
trigger:
platform: state
entity_id: sensor.aeotec_zw100_multisensor_6_burglar_24_10
from: '0'
to: '8'
action:
service: scene.turn_on
data_template:
entity_id: >
{% set hour=states("sensor.time").split(':')[0] | int %}
{%- if hour >= 19 or hour < 6 -%}
scene.downstairs_bathroom_late_night
{%- elif hour >= 6 or hour <9 -%}
scene.downstairs_bathroom_early_morning
{%- else -%}
scene.downstairs_bathroom_mid_day
{%- endif %}
#96 - Random Dog Barks.
If not around for 18 hours, trigger Vacation Mode.. (Moccupancy routines.)
Check out - https://github.com/mertenats/Open-Home-Automation/blob/master/openhome/configuration/home_assistant/automation/automation_4a.yaml
Even more great ideas from @eliseomartelli
https://github.com/eliseomartelli/ParentsHomeAutomation/blob/master/homeassistant/automations/automation.casa_simulazione_presenza.yaml
{{states.group.all_lights.attributes.entity_id | random }}
I think I would create a new group in the package called group.mockupancy with appropriate lights and then just shut down the whole group after a random amount of time.
Love the idea of using an Event to call the routine at the end of the routine for a great loop.
Found in https://github.com/kylegordon/home-assistant-config/issues/1
https://github.com/mertenats/Open-Home-Automation/blob/master/openhome/configuration/home_assistant/automation/automation_4a.yaml
alias: Simulate presence (4a)'
trigger:
- platform: state
entity_id: group.all_devices
from: 'home'
to: 'not_home'
- platform: sun
event: sunset
- platform: event
event_type: event_simulate_presence
condition:
condition: and
conditions:
- condition: state
entity_id: 'sun.sun'
state: 'below_horizon'
- condition: time
before: '23:01:00'
- condition: state
entity_id: group.all_devices
state: 'not_home'
action:
# https://home-assistant.io/cookbook/perform_actions_based_on_input_select/
# https://home-assistant.io/getting-started/scripts/
- service: light.turn_on
data_template:
entity_id: >
light.lamp_{{ (range(1, 6) | random) }}
# wait some seconds (will be in reality in minutes)
- delay: '00:{{ (range(2, 10) | random) }}:00'
# turn off all devices
- service: light.turn_off
# wait a little bit before turning on another lamp
- delay: '00:00:{{ (range(1, 5) | random) }}'
# generate an event to call again this automation rule
- event: event_simulate_presence
GitHub
Open Home Automation with Home Assistant, ESP8266/ESP32 and MQTT - mertenats/Open-Home-Automation
Nice find! This is going to help with my washing machine is complete reminder.
https://github.com/CCOSTAN/Home-AssistantConfig/issues/892 - If vacation mode is enabled, Put Water Heater in Vacation Mode as well.
Looks like there is a HACS component for this.
https://github.com/slashback100/presence_simulation
GitHub
Home Assistant Presence Simulation. Contribute to slashback100/presence_simulation development by creating an account on GitHub.