Quick Answer

Shelly devices work in HA two ways: the native Shelly integration (local push, zero config) or MQTT (push-based, and the same data is available to Node-RED and other tools). For MQTT, configure your Shelly device to publish state to your Mosquitto broker, then set up MQTT sensors and switches in HA. Commands and state updates happen in under 100ms.

Table of Contents

  1. Native Integration vs MQTT
  2. Setting Up MQTT on the Shelly Device
  3. HA YAML Config (Real)
  4. Push Update Example
  5. Energy Monitoring Automation
  6. Troubleshooting
  7. FAQ

What You Need

Native Shelly Integration vs MQTT

HA's built-in Shelly integration auto-discovers devices and gets pushed updates from them: CoIoT for Gen1, RPC for Gen2 and later. It's easy to set up (zero config) and supports every Shelly generation (Gen1, Gen2 Plus/Pro, Gen3 and Gen4), with a few limitations:

MQTT mode is also push-based: the Shelly device publishes state changes the instant they happen, with <100ms round-trip for switches and energy readings. The data lands on your broker, so any MQTT client can use it.

Recommendation

Use the native Shelly integration for simple setups with a few devices. Switch to MQTT if you have many Shelly devices, have trouble with Gen1 CoIoT updates, or want to use the same MQTT data in Node-RED or other systems.

Setting Up MQTT on the Shelly Device

For older Shelly Gen1 devices (Shelly 1, 2.5, Plug S):

  1. Open the Shelly device web UI (navigate to its IP in your browser, e.g., http://192.168.1.105)
  2. Go to Settings → MQTT
  3. Enable MQTT and enter:
    • Server: 192.168.1.100 (your HA IP)
    • Port: 1883
    • Username: your HA username
    • Password: your HA password
  4. Click Save — the device reconnects and starts publishing to MQTT

For Shelly Gen2, Gen3 and Gen4 devices (Plus, Pro, Mini, Gen3, Gen4):

  1. Open the Shelly device web UI
  2. Go to Settings → MQTT
  3. Enable MQTT and configure broker IP, port, and credentials
  4. Set the topic prefix (the default is the device ID, e.g. shellyplus1pm-DEVICEID)
  5. Save and reboot

HA YAML Config for Shelly via MQTT

Add these to your configuration.yaml. Replace shelly1pm-A1B2C3 with your device's MQTT topic prefix (visible in the Shelly web UI under MQTT settings):

configuration.yaml — Shelly 1PM via MQTT
mqtt:
  switch:
    - name: "Kitchen Light Relay"
      unique_id: kitchen_light_shelly
      state_topic: "shellies/shelly1pm-A1B2C3/relay/0"
      command_topic: "shellies/shelly1pm-A1B2C3/relay/0/command"
      payload_on: "on"
      payload_off: "off"
      state_on: "on"
      state_off: "off"
      availability_topic: "shellies/shelly1pm-A1B2C3/online"
      payload_available: "true"
      payload_not_available: "false"
      optimistic: false

  sensor:
    - name: "Kitchen Power"
      unique_id: kitchen_power_shelly
      state_topic: "shellies/shelly1pm-A1B2C3/relay/0/power"
      unit_of_measurement: "W"
      device_class: power
      state_class: measurement

    - name: "Kitchen Energy"
      unique_id: kitchen_energy_shelly
      state_topic: "shellies/shelly1pm-A1B2C3/relay/0/energy"
      unit_of_measurement: "Wmin"
      device_class: energy
Gen2 and later devices use a different topic structure: Shelly Gen2, Gen3 and Gen4 devices (Plus/Pro series and newer) use shellyplus1pm-DEVICEID/status/switch:0 with JSON payloads. The native HA Shelly integration handles them automatically; manual MQTT config requires parsing JSON with value_templates.

Push Update Example

When you flip the physical switch on a Shelly 1PM, it immediately publishes:

MQTT topic published by Shelly on state change
Topic:   shellies/shelly1pm-A1B2C3/relay/0
Payload: on

Topic:   shellies/shelly1pm-A1B2C3/relay/0/power
Payload: 47.3

Topic:   shellies/shelly1pm-A1B2C3/relay/0/energy
Payload: 15423

HA receives these within milliseconds and updates the entity state — no polling delay.

Energy Monitoring Automation

automations.yaml — Notify when washing machine finishes
automation:
  - alias: "Washing machine finished"
    description: "Detect when washing machine drops from high to low power"
    trigger:
      - platform: numeric_state
        entity_id: sensor.washing_machine_power
        below: 5
        for:
          minutes: 3
    condition:
      - condition: numeric_state
        entity_id: sensor.washing_machine_power
        above: 0
        value_template: >
          {{ states('sensor.washing_machine_power') | float > 0 }}
    action:
      - service: notify.mobile_app_your_phone
        data:
          title: "Washing Done! 🧺"
          message: "The washing machine has finished its cycle."

Troubleshooting

FAQ

Do Shelly devices work without the cloud?

Yes — Shelly devices have always supported local operation. They have a local REST API and MQTT support. The Shelly Cloud is optional and can be disabled in the device settings.

Should I use the native Shelly integration or configure MQTT manually?

Start with the native integration — it works well and requires zero config. Switch to manual MQTT only if you need real-time push updates or want to share Shelly data with non-HA systems.

Can Shelly devices act as Zigbee repeaters?

No — Shelly devices are Wi-Fi only. They don't participate in the Zigbee mesh. For Zigbee mesh extension, use Zigbee-based smart plugs or bulbs as repeaters.

SmartWired uses affiliate links. If you buy through our links, we may earn a commission at no extra cost to you. See our Affiliate Disclosure.