CCOSTAN / Home-AssistantConfig

:house: Home Assistant configuration & Documentation for my Smart House. Write-ups, videos, part lists, and links throughout. Be sure to :star: it. Updated FREQUENTLY!
https://www.vCloudInfo.com
Other
4.78k stars 509 forks source link

Add Mockupancy routines. #3

Open CCOSTAN opened 7 years ago

CCOSTAN commented 7 years ago

Add routines to simulate occupancy when we are away.

CCOSTAN commented 7 years ago
CCOSTAN commented 7 years ago
- 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 commented 7 years ago

- 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 commented 7 years ago

96 - Random Dog Barks.

CCOSTAN commented 7 years ago

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

CCOSTAN commented 6 years ago

Check out - https://github.com/mertenats/Open-Home-Automation/blob/master/openhome/configuration/home_assistant/automation/automation_4a.yaml

CCOSTAN commented 5 years ago

Even more great ideas from @eliseomartelli

https://github.com/eliseomartelli/ParentsHomeAutomation/blob/master/homeassistant/automations/automation.casa_simulazione_presenza.yaml

CCOSTAN commented 5 years ago

{{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 commented 4 years ago

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
mertenats/Open-Home-Automation
Open Home Automation with Home Assistant, ESP8266/ESP32 and MQTT - mertenats/Open-Home-Automation
thejeffreystone commented 4 years ago

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

CCOSTAN commented 3 years ago

https://github.com/CCOSTAN/Home-AssistantConfig/issues/892 - If vacation mode is enabled, Put Water Heater in Vacation Mode as well.

CCOSTAN commented 2 years ago

Looks like there is a HACS component for this.

https://github.com/slashback100/presence_simulation

GitHub
GitHub - slashback100/presence_simulation: Home Assistant Presence Simulation
Home Assistant Presence Simulation. Contribute to slashback100/presence_simulation development by creating an account on GitHub.