Connecting with Home Assistant
Complete guide for integrating Wala Works devices with Home Assistant using the ESPHome ecosystem. This method provides the deepest integration with automatic device discovery and native Home Assistant entities.
Why ESPHome + Home Assistant?
MotorWala and RelayWala are built on ESPHome firmware, which integrates seamlessly with Home Assistant:
- Native Integration: Devices appear as native Home Assistant entities
- Real-time Updates: Instant state synchronization via Home Assistant API
- Zero Configuration: Automatic discovery - just add the device
- Full Control: All features accessible in Home Assistant UI
- Visual Editor: Configure and update devices through ESPHome dashboard
- OTA Updates: Update firmware over WiFi without cables
Prerequisites
What You Need
-
Home Assistant - Running version 2023.1 or later
- Installed on Raspberry Pi, NUC, or other hardware
- Accessible on your local network
- Installation guide
-
ESPHome Add-on - Installed in Home Assistant
- Available through Home Assistant Supervisor
- Free and official add-on
-
Wala Works Device - MotorWala or RelayWala
- Already powered and physically wired
- See Hardware Setup if not completed
-
Network Access
- Home Assistant and devices on same network
- Or proper routing between VLANs
Installation Methods
There are two ways to connect devices to Home Assistant:
Method 1: Pre-flashed Devices (Recommended)
Best for: Devices purchased from Wala Works shop - they come pre-flashed and ready to use.
Steps:
- Power on device
- Connect to WiFi (via setup portal)
- Add to Home Assistant
- Start using immediately
Time required: 5-10 minutes
Method 2: Custom ESPHome Configuration
Best for: DIY builds or customizing device behavior.
Steps:
- Install ESPHome add-on
- Create/edit device configuration
- Flash device via USB or OTA
- Add to Home Assistant
Time required: 20-30 minutes (first time)
Method 1: Pre-flashed Devices
Step 1: Connect Device to WiFi
All Wala Works devices come pre-flashed with ESPHome firmware and will create a WiFi access point on first boot.
Initial Setup
-
Power on your MotorWala or RelayWala device
-
Watch the LED:
- Rapid blinking (2-3 times/sec) = Setup mode
- Slow blinking (once per second) = Connecting
- Solid on = Connected
-
Connect to device WiFi:
- Network name:
MotorWala-XXXXorRelayWala-XXXX - Password:
setup12345(default fallback AP)
- Network name:
-
Configure network:
- Browser should auto-open to
http://192.168.4.1 - If not, manually navigate to that address
- Select your home WiFi network
- Enter password
- Click "Connect"
- Browser should auto-open to
-
Wait for connection:
- Device will attempt to connect (10-30 seconds)
- LED will change to slow blink, then solid
- Device will reboot and join your network
Find Device IP Address
Option 1: Router Admin Panel
- Log into your router
- Check DHCP leases
- Look for device name (e.g., "motorwala", "relaywala")
Option 2: Home Assistant Network Scan
- Settings → System → Network
- Scan for devices
- Look for ESP32/ESP8266 devices
Option 3: mDNS Discovery
ping motorwala.local
# or
ping relaywala.local
Step 2: Install ESPHome Add-on
Install the official ESPHome add-on in Home Assistant:
-
Open Add-on Store:
- Navigate to: Settings → Add-ons → Add-on Store
- Click "+ Add-on Store" in bottom right
-
Search for ESPHome:
- Type "ESPHome" in search box
- Select "ESPHome" (official add-on)
-
Install:
- Click "Install"
- Wait for installation (2-5 minutes)
- Do not close browser during installation
-
Configure ESPHome Add-on:
network_mode: host- Leave other settings at defaults
-
Start ESPHome:
- Click "Start"
- Enable "Start on boot"
- Enable "Show in sidebar" for easy access
-
Access ESPHome Dashboard:
- Click "Open Web UI"
- Or navigate to:
http://homeassistant.local:6052
Step 3: Adopt Device in ESPHome
-
Open ESPHome Dashboard:
- Click "ESPHome" in Home Assistant sidebar
- Or visit: Settings → Add-ons → ESPHome → "Open Web UI"
-
Device Auto-Discovery:
- ESPHome will automatically discover new devices on network
- Look for banner: "New device discovered: motorwala.local"
- Or device card with "Discovered" badge
-
Adopt Device:
- Click "Adopt" on discovered device
- Or click "+ New Device" → "Continue" if not auto-discovered
-
Device Configuration:
┌──────────────────────────────────┐ │ Adopt Device │ ├──────────────────────────────────┤ │ │ │ Device Name: │ │ [Living Room Blinds ] │ │ │ │ Location (optional): │ │ [Living Room ] │ │ │ │ [ Skip ] [ Adopt ] │ └──────────────────────────────────┘ -
Friendly Name:
- Enter descriptive name (e.g., "Living Room Blinds")
- This name will appear in Home Assistant
- Click "Adopt"
-
API Encryption Key:
- ESPHome will generate encryption key automatically
- Key is used for secure communication
- Stored in device configuration
Step 4: Add to Home Assistant
Devices adopted in ESPHome automatically appear in Home Assistant:
-
Automatic Discovery:
- Navigate to: Settings → Devices & Services
- Look for "Discovered" notification
- Device name will appear (e.g., "Living Room Blinds")
-
Add Integration:
- Click "Configure" on discovered device
- Or manually add: "+ Add Integration" → search "ESPHome"
-
Connect:
Host: motorwala.local (or IP address) Port: 6053- Click "Submit"
-
Encryption Key:
- Enter API encryption key
- Found in ESPHome dashboard → device configuration
- Or auto-filled if adopted through ESPHome
-
Finish Setup:
- Device added successfully!
- All entities now available in Home Assistant
Step 5: Verify Device Entities
Check that device entities are working:
MotorWala Entities
Navigate to device page: Settings → Devices & Services → ESPHome → [Your Device]
Entities you should see:
cover.living_room_blinds- Motor control (open/close/stop)sensor.motor_position- Current position (0-100%)sensor.motor_current- Motor current drawbinary_sensor.upper_limit- Upper limit switchbinary_sensor.lower_limit- Lower limit switchbutton.calibrate- Run calibration routineswitch.motor_enable- Enable/disable motor
Test Control:
# Try opening via Developer Tools
service: cover.open_cover
target:
entity_id: cover.living_room_blinds
RelayWala Entities
Entities you should see:
switch.relay_1- Relay 1 controlswitch.relay_2- Relay 2 controlswitch.relay_3- Relay 3 controlswitch.relay_4- Relay 4 controlbinary_sensor.emergency_stop- Emergency stop buttonsensor.relay_1_status- Relay 1 statesensor.uptime- Device uptime
Test Control:
# Try toggling via Developer Tools
service: switch.toggle
target:
entity_id: switch.relay_1
Method 2: Custom ESPHome Configuration
For DIY builds or custom configurations.
Step 1: Prepare Configuration Files
Download the reference configurations from the Wala Works GitHub repository or create them manually.
MotorWala Configuration
Create motorwala.yaml in ESPHome dashboard:
esphome:
name: living-room-blinds
friendly_name: Living Room Blinds
platform: ESP32
board: esp32dev
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# Fallback access point
ap:
ssid: "MotorWala Fallback"
password: !secret ap_password
# Enable Home Assistant API
api:
encryption:
key: !secret api_encryption_key
ota:
password: !secret ota_password
logger:
level: INFO
# Motor driver outputs (L298N)
output:
- platform: ledc
pin: GPIO25
id: motor_a_forward
frequency: 1000 Hz
- platform: ledc
pin: GPIO26
id: motor_a_backward
frequency: 1000 Hz
# Cover entity for Home Assistant
cover:
- platform: time_based
name: "Motor Cover"
id: motor_cover
open_action:
- output.set_level:
id: motor_a_forward
level: 100%
- output.set_level:
id: motor_a_backward
level: 0%
close_action:
- output.set_level:
id: motor_a_forward
level: 0%
- output.set_level:
id: motor_a_backward
level: 100%
stop_action:
- output.set_level:
id: motor_a_forward
level: 0%
- output.set_level:
id: motor_a_backward
level: 0%
open_duration: 30s
close_duration: 30s
# Position limit switches
binary_sensor:
- platform: gpio
pin:
number: GPIO32
mode: INPUT_PULLUP
inverted: true
name: "Upper Limit"
on_press:
- cover.stop: motor_cover
- platform: gpio
pin:
number: GPIO33
mode: INPUT_PULLUP
inverted: true
name: "Lower Limit"
on_press:
- cover.stop: motor_cover
# Overcurrent protection
sensor:
- platform: adc
pin: GPIO34
name: "Motor Current"
update_interval: 100ms
filters:
- multiply: 3.3
on_value_range:
- above: 2.5
then:
- cover.stop: motor_cover
- logger.log:
format: "Overcurrent detected: %.2f A"
args: ['x']
level: WARN
RelayWala Configuration
Create relaywala.yaml:
esphome:
name: living-room-relays
friendly_name: Living Room Relays
platform: ESP8266
board: nodemcuv2
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# Static IP for reliability
manual_ip:
static_ip: !secret static_ip
gateway: !secret gateway
subnet: 255.255.255.0
dns1: !secret dns1
ap:
ssid: "RelayWala Fallback"
password: !secret ap_password
api:
encryption:
key: !secret api_encryption_key
ota:
password: !secret ota_password
logger:
# 4 relay switches
switch:
- platform: gpio
pin: GPIO16
name: "Relay 1"
id: relay_1
restore_mode: RESTORE_DEFAULT_OFF
icon: "mdi:lightbulb"
- platform: gpio
pin: GPIO14
name: "Relay 2"
id: relay_2
restore_mode: RESTORE_DEFAULT_OFF
icon: "mdi:fan"
- platform: gpio
pin: GPIO12
name: "Relay 3"
id: relay_3
restore_mode: RESTORE_DEFAULT_OFF
icon: "mdi:garage"
on_turn_on:
- delay: 1s
- switch.turn_off: relay_3
- platform: gpio
pin: GPIO13
name: "Relay 4"
id: relay_4
restore_mode: RESTORE_DEFAULT_OFF
icon: "mdi:water-pump"
on_turn_on:
- delay: 300s
- switch.turn_off: relay_4
# Emergency stop button
binary_sensor:
- platform: gpio
pin:
number: GPIO5
mode: INPUT_PULLUP
inverted: true
name: "Emergency Stop"
on_press:
then:
- switch.turn_off: relay_1
- switch.turn_off: relay_2
- switch.turn_off: relay_3
- switch.turn_off: relay_4
Secrets File
Create secrets.yaml:
# WiFi credentials
wifi_ssid: "YourNetworkName"
wifi_password: "YourWiFiPassword"
# Fallback AP
ap_password: "setup12345"
# API encryption (generate with: esphome random-key)
api_encryption_key: "YOUR_32_BYTE_BASE64_KEY_HERE="
# OTA password
ota_password: "yourSecureOTAPassword"
# Static IP (for RelayWala)
static_ip: "192.168.1.150"
gateway: "192.168.1.1"
dns1: "8.8.8.8"
Generate encryption key:
# In ESPHome add-on terminal
esphome random-key
Step 2: Flash Device
Option A: USB Flashing (First Time)
-
Connect device via USB:
- Use USB cable to connect ESP32/ESP8266 to computer
- Or to Raspberry Pi running Home Assistant
-
Install ESPHome Flasher (if not using Home Assistant):
- Download from: https://github.com/esphome/esphome-flasher
- Or use command line:
pip install esphome
-
Flash via ESPHome Dashboard:
- Click device in ESPHome dashboard
- Click "Install"
- Select "Plug into this computer"
- Choose serial port
- Wait for flashing (2-5 minutes)
-
Or flash via command line:
esphome run motorwala.yaml -
Disconnect USB after successful flash
Option B: OTA Flashing (Subsequent Updates)
Once device is on network:
- Edit configuration in ESPHome dashboard
- Click "Install"
- Select "Wirelessly"
- Device updates over WiFi (1-2 minutes)
Step 3: Add to Home Assistant
Follow same process as Method 1, Step 4:
- Devices auto-discovered in Home Assistant
- Add ESPHome integration
- Entities immediately available
Configuration and Customization
Rename Entities
Change entity names in Home Assistant:
- Navigate to entity: Settings → Devices & Services → ESPHome → [Device] → [Entity]
- Click entity name
- Settings gear icon
- Change "Name" and "Entity ID"
- Click "Update"
Example:
- From:
cover.living_room_blinds - To:
cover.bedroom_curtains
Customize Entity Icons
# configuration.yaml
homeassistant:
customize:
cover.living_room_blinds:
icon: mdi:blinds-horizontal
switch.relay_1:
icon: mdi:ceiling-light
switch.relay_2:
icon: mdi:fan
Group Related Entities
# configuration.yaml
group:
living_room_automation:
name: Living Room Automation
entities:
- cover.living_room_blinds
- switch.living_room_light
- switch.living_room_fan
Set Device Area
Assign devices to rooms/areas:
- Settings → Devices & Services → ESPHome → [Device]
- Click "No area assigned"
- Select or create area (e.g., "Living Room")
- All entities inherit area
Create Device Dashboard
Add controls to Home Assistant dashboard:
# Example Lovelace card
type: entities
title: Living Room
entities:
- entity: cover.living_room_blinds
name: Window Blinds
- entity: switch.relay_1
name: Ceiling Light
- entity: switch.relay_2
name: Ceiling Fan
Automations and Scenes
Example Automations
Close Blinds at Sunset
automation:
- alias: "Close blinds at sunset"
description: "Automatically close living room blinds when sun sets"
trigger:
- platform: sun
event: sunset
offset: "-00:30:00" # 30 minutes before sunset
action:
- service: cover.close_cover
target:
entity_id: cover.living_room_blinds
Open Blinds in Morning
automation:
- alias: "Open blinds in morning"
description: "Open blinds at sunrise on weekdays"
trigger:
- platform: sun
event: sunrise
offset: "00:15:00" # 15 minutes after sunrise
condition:
- condition: time
weekday:
- mon
- tue
- wed
- thu
- fri
action:
- service: cover.open_cover
target:
entity_id: cover.living_room_blinds
Turn Off All Relays at Night
automation:
- alias: "Turn off all relays at bedtime"
description: "Safety automation to turn off all relays at night"
trigger:
- platform: time
at: "23:00:00"
action:
- service: switch.turn_off
target:
entity_id:
- switch.relay_1
- switch.relay_2
- switch.relay_3
- switch.relay_4
Emergency Stop Alert
automation:
- alias: "Emergency stop pressed"
description: "Send notification when emergency stop is pressed"
trigger:
- platform: state
entity_id: binary_sensor.emergency_stop
to: "on"
action:
- service: notify.mobile_app
data:
title: "Emergency Stop Activated"
message: "Emergency stop button was pressed in living room"
data:
priority: high
Example Scenes
Morning Scene
scene:
- name: Morning
entities:
cover.living_room_blinds:
state: open
switch.relay_1: # Living room light
state: off
switch.relay_2: # Kitchen light
state: on
Evening Scene
scene:
- name: Evening
entities:
cover.living_room_blinds:
state: closed
switch.relay_1:
state: on
switch.relay_2:
state: on
Advanced Features
Voice Control
Google Assistant Integration
-
Setup Google Assistant in Home Assistant:
- Settings → Devices & Services → Add Integration → Google Assistant
- Follow setup wizard
-
Expose entities:
# configuration.yaml google_assistant: project_id: your-project-id service_account: !include SERVICE_ACCOUNT.json exposed_domains: - cover - switch -
Voice commands:
- "Hey Google, open the living room blinds"
- "Hey Google, turn on the living room light"
- "Hey Google, set blinds to 50 percent"
Amazon Alexa Integration
-
Setup Alexa in Home Assistant:
- Requires Home Assistant Cloud or manual skill setup
- Settings → Home Assistant Cloud → Alexa
-
Discover devices:
- Open Alexa app
- Devices → Add Device → Other
- "Discover devices"
-
Voice commands:
- "Alexa, open the living room blinds"
- "Alexa, turn on relay 1"
Remote Access
Enable secure remote access to control devices from anywhere:
-
Home Assistant Cloud (easiest):
- Settings → Home Assistant Cloud
- Subscribe ($65/year)
- Instant remote access + voice assistants
-
Nabu Casa Tunnel (free alternative):
- Settings → Add-ons → Install "Duck DNS" add-on
- Configure dynamic DNS
- Setup SSL certificates
- Port forward router (443)
Monitoring and Notifications
Motor Current Monitoring
Create alert for unusual current draw:
automation:
- alias: "Motor overcurrent alert"
trigger:
- platform: numeric_state
entity_id: sensor.motor_current
above: 2.0
for:
seconds: 5
action:
- service: notify.notify
data:
title: "Motor Alert"
message: "Motor current is high: {{ states('sensor.motor_current') }}A"
Device Offline Alerts
automation:
- alias: "Device offline alert"
trigger:
- platform: state
entity_id: binary_sensor.living_room_blinds_status
to: "unavailable"
for:
minutes: 5
action:
- service: notify.notify
data:
message: "Living room blinds device is offline"
Debugging and Logs
View Device Logs
-
ESPHome Dashboard:
- Click device
- Click "Logs"
- Real-time log streaming
-
Home Assistant Logs:
- Settings → System → Logs
- Filter by "esphome"
Enable Debug Logging
Add to device configuration:
logger:
level: DEBUG
logs:
sensor: DEBUG
binary_sensor: DEBUG
cover: DEBUG
Firmware Updates
OTA Updates via ESPHome
Update device firmware wirelessly:
- Edit configuration in ESPHome dashboard
- Save changes
- Click "Install" → "Wirelessly"
- Device updates in 1-2 minutes
- Automatically reconnects to Home Assistant
Update ESPHome Add-on
Keep ESPHome add-on updated:
- Settings → Add-ons → ESPHome
- Click "Update" if available
- Restart add-on after update
Backup Before Updating
Always backup configuration:
-
ESPHome configs:
- ESPHome dashboard → Download all configs
- Or backup
/config/esphome/folder
-
Home Assistant:
- Settings → System → Backups
- Create full backup before major changes
Troubleshooting
Device Not Discovered
Symptoms: ESPHome doesn't find device on network
Solutions:
- Verify device connected to WiFi (LED solid, not blinking)
- Check device and Home Assistant on same network/VLAN
- Try manually adding:
- ESPHome dashboard → "+ Add Device" → use IP address
- Restart ESPHome add-on
- Check mDNS working:
ping motorwala.local
API Connection Failed
Symptoms: Home Assistant can't connect to device API
Solutions:
- Check encryption key matches in both:
- ESPHome configuration (
api_encryption_key) - Home Assistant integration settings
- ESPHome configuration (
- Verify port 6053 not blocked by firewall
- Try IP address instead of hostname
- Reboot device via ESPHome dashboard
- Check logs for authentication errors
Entities Not Showing
Symptoms: Device connected but entities missing in Home Assistant
Solutions:
- Refresh entity list:
- Settings → Devices & Services → ESPHome → Device → "⋮" → "Reload"
- Check entity disabled:
- Device page → "X entities not shown"
- Enable entities if disabled
- Restart Home Assistant Core:
- Developer Tools → Restart → "Quick reload"
- Check ESPHome logs for compile errors
Motor Not Moving
Symptoms: Cover entity shows in Home Assistant but motor doesn't move
Solutions:
- Verify hardware wired correctly (see Hardware Setup)
- Check power supply adequate (12-24V, 2A+)
- Test motor manually (connect directly to power)
- View live logs in ESPHome dashboard
- Check for overcurrent protection triggering
- Verify limit switches not stuck in activated state
Relays Not Switching
Symptoms: Switch entity toggles in Home Assistant but relay doesn't click
Solutions:
- Check relay board power (12V supply)
- Verify GPIO pins correct in configuration
- Test relay board with multimeter
- Check status LED on relay board
- Ensure relay board compatible (active-high vs active-low)
- Review logs for error messages
WiFi Connection Drops
Symptoms: Device frequently goes offline
Solutions:
- Check signal strength:
sensor: - platform: wifi_signal name: "WiFi Signal" update_interval: 60s - Use static IP instead of DHCP
- Disable power saving:
wifi: power_save_mode: none - Add reboot action on disconnect:
wifi: on_disconnect: - delay: 5min - lambda: |- ESP.restart(); - Move device closer to WiFi access point
- Use WiFi extender or mesh network
OTA Update Fails
Symptoms: Can't update firmware wirelessly
Solutions:
- Verify OTA password correct in
secrets.yaml - Check device has stable WiFi connection
- Ensure enough free memory (check logs)
- Try USB flashing if OTA repeatedly fails
- Break up large config changes into smaller updates
- Temporarily increase OTA timeout:
ota: safe_mode: true
Best Practices
Security
-
Change default passwords in secrets.yaml:
- Use strong, unique passwords
- Store secrets.yaml securely
- Never commit secrets to git
-
Enable API encryption:
- Always use
api.encryption.key - Generate new key for each device
- Store keys in password manager
- Always use
-
Use static IPs for critical devices:
- Makes firewall rules easier
- More reliable than mDNS
- Set via DHCP reservation or device config
-
Isolate IoT devices:
- Use separate VLAN for automation devices
- Firewall rules to limit access
- Only allow Home Assistant to communicate
Maintenance
-
Regular backups:
- Weekly Home Assistant backups
- Store off-site (cloud storage)
- Test restore procedure
-
Update firmware:
- Check for ESPHome updates monthly
- Read release notes before updating
- Update one device first, test, then roll out
-
Monitor device health:
- Add uptime sensors
- Check WiFi signal strength
- Alert on device offline > 5 minutes
-
Document configuration:
- Comment YAML files
- Keep wiring diagrams
- Note customizations made
Performance
-
Optimize polling:
- Don't poll sensors too frequently
- Use
update_intervalappropriately - Fast changing: 100-500ms
- Slow changing: 30-60s
-
Reduce logging:
- Production:
logger: level: INFO - Only use
DEBUGwhen troubleshooting - Excessive logging impacts performance
- Production:
-
Network optimization:
- Use 2.4GHz WiFi (better range)
- 5GHz only for high-bandwidth needs
- Good WiFi coverage essential
Next Steps
Now that your devices are integrated with Home Assistant:
- Create Automations - Set up your first automation
- API Reference - Deep dive into configuration options
- Advanced Customization - Fine-tune device behavior
Questions? Visit the FAQ or contact support
Previous
—
Next
—