Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Mockupancy routines. #3

Open
CCOSTAN opened this issue Jan 20, 2017 · 12 comments
Open

Add Mockupancy routines. #3

CCOSTAN opened this issue Jan 20, 2017 · 12 comments

Comments

@CCOSTAN
Copy link
Owner

CCOSTAN commented Jan 20, 2017

Add routines to simulate occupancy when we are away.

@CCOSTAN
Copy link
Owner Author

CCOSTAN commented Jan 20, 2017

  • Vacation mode and mocupancy scenes to simulate being here.

@CCOSTAN
Copy link
Owner Author

CCOSTAN commented Jan 20, 2017

- 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

@CCOSTAN
Copy link
Owner Author

CCOSTAN commented Feb 3, 2017

- 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 %}

@CCOSTAN
Copy link
Owner Author

CCOSTAN commented Mar 3, 2017

#96 - Random Dog Barks.

@CCOSTAN
Copy link
Owner Author

CCOSTAN commented Apr 4, 2017

If not around for 18 hours, trigger Vacation Mode.. (Moccupancy routines.)

@CCOSTAN
Copy link
Owner Author

CCOSTAN commented Aug 31, 2019

@CCOSTAN
Copy link
Owner Author

CCOSTAN commented Aug 31, 2019

{{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.

@CCOSTAN
Copy link
Owner Author

CCOSTAN commented Apr 28, 2020

Love the idea of using an Event to call the routine at the end of the routine for a great loop.

Found in kylegordon/home-assistant-config#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

@thejeffreystone
Copy link
Contributor

Nice find! This is going to help with my washing machine is complete reminder.

Repository owner deleted a comment from stale bot May 29, 2020
CCOSTAN pushed a commit that referenced this issue May 29, 2020
@CCOSTAN
Copy link
Owner Author

CCOSTAN commented Oct 5, 2020

#892 - If vacation mode is enabled, Put Water Heater in Vacation Mode as well.

@CCOSTAN
Copy link
Owner Author

CCOSTAN commented Oct 7, 2021

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants