Zbotic Logo Zbotic Logo
  • Home
  • Shop
  • Sale
  • 3D Print Service
  • PCB Service
  • B2B
  • Blogs
  • Contact Us
0 0

View Wishlist Add all to cart

0 0
0 Shopping Cart
Shopping cart (0)
Subtotal: ₹0.00

View cartCheckout

  • Shop
  • About Us
  • Contact Us
  • Reseller
  • Blogs
020 69134444
1800 209 0998
[email protected]
Help Desk
Facebook Twitter Instagram Linkedin YouTube
Zbotic Logo Zbotic Logo
0 0

View Wishlist Add all to cart

0 0
0 Shopping Cart
Shopping cart (0)
Subtotal: ₹0.00

View cartCheckout

All departments
  • 3D Print Service
  • 3D Printer
  • Batteries & Chargers
  • Development Boards
  • Drone Parts
  • EBike parts
  • Sensor Modules
  • Electronic Components
  • Electronic Modules
  • IoT and Wireless
  • Mechanical Parts and Workbench Tools
  • Motors & Drivers & Pumps & Actuators
  • DIY and Robot Kits
  • Show more
  • Home
  • Shop
  • Sale
  • 3D Print Service
  • PCB Service
  • B2B
  • Blogs
  • Contact Us
Return to previous page
Home Home Automation & Smart Devices

Home Assistant Automations: Sunrise, Motion and Time Triggers

Home Assistant Automations: Sunrise, Motion and Time Triggers

March 11, 2026 /Posted byJayesh Jain / 0

Mastering Home Assistant automations with sunrise, motion, and time triggers transforms your smart home from a remote-controlled system into a truly intelligent one. Rather than manually controlling lights and appliances, well-designed automations respond to your daily rhythms — waking the home up with the sun, keeping it comfortable when you are present, and conserving energy when you leave. This comprehensive guide covers all three trigger types with practical examples tailored for Indian households.

Table of Contents

  • Home Assistant Automation Basics
  • Time and Pattern Triggers
  • Sunrise and Sunset Automations
  • Motion Trigger Automations
  • Combining Multiple Triggers
  • Indian Home Automation Examples
  • Debugging and Testing Automations
  • Frequently Asked Questions

Home Assistant Automation Basics

Every Home Assistant automation has three components:

  • Trigger: What starts the automation (time, motion, state change)
  • Condition (optional): Additional checks that must pass (only on weekdays, only when home, only at night)
  • Action: What happens when triggered (turn on light, send notification, adjust AC)

Automations can be created via the visual editor (Settings > Automations) or directly in YAML. The visual editor covers 90% of use cases — YAML is needed only for advanced templates and complex logic.

Time and Pattern Triggers

Fixed Time Trigger

The simplest trigger — runs at an exact time every day:

alias: Morning Geyser On
trigger:
  - platform: time
    at: "05:45:00"
action:
  - service: switch.turn_on
    entity_id: switch.bathroom_geyser

Multiple Times Trigger

alias: Prayer Time Bell
trigger:
  - platform: time
    at:
      - "06:00:00" # Morning aarti
      - "12:00:00" # Afternoon
      - "19:00:00" # Evening aarti
action:
  - service: media_player.play_media
    entity_id: media_player.hall_speaker
    data:
      media_content_id: "OM_chime.mp3"
      media_content_type: music

Time Pattern Trigger (Cron-like)

# Check and report every hour
trigger:
  - platform: time_pattern
    minutes: "0" # Every hour at :00

# Every 15 minutes
trigger:
  - platform: time_pattern
    minutes: "/15"
Recommended: DC5-80V ESP8266 WiFi Relay Module — The most common automation target in Indian homes. Connect to lights, fans, geyser, or any 230V appliance. Responds to all Home Assistant triggers instantly via MQTT or ESPHome.

Sunrise and Sunset Automations

Home Assistant uses your configured coordinates (set during onboarding with your Indian city location) to calculate accurate local sunrise and sunset times every day. This automatically adjusts for seasonal changes without any manual updates.

Outdoor Lights at Sunset

alias: Evening Outdoor Lights
trigger:
  - platform: sun
    event: sunset
    offset: "-00:15:00" # 15 min before sunset
action:
  - service: light.turn_on
    entity_id:
      - light.garden_light
      - light.entrance_light
    data:
      brightness: 255

Morning Curtains Open at Sunrise

alias: Morning Curtains
trigger:
  - platform: sun
    event: sunrise
    offset: "+00:30:00" # 30 min after sunrise
condition:
  - condition: time
    weekday: [mon, tue, wed, thu, fri] # Only weekdays
action:
  - service: cover.open_cover
    entity_id: cover.living_room_curtains

Night Mode at Sunset Plus 2 Hours

Many Indian families follow a “lights dim after 9-10 PM” pattern regardless of season. A sunset-relative trigger handles this naturally:

alias: Night Mode Activation
trigger:
  - platform: sun
    event: sunset
    offset: "+02:00:00"
action:
  - service: light.turn_on
    target:
      area_id: living_room
    data:
      brightness: 80
      color_temp: 500 # Warm white for night
  - service: scene.turn_on
    entity_id: scene.night_mode

Solar Production Awareness

For homes with rooftop solar (increasingly common in Gujarat, Rajasthan, Maharashtra), use solar elevation to trigger high-load appliances during peak generation hours:

alias: Run Washing Machine During Solar Peak
trigger:
  - platform: numeric_state
    entity_id: sun.sun
    attribute: elevation
    above: 45 # High sun angle = peak solar
condition:
  - condition: state
    entity_id: sensor.solar_power
    state_numerical:
      above: 2000 # More than 2kW generating
action:
  - service: switch.turn_on
    entity_id: switch.washing_machine

Motion Trigger Automations

Motion sensors (PIR sensors or camera-based detection) create the most satisfying automations — lights that follow you through the house.

Simple Motion-Based Light Control

alias: Kitchen Motion Light
trigger:
  # Turn on when motion detected
  - platform: state
    entity_id: binary_sensor.kitchen_motion
    to: "on"
    id: motion_on
  # Turn off 5 min after motion stops
  - platform: state
    entity_id: binary_sensor.kitchen_motion
    to: "off"
    for: "00:05:00"
    id: motion_off
condition:
  # Only at night/evening (save energy during day)
  - condition: sun
    after: sunset
    before: sunrise
action:
  - choose:
    - conditions:
        - condition: trigger
          id: motion_on
      sequence:
        - service: light.turn_on
          entity_id: light.kitchen
    - conditions:
        - condition: trigger
          id: motion_off
      sequence:
        - service: light.turn_off
          entity_id: light.kitchen

Multi-Zone Motion Tracking

Follow movement through Indian home zones:

alias: Follow Me Lights
# When motion detected in any room, turn on that room's light
# and turn off the previous room's light
trigger:
  - platform: state
    entity_id:
      - binary_sensor.hall_motion
      - binary_sensor.kitchen_motion
      - binary_sensor.study_motion
    to: "on"
action:
  - service: light.turn_on
    target:
      entity_id: >-
        {% if trigger.entity_id == 'binary_sensor.hall_motion' %}
          light.hall
        {% elif trigger.entity_id == 'binary_sensor.kitchen_motion' %}
          light.kitchen
        {% else %}
          light.study
        {% endif %}

Doorbell Motion Alert

Indian homes frequently have visitors unannounced. A motion sensor at the main entrance triggers a notification:

alias: Entrance Motion Alert
trigger:
  - platform: state
    entity_id: binary_sensor.entrance_motion
    to: "on"
condition:
  - condition: time
    after: "09:00:00"
    before: "22:00:00"
action:
  - service: notify.mobile_app
    data:
      message: "Someone at the entrance"
      data:
        image: "/api/camera_proxy/camera.entrance" # If camera available

Combining Multiple Triggers

The most powerful automations combine multiple triggers with conditions:

alias: Smart Hall Light (Combined)
trigger:
  - platform: state
    entity_id: binary_sensor.hall_motion
    to: "on"
  - platform: sun
    event: sunset
condition:
  - condition: or
    conditions:
      - condition: sun
        after: sunset
      - condition: numeric_state
        entity_id: sensor.hall_lux
        below: 50 # Dark even during daytime
action:
  - service: light.turn_on
    entity_id: light.hall
    data:
      brightness: >-
        {% if now().hour  22 %}
          50
        {% else %}
          200
        {% endif %}
Recommended: 5V Modbus RTU 4 Channel Relay Module — Control four rooms’ lights and fans simultaneously from a single automation. When motion is detected in the hallway, trigger a sequence that turns on the hall light, bedroom corridor light, and bathroom exhaust fan via this 4-channel relay module.

Indian Home Automation Examples

Diwali Decoration Lights Schedule

alias: Diwali Lights Schedule
trigger:
  - platform: sun
    event: sunset
    offset: "-00:30:00"
condition:
  - condition: template
    value_template: >-
      {% set today = now() %}
      {{ today.month == 10 or today.month == 11 }}
action:
  - service: switch.turn_on
    entity_id:
      - switch.balcony_lights
      - switch.entrance_fairy_lights

Power Cut Response

alias: Power Cut Alert
trigger:
  - platform: state
    entity_id: binary_sensor.mains_power
    to: "off"
action:
  - service: notify.family_group
    data:
      message: >-
        Power cut! Inverter on.
        Battery: {{ states('sensor.battery_soc') }}%
  - service: switch.turn_off
    entity_id:
      - switch.washing_machine
      - switch.bedroom_2_ac

Debugging and Testing Automations

Home Assistant’s automation editor includes a powerful trace function:

  1. Go to Settings > Automations
  2. Click on your automation
  3. Click the three-dot menu > Trace
  4. See the complete execution history with timing and condition evaluation

For rapid testing, use the Developer Tools > Template section to test Jinja2 template conditions. Use the Services tab to manually call actions (switch.turn_on, etc.) to verify your targets are correct before automating them.

Recommended: 8 Channel SSR Module (OMRON) — Silent solid state relays are ideal for automation targets in bedrooms where mechanical relay clicks would disturb sleep. OMRON SSRs provide noiseless switching triggered by Home Assistant automations.

Frequently Asked Questions

How do I make an automation run only on certain days of the week?

Add a time condition to your automation specifying weekday. In YAML: condition: time, weekday: [mon, tue, wed, thu, fri] for weekdays only, or [sat, sun] for weekends. This is essential for geyser, alarm, and cooking schedules that differ between weekdays and weekends in Indian households.

Why is my sunrise trigger running at the wrong time?

Check that your Home Assistant location is set correctly to your Indian city coordinates. Go to Settings > System > General > Location. If the location shows USA or UK (common default if not set during onboarding), your sunrise trigger will calculate for the wrong timezone and location.

Can automations run while Home Assistant is restarting?

No. Automations require HA to be running. If the Pi reboots after a power cut, automations resume once HA is fully loaded (typically 60-90 seconds). Design critical systems (like inverter monitoring) to have hardware-level fallbacks that work independently of HA.

How many automations can Home Assistant handle?

Home Assistant handles hundreds of automations efficiently. There is no practical limit for home use — even 200-300 automations run without performance impact on a Pi 4. The database and entity history are more likely performance bottlenecks than automation count.

Shop Home Automation at Zbotic –

Tags: home assistant automations, home automation India, motion trigger, smart home automation, sunrise trigger, time trigger
Share Post
  • Facebook
  • Linkedin
  • Whatsapp
MAX98357 I2S Amplifier: WiFi S...
blog max98357 i2s amplifier wifi speaker build with esp32 598693
blog diy humanoid robot servo count power control challenges 598697
DIY Humanoid Robot: Servo Coun...

Related posts

Svg%3E
Read more

MQTT for Home Automation: ESP32 + Mosquitto + Home Assistant

April 1, 2026 0
MQTT is the backbone protocol of professional home automation systems. If you are building a smart home with multiple ESP32... Continue reading
Svg%3E
Read more

Curtain and Blind Automation: Stepper Motor Controller

April 1, 2026 0
Curtain automation is one of the most satisfying smart home upgrades you can build. Imagine your curtains opening automatically at... Continue reading
Svg%3E
Read more

Smart Doorbell with Camera: ESP32-CAM Video Intercom

April 1, 2026 0
A smart doorbell with a camera lets you see who is at your door from your phone, even when you... Continue reading
Svg%3E
Read more

Blynk IoT Platform: Control Arduino and ESP32 from Mobile

April 1, 2026 0
The Blynk IoT platform is the fastest way to control your Arduino and ESP32 projects from your mobile phone. Instead... Continue reading
Svg%3E
Read more

PIR Sensor Automatic Light: Save Electricity with Motion Detection

April 1, 2026 0
PIR sensor automatic lights are the simplest and most effective way to save electricity in Indian homes. By automatically turning... Continue reading

Add comment Cancel reply

Your email address will not be published. Required fields are marked

Facebook Twitter Instagram Pinterest Linkedin Youtube

Get the latest deals and more.

Download on Google Play Download on the App Store

Call us: 020 69134444 / 1800 209 0998

Monday - Saturday 09:30 AM - 06:00 PM
For Technical Supports Email: [email protected]
For Sales / Enquiries Email: [email protected]

  • My Account

    • Cart

    • Wishlist

    • Checkout

    • My Orders

    • Track Order

    • My Account

  • Information

    • FAQs

    • Blogs

    • Career

    • About Us

    • Contact Us

    • Payment Options

  • Policies

    • Privacy Policy

    • Terms & Conditions

    • GST Input Tax Credit

    • Shipping Return Policy

    • E-Waste Collection Points

    • Our Sitemap

© Zbotic.in is registered trademark of Moxie Supply Pvt Ltd – All Rights Reserved
Login
Use Phone Number
Use Email Address
Not a member yet? Register Now
Reset Password
Use Phone Number
Use Email Address
Register
Already a member? Login Now