Voice Control with Alexa and Google Home

Control your ESP32 devices with voice commands through Home Assistant

Once your ESP32 sensors and actuators are connected to Home Assistant, adding voice control is surprisingly straightforward. You can ask Alexa for the temperature in your greenhouse, tell Google to turn on the garden pump, or have Siri check the soil moisture -- all reading data from and sending commands to your ESP32 devices.

In this article, you will learn how to expose Home Assistant entities to voice assistants and set up practical voice commands for your ESP32 projects.

🔗How It Works

Voice assistants do not talk to your ESP32 directly. The chain looks like this:

graph LR
    V[Voice Assistant<br>Alexa / Google] <-->|cloud| HA[Home Assistant]
    HA <-->|local network| E[ESP32<br>Sensors & Actuators]

You speak to Alexa or Google, which sends the request to Home Assistant. Home Assistant translates it into the appropriate action -- reading a sensor value or controlling a switch -- and communicates with the ESP32 over your local network (via ESPHome API or MQTT).

The voice assistant never communicates with the ESP32 directly. It only talks to Home Assistant, which acts as the bridge.

🔗Setup Options

There are two ways to connect Home Assistant to voice assistants:

MethodCostDifficultySupports
Home Assistant Cloud (Nabu Casa)6.50 USD/monthVery easyAlexa, Google, Siri (via HomeKit)
Manual setupFreeAdvancedAlexa (requires AWS Lambda), Google (requires Google Cloud project)

Home Assistant Cloud, provided by Nabu Casa, is a paid service that handles all the complexity of connecting to Alexa and Google Home. Here is why it is worth the cost:

  • No port forwarding -- Nabu Casa creates a secure tunnel to your Home Assistant instance, so you do not need to expose your network to the internet.
  • No cloud accounts to configure -- you do not need an AWS developer account or Google Cloud project.
  • Automatic certificate management -- HTTPS is handled for you.
  • Supports Alexa, Google Home, and HomeKit -- all three from a single subscription.
  • Funds Home Assistant development -- Nabu Casa is the company behind Home Assistant, so your subscription directly supports the open-source project.
  • Setup takes 5 minutes -- compared to hours for the manual approach.

The manual setup is technically free, but it requires creating developer accounts on Amazon or Google, setting up cloud functions, configuring OAuth, and managing SSL certificates. Unless you have a specific reason to avoid the subscription, Nabu Casa saves significant time and frustration.

🔗Setting Up Nabu Casa

🔗Step 1: Subscribe

  1. Go to Settings > Home Assistant Cloud in your Home Assistant instance.
  2. Click Start your free trial (30 days free, then 6.50 USD/month).
  3. Create a Nabu Casa account with your email and a password.
  4. Confirm your email address.

After logging in, you will see the Cloud dashboard with options for Alexa, Google Assistant, and remote access.

🔗Step 2: Enable Remote Access

On the Cloud page, toggle Remote Control to on. This creates a secure URL (like https://abcdef123456.ui.nabu.casa) that you can use to access Home Assistant from outside your network. This same tunnel is used by voice assistants.

🔗Step 3: Connect Alexa

  1. On the Home Assistant Cloud page, find the Alexa section and click Enable.
  2. Open the Amazon Alexa app on your phone.
  3. Go to More > Skills & Games and search for Home Assistant.
  4. Enable the skill and sign in with your Nabu Casa account.
  5. Alexa will discover your exposed entities. Say "Alexa, discover my devices" to trigger discovery.

🔗Step 4: Connect Google Home

  1. On the Home Assistant Cloud page, find the Google Assistant section and click Enable.
  2. Open the Google Home app on your phone.
  3. Tap + (Add) > Set up device > Works with Google.
  4. Search for Home Assistant and sign in with your Nabu Casa account.
  5. Your exposed entities will appear in the Google Home app.

🔗Step 5: Connect Apple HomeKit (Optional)

Nabu Casa also supports HomeKit, which means Siri can control your devices:

  1. On the Cloud page, find the HomeKit section.
  2. A QR code and pairing code will be displayed.
  3. Open the Home app on your iPhone or iPad.
  4. Tap + > Add Accessory and scan the QR code.

🔗Choosing Which Entities to Expose

By default, Home Assistant does not expose all entities to voice assistants. You control which entities are available:

  1. Go to Settings > Voice Assistants.
  2. Click on Expose (tab at the top).
  3. You will see a list of all your entities. Toggle the ones you want to expose to Alexa, Google, or both.

🔗Which Entity Types Work with Voice

Entity TypeAlexaGoogle HomeExample Voice Command
LightsYesYes"Turn on the kitchen light"
SwitchesYesYes"Turn off the garden pump"
SensorsYes (read values)Yes (read values)"What is the temperature in the office?"
ClimateYesYes"Set the thermostat to 22 degrees"
CoversYesYes"Close the garage door"
FansYesYes"Turn on the bedroom fan"
LocksYes (with PIN)Yes (with confirmation)"Lock the front door"
ScenesYesYes"Activate movie night"
ScriptsYes (as scenes)Yes (as scenes)"Run the watering script"

Sensors are read-only -- voice assistants can report their values but obviously cannot change them. Switches and lights support on/off commands and (for lights) brightness and color control.

🔗Naming Conventions

How you name your entities and areas in Home Assistant directly affects how natural your voice commands sound. Voice assistants match names loosely, but good naming makes commands more reliable.

🔗Tips for Good Naming

Use room names as areas, not in entity names:

  • Good: Entity named "Temperature" in area "Office" -- "Alexa, what is the temperature in the office?"
  • Less good: Entity named "Office Temperature" with no area -- "Alexa, what is the office temperature?" (works, but less natural)

Use simple, descriptive names:

  • Good: "Garden Pump" -- "Turn on the garden pump"
  • Bad: "ESP32 Relay Module GPIO26" -- voice assistants will struggle with this

Avoid duplicate names across areas:

  • Each area can have a "Temperature" sensor, and voice assistants will distinguish them by area: "What is the temperature in the greenhouse?" vs. "What is the temperature in the office?"
  • If two entities have the same name in the same area, voice assistants get confused

Use singular nouns for devices:

  • "Desk lamp" not "Desk lamps"
  • "Garden pump" not "The garden pump relay switch"

🔗Setting Up Areas

Properly configured areas make voice commands more natural:

  1. Go to Settings > Areas & Zones.
  2. Create areas that match your physical spaces: "Living Room," "Office," "Greenhouse," "Garden."
  3. Assign each device to its appropriate area.

Now instead of saying "Turn on the living room light switch," you can say "Turn on the light in the living room" -- more natural and more reliable.

🔗Practical Voice Command Examples

Here are real examples using ESP32 devices connected to Home Assistant:

🔗Reading Sensor Values

Setup: ESP32 with BME280 in the greenhouse, entity named "Temperature" in area "Greenhouse."

Voice CommandResponse
"Alexa, what is the temperature in the greenhouse?""The temperature in the greenhouse is 24.5 degrees"
"Hey Google, what is the humidity in the greenhouse?""The greenhouse humidity is 62 percent"
"Alexa, what is the temperature in the office?""The temperature in the office is 22.1 degrees"

🔗Controlling Switches

Setup: ESP32 with a relay controlling a water pump, entity named "Garden Pump" in area "Garden."

Voice CommandResult
"Alexa, turn on the garden pump"Relay activates, pump turns on
"Hey Google, turn off the garden pump"Relay deactivates, pump turns off
"Alexa, is the garden pump on?""The garden pump is off"

🔗Controlling Lights

Setup: ESP32 with a PWM-controlled LED strip, entity named "Desk Lamp" in area "Office."

Voice CommandResult
"Alexa, turn on the desk lamp"LED turns on at last brightness
"Hey Google, set the desk lamp to 50 percent"LED dims to 50% brightness
"Alexa, dim the desk lamp"LED dims by a step

🔗Activating Scenes

Setup: A Home Assistant scene named "Movie Night."

Voice CommandResult
"Alexa, activate movie night"All entities in the scene change to their defined states
"Hey Google, activate movie night"Same as above

🔗Exposing ESP32 Sensors: Greenhouse Example

Let us walk through a complete example. You have an ESP32 with a BME280 in your greenhouse, connected via MQTT (as described in previous articles). Here is how to make its temperature readable by voice.

🔗1. Verify the Entity Exists

Go to Developer Tools > States and search for your temperature entity. It might be called sensor.greenhouse_sensor_temperature. Note the exact entity ID.

🔗2. Set the Area

  1. Go to Settings > Devices & Services > MQTT and find your greenhouse device.
  2. Click on it, then click the pencil icon to edit.
  3. Set the Area to "Greenhouse" (create it if it does not exist).

🔗3. Set the Entity Name

The entity name should be simple -- just "Temperature." Home Assistant combines the area and name for voice commands.

  1. Click on the temperature entity.
  2. Click the gear icon.
  3. Set the Name to "Temperature."

🔗4. Expose to Voice Assistants

  1. Go to Settings > Voice Assistants > Expose.
  2. Find sensor.greenhouse_sensor_temperature.
  3. Toggle on Alexa and/or Google Assistant.

🔗5. Test

Say: "Alexa, what is the temperature in the greenhouse?"

Alexa should respond with the current reading from your ESP32 BME280 sensor.

🔗Exposing ESP32 Relays: Garden Pump Example

For controlling an ESP32 relay via voice:

🔗1. Verify the Switch Entity

Check Developer Tools > States for your switch entity, e.g., switch.garden_pump.

🔗2. Set Area and Name

Assign the switch to the "Garden" area with the name "Pump" or "Garden Pump."

🔗3. Expose to Voice Assistants

Toggle on Alexa and/or Google Assistant in the Expose settings.

🔗4. Test

Say: "Alexa, turn on the garden pump."

The command travels from Alexa's cloud to Home Assistant (via Nabu Casa), which publishes an MQTT message to your ESP32, which switches the relay. The entire chain takes about 1-2 seconds.

🔗Limitations and Tips

🔗Response Time

Voice commands go through the cloud (Amazon/Google) to Nabu Casa to your Home Assistant. Expect 1-3 seconds of latency. For sensor readings, the voice assistant reports the last known value from Home Assistant, which may be a few seconds or minutes old depending on your update interval.

🔗Sensor Update Frequency

If your ESP32 sensor node uses deep sleep and reports every 5 minutes, the voice assistant will read the last reported value. For frequently-asked sensors (like greenhouse temperature), consider a shorter update interval or use a powered (non-battery) sensor node.

🔗Unavailable Entities

If an ESP32 device is offline, the entity will show as "Unavailable" in Home Assistant. Voice assistants will report "That device is not responding" or similar. Make sure your ESP32 devices have reliable WiFi connectivity.

🔗Privacy Considerations

All voice commands are processed in the cloud (Amazon's or Google's servers). If privacy is a concern:

  • Use voice control only for non-sensitive devices
  • Consider running a local voice assistant. Home Assistant supports local voice processing through its Assist pipeline with Wyoming protocol and a local speech-to-text engine. This keeps everything on your network but requires more setup.

🔗Multiple Voice Assistants

You can use Alexa and Google Home simultaneously. Both connect to the same Home Assistant instance and see the same entities. This is useful if different family members prefer different assistants.

🔗Voice Assistant Rooms

Both Alexa and Google Home have their own room/area concepts. When you expose entities from Home Assistant, the areas you defined in HA are carried over. However, you may need to assign devices to rooms within the Alexa or Google Home app for the most natural experience.

🔗Quick Troubleshooting

ProblemCauseSolution
"I cannot find that device"Entity not exposedCheck Settings > Voice Assistants > Expose
"That device is not responding"ESP32 offline or entity unavailableCheck the entity state in Developer Tools
Wrong sensor value reportedStale data from deep sleepReduce sleep interval or use a powered sensor
Voice command controls wrong deviceAmbiguous namingRename entities to be unique; assign proper areas
Alexa/Google does not discover devicesIntegration not linkedRe-enable the skill/integration in the Alexa/Google app
"I do not know that" for sensor queriesEntity type not supportedEnsure the entity has the correct device_class set
Voice commands work but are slowHigh latency to cloudNormal (1-3 seconds). Consider local Assist for lower latency.

🔗Summary

Voice control is the final piece of the home automation puzzle. Your complete system now looks like this:

graph TB
    subgraph "Physical Layer"
        S1[ESP32 + BME280<br>Greenhouse]
        S2[ESP32 + Relay<br>Garden Pump]
        S3[ESP32 + Sensor Node<br>Multi-sensor]
    end
    subgraph "Controller"
        HA[Home Assistant]
    end
    subgraph "Interfaces"
        D[Dashboard]
        A[Automations]
        V[Voice Assistants]
        N[Notifications]
    end
    S1 -->|MQTT / ESPHome| HA
    S2 -->|MQTT / ESPHome| HA
    S3 -->|MQTT / ESPHome| HA
    HA --> D
    HA --> A
    HA <--> V
    HA --> N

Your ESP32 devices collect data and control actuators. Home Assistant ties everything together with dashboards, automations, notifications, and now voice control. You can monitor your greenhouse temperature on a dashboard, get notified when your plants need water, have the lights turn on automatically at sunset, and ask Alexa for the current temperature -- all powered by inexpensive ESP32 boards and open-source software.