Guide 9 : How to Integrate a Smart Plug with Home Assistant

Smart plugs are a great way to automate your appliances and control devices remotely. With features like energy monitoring, smart plugs also allow you to track power usage and optimize energy consumption. In this guide, we’ll walk you through how to set up a smart plug with Home Assistant and enable energy monitoring if your plug supports it.

What You Will Need:

  • A compatible smart plug (e.g., TP-Link Kasa, Sonoff S31, or other Zigbee/Wi-Fi-enabled plugs)
  • Home Assistant running on a Raspberry Pi, virtual machine, or server
  • Wi-Fi or Zigbee network setup depending on the plug type

Step 1: Prepare Your Smart Plug

Before integrating your smart plug with Home Assistant, make sure it’s powered on and connected to your network. Follow the manufacturer’s instructions to pair the plug with your phone app or Wi-Fi network.

Step 2: Integrate the Smart Plug into Home Assistant

Wi-Fi Smart Plug Integration:

If your smart plug connects via Wi-Fi (such as with TP-Link Kasa or other Wi-Fi plugs), you’ll need to use the Home Assistant TP-Link Kasa integration or the ESPHome integration if it’s a custom device.

  1. Open your Home Assistant UI.
  2. Navigate to Configuration > Devices & Services.
  3. Click Add Integration.
  4. Search for your smart plug’s brand (e.g., “TP-Link” for Kasa plugs or “Sonoff” for Wi-Fi plugs).
  5. Follow the on-screen instructions to connect Home Assistant to the smart plug. This may involve logging into your device’s cloud service (like TP-Link’s Kasa app) or directly connecting to the plug over Wi-Fi.

Zigbee Smart Plug Integration:

If your smart plug uses Zigbee (such as the IKEA Tradfri or Zigbee plugs from other manufacturers), you can add it through your Zigbee hub.

  1. Go to Configuration > Devices & Services.
  2. Click Add Device and choose Zigbee.
  3. Put your Zigbee plug into pairing mode (refer to the device’s manual).
  4. Once the plug is discovered, follow the prompts to add it to Home Assistant.

Step 3: Verify the Smart Plug in Home Assistant

Once your smart plug is successfully integrated, you should see it listed under Devices & Services.

  1. Go to Configuration > Devices & Services.
  2. Find your smart plug in the list of devices.
  3. Verify that the plug’s on/off switch is available. For smart plugs with energy monitoring capabilities, you should also see energy-related sensors, such as power usage (in watts), voltage, and current.

If the plug supports energy monitoring, you should see entities like:

  • sensor.smart_plug_power_usage (W)
  • sensor.smart_plug_current (A)
  • sensor.smart_plug_voltage (V)
  • sensor.smart_plug_energy_consumption (kWh)

Step 4: Add the Smart Plug to Your Dashboard

Now, let’s add the smart plug to your Home Assistant dashboard for easy control.

  1. Go to your Home Assistant Overview (Dashboard).
  2. Click on the three dots in the top right corner and select Edit Dashboard.
  3. Click Add Card and choose a card that suits your needs. For a smart plug, the Entities Card or Button Card would work well.
  4. Select the plug and any relevant energy sensors from the list of available entities.
  5. Save the card, and now you’ll have quick access to control the plug and monitor energy usage.

Step 5: Automate Your Smart Plug

You can create automations to turn your smart plug on or off based on various triggers, such as time, motion, or other device states.

Example: Turn on a Smart Plug at a Certain Time

  1. Go to Configuration > Automations.
  2. Click Add Automation and select Start with an empty automation.
  3. Under Trigger, select Time and choose your desired on-time (e.g., 7:00 AM).
  4. Under Action, select Device and choose your smart plug to turn it on.
  5. Click Save to activate the automation.

Example: Turn off a Smart Plug After It Has Been On for 1 Hour

  1. Go to Configuration > Automations.
  2. Click Add Automation and select Start with an empty automation.
  3. Under Trigger, select State and choose your smart plug (switch.smart_plug).
  4. Set the state to on and add a for duration of 1 hour.
  5. Under Action, select Device and choose your smart plug to turn it off.
  6. Click Save to activate the automation.

Step 6: Monitor Energy Consumption

If your smart plug supports energy monitoring, you can track how much energy your devices are consuming.

  1. Go to Developer Tools > States.
  2. Look for entities like sensor.smart_plug_power_usage or sensor.smart_plug_energy_consumption.
  3. You can add these sensors to your dashboard as well for real-time monitoring.

Example: Track Monthly Energy Usage in the History

To track energy usage over time, you can create a History Graph card:

  1. Go to your Dashboard and click Edit.
  2. Click Add Card and select the History Graph card.
  3. Choose the energy consumption sensor (e.g., sensor.smart_plug_energy_consumption).
  4. Save the card, and you’ll see the historical energy usage graph over time.

Step 7: Test Your Setup

Test the functionality of the smart plug by turning it on and off manually through Home Assistant, checking that energy usage is reported correctly if applicable. Make sure any automations you’ve set up trigger as expected.

Optional: Advanced Smart Plug Features

Some smart plugs offer additional functionality, such as:

  • Scheduling: Set schedules for when to turn on or off automatically.
  • Overcurrent protection: For certain high-powered devices, smart plugs may have built-in overcurrent protection. Check the manufacturer’s documentation for these options.
  • Energy efficiency mode: Some plugs may feature an energy-efficient mode to limit power usage during idle times.

Conclusion

You’ve now successfully integrated a smart plug with Home Assistant! Whether you’re controlling appliances, monitoring power consumption, or automating devices based on time or events, a smart plug offers plenty of possibilities to enhance your home automation. Energy monitoring features can give you more insight into your power usage, helping you optimize efficiency and save on electricity.

In the next guide, we’ll explore further use cases for smart plugs, including how to create more advanced automations and combine them with other devices for complex home automation setups.


This guide will help you integrate a smart plug with Home Assistant and take advantage of energy monitoring features if supported by your device!

Bonjour, il semble que vous visitez depuis la France.
En France, le nom commercial Smarthome-Europe est protégé, et utilisé par une société B2B qui n'est pas liée à ce site Smart Home Europe.
Leur site est : smarthome-europe.com