Advanced Scenarios

Real-world examples of complex automation setups using Wala Works devices.

Scenario 1: Whole-Home Blind Control

Control multiple blinds throughout your home with coordinated automation.

Hardware Setup

  • 5x MotorWala controllers
  • 1x MQTT broker (Raspberry Pi)
  • 1x Home Assistant instance

Device Configuration

# Living Room - South-facing
MotorWala 1:
  IP: 192.168.1.100
  MQTT Topic: motorwala/living-room-south

# Living Room - West-facing
MotorWala 2:
  IP: 192.168.1.101
  MQTT Topic: motorwala/living-room-west

# Bedroom
MotorWala 3:
  IP: 192.168.1.102
  MQTT Topic: motorwala/bedroom

# Office
MotorWala 4:
  IP: 192.168.1.103
  MQTT Topic: motorwala/office

# Kitchen
MotorWala 5:
  IP: 192.168.1.104
  MQTT Topic: motorwala/kitchen

Home Assistant Configuration

Group all blinds:

cover:
  - platform: group
    name: "All Blinds"
    entities:
      - cover.living_room_south_blinds
      - cover.living_room_west_blinds
      - cover.bedroom_blinds
      - cover.office_blinds
      - cover.kitchen_blinds

  - platform: group
    name: "Living Room Blinds"
    entities:
      - cover.living_room_south_blinds
      - cover.living_room_west_blinds

Morning routine automation:

automation:
  - alias: "Morning Open All Blinds"
    trigger:
      - platform: time
        at: "07:00:00"
    condition:
      - condition: state
        entity_id: input_boolean.vacation_mode
        state: "off"
    action:
      - service: cover.open_cover
        target:
          entity_id: cover.all_blinds
      - delay: "00:00:30"
      - service: notify.mobile_app
        data:
          message: "Good morning! Blinds opened."

Sun protection automation:

automation:
  - alias: "Close South Blinds When Hot"
    trigger:
      - platform: numeric_state
        entity_id: sensor.outside_temperature
        above: 32
    condition:
      - condition: sun
        after: sunrise
        before: sunset
      - condition: numeric_state
        entity_id: sensor.uv_index
        above: 6
    action:
      - service: cover.close_cover
        target:
          entity_id: cover.living_room_south_blinds
      - service: notify.mobile_app
        data:
          message: "South blinds closed due to heat"

Sunset sequence:

automation:
  - alias: "Sunset Closing Sequence"
    trigger:
      - platform: sun
        event: sunset
        offset: "-00:30:00"
    action:
      # Close west-facing first (direct sun)
      - service: cover.close_cover
        target:
          entity_id: cover.living_room_west_blinds
      - delay: "00:02:00"

      # Then close other rooms
      - service: cover.close_cover
        target:
          entity_id:
            - cover.living_room_south_blinds
            - cover.office_blinds
            - cover.kitchen_blinds
      - delay: "00:05:00"

      # Bedroom last (privacy)
      - service: cover.close_cover
        target:
          entity_id: cover.bedroom_blinds

Scenario 2: Smart Office Lighting & Climate

Automated office environment with occupancy detection.

Hardware Setup

  • 1x RelayWala (4 channels)
  • 1x PIR motion sensor (MQTT)
  • 1x Temperature sensor (MQTT)
  • 1x CO2 sensor (MQTT)

Relay Configuration

Channel 1: Ceiling Lights (200W)
Channel 2: Desk Lamp (60W)
Channel 3: Exhaust Fan (40W)
Channel 4: Air Purifier (50W)

Node-RED Flow

Occupancy-based lighting:

[MQTT: PIR Sensor]
    ↓
[Switch: Motion Detected?]
    ├─ Yes → [MQTT: Lights ON]
    └─ No  → [Delay 5 min] → [MQTT: Lights OFF]

Flow JSON:

[
  {
    "id": "pir-in",
    "type": "mqtt in",
    "topic": "sensors/office/pir",
    "broker": "mqtt-broker"
  },
  {
    "id": "motion-switch",
    "type": "switch",
    "property": "payload",
    "rules": [
      {"t": "eq", "v": "motion", "vt": "str"},
      {"t": "eq", "v": "clear", "vt": "str"}
    ]
  },
  {
    "id": "lights-on",
    "type": "mqtt out",
    "topic": "relaywala/office/relay/1/set",
    "payload": "ON"
  },
  {
    "id": "delay-5min",
    "type": "delay",
    "timeout": 300,
    "timeoutUnits": "seconds"
  },
  {
    "id": "lights-off",
    "type": "mqtt out",
    "topic": "relaywala/office/relay/1/set",
    "payload": "OFF"
  }
]

Climate control based on CO2:

# Home Assistant automation
automation:
  - alias: "Office Ventilation Control"
    trigger:
      - platform: numeric_state
        entity_id: sensor.office_co2
        above: 1000
    action:
      # Turn on exhaust fan
      - service: mqtt.publish
        data:
          topic: "relaywala/office/relay/3/set"
          payload: "ON"

      # Wait 10 minutes
      - delay: "00:10:00"

      # Check if CO2 improved
      - choose:
          - conditions:
              - condition: numeric_state
                entity_id: sensor.office_co2
                below: 800
            sequence:
              - service: mqtt.publish
                data:
                  topic: "relaywala/office/relay/3/set"
                  payload: "OFF"
        default:
          # Keep running, check again in 10 min
          - delay: "00:10:00"

Temperature-based air purifier:

automation:
  - alias: "Air Purifier Auto"
    trigger:
      - platform: time_pattern
        minutes: "/15"
    action:
      - choose:
          # Hot + Poor AQI → Purifier ON
          - conditions:
              - condition: numeric_state
                entity_id: sensor.office_temperature
                above: 28
              - condition: numeric_state
                entity_id: sensor.office_aqi
                above: 100
            sequence:
              - service: mqtt.publish
                data:
                  topic: "relaywala/office/relay/4/set"
                  payload: "ON"

          # Cool + Good AQI → Purifier OFF
          - conditions:
              - condition: numeric_state
                entity_id: sensor.office_temperature
                below: 26
              - condition: numeric_state
                entity_id: sensor.office_aqi
                below: 50
            sequence:
              - service: mqtt.publish
                data:
                  topic: "relaywala/office/relay/4/set"
                  payload: "OFF"

Scenario 3: Garage Door with Safety

Garage door control with multiple safety features.

Hardware Setup

  • 1x RelayWala
  • 2x Reed switches (door open/closed sensors)
  • 1x Ultrasonic sensor (car detection)
  • 1x Magnetic door sensor

Relay Configuration

Channel 1: Garage Door Opener (momentary)
Channel 2: Garage Light (normal)
Channel 3: Spare
Channel 4: Spare

Interlock: None needed (momentary mode)

Safety Logic

Requirements:

  1. Don't close if car is in the way
  2. Auto-close if left open for 10 minutes
  3. Turn on light when door opens
  4. Alert if door open at night

Home Assistant Configuration

Sensors:

binary_sensor:
  - platform: mqtt
    name: "Garage Door Reed Top"
    state_topic: "sensors/garage/reed-top"
    payload_on: "open"
    payload_off: "closed"
    device_class: garage_door

  - platform: mqtt
    name: "Garage Door Reed Bottom"
    state_topic: "sensors/garage/reed-bottom"
    payload_on: "open"
    payload_off: "closed"

  - platform: mqtt
    name: "Car Present"
    state_topic: "sensors/garage/ultrasonic"
    payload_on: "detected"
    payload_off: "clear"
    device_class: occupancy

cover:
  - platform: template
    covers:
      garage_door:
        friendly_name: "Garage Door"
        value_template: >
          {% if is_state('binary_sensor.garage_door_reed_top', 'open') %}
            open
          {% elif is_state('binary_sensor.garage_door_reed_bottom', 'open') %}
            closed
          {% else %}
            opening
          {% endif %}
        open_cover:
          service: mqtt.publish
          data:
            topic: "relaywala/garage/relay/1/set"
            payload: "ON"
        close_cover:
          service: mqtt.publish
          data:
            topic: "relaywala/garage/relay/1/set"
            payload: "ON"
        stop_cover:
          service: mqtt.publish
          data:
            topic: "relaywala/garage/relay/1/set"
            payload: "ON"

Automations:

Auto-light on door open:

automation:
  - alias: "Garage Light On When Door Opens"
    trigger:
      - platform: state
        entity_id: cover.garage_door
        to: "opening"
    action:
      - service: mqtt.publish
        data:
          topic: "relaywala/garage/relay/2/set"
          payload: "ON"
      - delay: "00:05:00"
      - service: mqtt.publish
        data:
          topic: "relaywala/garage/relay/2/set"
          payload: "OFF"

Auto-close with safety check:

automation:
  - alias: "Auto Close Garage"
    trigger:
      - platform: state
        entity_id: cover.garage_door
        to: "open"
        for: "00:10:00"
    condition:
      # Only close if no car present
      - condition: state
        entity_id: binary_sensor.car_present
        state: "off"
      # Only during daytime
      - condition: sun
        before: sunset
        after: sunrise
    action:
      - service: notify.mobile_app
        data:
          message: "Closing garage door (open for 10 minutes)"
      - delay: "00:00:30"
      - service: cover.close_cover
        target:
          entity_id: cover.garage_door

Night alert:

automation:
  - alias: "Garage Open at Night Alert"
    trigger:
      - platform: sun
        event: sunset
    condition:
      - condition: state
        entity_id: cover.garage_door
        state: "open"
    action:
      - service: notify.mobile_app
        data:
          message: "⚠️ Garage door is open at sunset!"
          data:
            actions:
              - action: CLOSE_GARAGE
                title: "Close Now"

automation:
  - alias: "Close Garage from Notification"
    trigger:
      - platform: event
        event_type: mobile_app_notification_action
        event_data:
          action: CLOSE_GARAGE
    action:
      - service: cover.close_cover
        target:
          entity_id: cover.garage_door

Scenario 4: Multi-Zone HVAC Control

Control heating/cooling zones with intelligent scheduling.

Hardware Setup

  • 2x RelayWala (8 total relays)
  • 4x Temperature sensors
  • Smart thermostat

Zone Configuration

Zone 1 (Living Room):
  Relay: RelayWala-1, Channel 1
  Sensor: sensor.living_room_temp

Zone 2 (Bedroom):
  Relay: RelayWala-1, Channel 2
  Sensor: sensor.bedroom_temp

Zone 3 (Office):
  Relay: RelayWala-1, Channel 3
  Sensor: sensor.office_temp

Zone 4 (Guest Room):
  Relay: RelayWala-1, Channel 4
  Sensor: sensor.guest_room_temp

Intelligent Scheduling

Weekday schedule:

automation:
  - alias: "Weekday Climate Schedule"
    trigger:
      - platform: time_pattern
        minutes: "/15"
    condition:
      - condition: time
        weekday:
          - mon
          - tue
          - wed
          - thu
          - fri
    action:
      - choose:
          # Morning: Heat bedroom + office
          - conditions:
              - condition: time
                after: "06:00:00"
                before: "09:00:00"
            sequence:
              - service: climate.set_temperature
                data:
                  entity_id:
                    - climate.bedroom
                    - climate.office
                  temperature: 22

          # Day: Heat office only
          - conditions:
              - condition: time
                after: "09:00:00"
                before: "18:00:00"
            sequence:
              - service: climate.set_temperature
                target:
                  entity_id: climate.office
                data:
                  temperature: 22
              - service: climate.set_temperature
                target:
                  entity_id:
                    - climate.living_room
                    - climate.bedroom
                    - climate.guest_room
                data:
                  temperature: 18

          # Evening: Heat living room + bedroom
          - conditions:
              - condition: time
                after: "18:00:00"
                before: "23:00:00"
            sequence:
              - service: climate.set_temperature
                target:
                  entity_id:
                    - climate.living_room
                    - climate.bedroom
                data:
                  temperature: 21

          # Night: Bedroom only
          - conditions:
              - condition: time
                after: "23:00:00"
                before: "06:00:00"
            sequence:
              - service: climate.set_temperature
                target:
                  entity_id: climate.bedroom
                data:
                  temperature: 19

Scenario 5: Holiday Mode

Simulate presence when away with randomized behavior.

Configuration

input_boolean:
  vacation_mode:
    name: "Vacation Mode"
    icon: mdi:airplane

automation:
  - alias: "Vacation Mode - Random Blinds"
    trigger:
      - platform: time
        at: "07:30:00"
      - platform: time
        at: "08:15:00"
    condition:
      - condition: state
        entity_id: input_boolean.vacation_mode
        state: "on"
    action:
      # Open random blinds
      - service: cover.set_cover_position
        target:
          entity_id: >
            {{ ['cover.living_room_blinds',
                'cover.bedroom_blinds',
                'cover.office_blinds'] | random }}
        data:
          position: "{{ range(60, 100) | random }}"

  - alias: "Vacation Mode - Random Lights"
    trigger:
      - platform: sun
        event: sunset
        offset: "{{ range(-1800, 1800) | random }}"
    condition:
      - condition: state
        entity_id: input_boolean.vacation_mode
        state: "on"
    action:
      # Turn on random lights
      - service: switch.turn_on
        target:
          entity_id: >
            {{ ['switch.living_room_light',
                'switch.bedroom_light',
                'switch.kitchen_light'] | random }}
      # Keep on for random duration
      - delay: "{{ range(3600, 14400) | random }}"
      - service: switch.turn_off
        target:
          entity_id: >
            {{ states.switch
               | selectattr('state', 'eq', 'on')
               | map(attribute='entity_id')
               | list | random }}

Scenario 6: Voice Control Integration

Alexa Integration

# Home Assistant configuration.yaml
alexa:
  smart_home:

# Expose devices
cover:
  - platform: mqtt
    name: "Living Room Blinds"
    alexa_name: "Living Room Blinds"

switch:
  - platform: mqtt
    name: "Garage Door"
    alexa_name: "Garage"

Voice commands:

  • "Alexa, open living room blinds"
  • "Alexa, close all blinds"
  • "Alexa, set bedroom blinds to 50 percent"

Google Assistant Integration

# Home Assistant configuration.yaml
google_assistant:
  project_id: your-project-id
  exposed_domains:
    - cover
    - switch

Voice commands:

  • "Hey Google, open the blinds"
  • "Hey Google, close bedroom blinds"
  • "Hey Google, set office blinds to 75 percent"

Best Practices

Network Reliability

  1. Use static IPs or DHCP reservations
  2. Monitor WiFi signal strength
  3. Set up device availability tracking
  4. Implement fallback behaviors

MQTT Optimization

  1. Use retained messages for states
  2. Set appropriate QoS levels
  3. Implement LWT (Last Will Testament)
  4. Group related topics

Error Handling

# Retry failed commands
automation:
  - alias: "Command with Retry"
    action:
      - repeat:
          count: 3
          sequence:
            - service: mqtt.publish
              data:
                topic: "motorwala/living-room/set"
                payload: "OPEN"
            - wait_template: >
                {{ is_state('cover.living_room_blinds', 'open') }}
              timeout: 30
            - condition: template
              value_template: >
                {{ not is_state('cover.living_room_blinds', 'open') }}

Monitoring

# Device availability sensors
binary_sensor:
  - platform: mqtt
    name: "MotorWala Living Room Online"
    state_topic: "motorwala/living-room/availability"
    payload_on: "online"
    payload_off: "offline"
    device_class: connectivity

# Alert on offline
automation:
  - alias: "Device Offline Alert"
    trigger:
      - platform: state
        entity_id: binary_sensor.motorwala_living_room_online
        to: "off"
        for: "00:05:00"
    action:
      - service: notify.mobile_app
        data:
          message: "⚠️ Living room MotorWala is offline"

Next Steps


Need help with your setup? Ask in our community forum

Previous

Next