Last time, I asked you do you want me to create a Home Assistant Shelly Motion sensor integration tutorial and you said – YES, big time!

So I listen and execute. In this article I will try two methods:

  • Using the native Shelly integration for Home Assistant
  • Home Assistant Shelly Motion MQTT integration.

Let’s see what will happen.

What will you see in this article?

This article will not be a Shelly Motion review, as I already did that and If you wish you can see it right here.

Instead I will directly dive into the possible ways to use Shelly Motion with Home Assistant. We will start with the Native Home Assistant Shelly integration first and then I will continue with the Home Assistant Shelly Motion MQTT method.

I must say that one of the methods here is not working as it should be at the the time of writing this article. Can you guess which one is it in the comments below? You will see the correct answer later in the article.

Meanwhile, feel free to smash the like button for my Newsletter at any time.

Now let’s start this.

No Home Assistant? Here is what to do!

Check this article if you still do not have a Home Assistant.

You can see there all of the official Home Assistant installation methods and I’m demonstrating one of them in details.

My Shelly Motion is brand new! Here is what to do.

To complete this tutorial you will need Shelly Motion sensor that is already joined in your home Wi-Fi network. You can do that either by using the Shelly Cloud mobile app or manually from the Shelly Motion web interface.

Both methods are well described in my Shelly Motion Unbox & Review article – LINK

Native Home Assistant Shelly motion Integration

To add the Home Assistant Shelly Motion integration do the following:

UPDATE: Thanks to @Random Boy & @Adrian Petre that commented under the video in YouTube we have a fix now. In Shelly Motion web interface go to:

  • Internet & Security > COIOT > and Enable CoIoT
  • As Remote address type: YOUR_HOMEASSISTANT_IP:5683
If you enable CoIoT before adding the Shelly Integration everything is working perfectly.
If you enable CoIoT before adding the Shelly Integration everything is working perfectly.

If you skip the steps above your Shelly Integration will not work as expected.

In Home Assistant go to Configuration > Integrations > Add Integration and search for Shelly

You can also use the My Home Assistant feature by just click on the link below which will lead you to the same place.

Open your Home Assistant instance and start setting up a new integration.

Wake up your Shelly Motion Sensor either by shortly pressing the reset button or by just move in front of the sensor.

In the dialog enter the IP of the Shelly Motion and click SUBMIT.

Native Home Assistant Shelly motion Integration
Get your Shelly Motion IP from your router or from the web interface.

We now have the Shelly Motion sensor working with Home Assistant.

All of the Shelly Motion attributes/sensors: luminosity, motion, vibration & battery are only getting a snapshot of their current values and they are never updated again. To update their values you have to remove the integration and add it one more time, but then again they are just frozen. For me this integration is not usable that way.

If this native integration was working fine that would be the best option, but unfortunately this is not the case at least for now. Maybe in the future this will be fixed.

Meanwhile, If you manage to make it work somehow let me know in the comments section. I will add your solution to this Post, so everyone to see it 🙂

Home Assistant Shelly motion MQTT Integration

Home Assistant Shelly Motion MQTT integration is the other method that you can use.

Let’s see it.

MQTT Broker / Mosquitto

For this part, you must have a MQTT broker up and running. The easiest method is to install Mosquito as Home Assistant Add-On (Supervisor > Add-on Store > Mosquitto broker) or to install it standalone – LINK

Enable MQTT in Shelly Motion

Then go to Shelly Motion Web interface and under Internet & Security enable the MQTT option an enter your MQTT broker credentials. That way the Shelly Motion will connect to the MQTT broker and will start feeding it with real-time data. Don’t forget to save the changes.

Add MQTT integration in Home Assistant

You also have to add the MQTT integration in Home Assistant using the Integrations menu. That is very easy and here is what you have to do:

In Home Assistant go to Configuration > Integrations > Add Integration and search for MQTT

Or you can click on the link below and follow the instructions:

Open your Home Assistant instance and start setting up a new integration.

Shelly Motion MQTT Topics in Home Assistant

Edit the Home Assistant configuration (configuration.yaml file) just a little bit in order to add all of the Shelly Motion sensors (motion, luminosity, vibration) as Home Assistant sensors .

You can use a free tool called MQTT Explorer to see the available topics and to just copy them. I will paste the need YAML code below and the only thing that you have to do is to add your Shelly Motion MQTT state topic in the state_topic section for every sensor. In other words just replace the shellies/shellymotionsensor-YOUR_SHELLY_MOTION_ID/status with yours in the configuration.yaml file in your Home Assistant.

# configuration.yaml entry
- platform: mqtt
  name: “IsShellyMotionDetected”
  state_topic: "shellies/shellymotionsensor-YOUR_SHELLY_MOTION_ID/status"
  value_template: "{{ value_json.motion }}"
- platform: mqtt
  name: “IsShellyMotionVibrationDetected"
  state_topic: "shellies/shellymotionsensor-YOUR_SHELLY_MOTION_ID/status"
  value_template: "{{ value_json.vibration }}"
- platform: mqtt
  name: “ShellyMotionLux”
  state_topic: "shellies/shellymotionsensor-YOUR_SHELLY_MOTION_ID/status"
  value_template: "{{ value_json.lux }}"
  unit_of_measurement: ‘lx’
- platform: mqtt
  name: “ShellyMotionBattery”
  state_topic: "shellies/shellymotionsensor-YOUR_SHELLY_MOTION_ID/status"
  value_template: "{{ value_json.bat }}"
  unit_of_measurement: '%'

Save the configuration.yaml file and either restart your Home Assistant or Reload Manually Configured MQTT Entities from Configuration > Server Controls.

To check if the new Shelly Motion sensors are available and working in Home Assistant you can try to add a new Home Assistant card with the new MQTT entities.

Adding Home Assistant Card Shelly Motion MQTT sensors card
Adding Home Assistant Card Shelly Motion MQTT sensors card

Home Assistant Shelly Motion automation

Home Assistant and Shelly Motion Sensor integration over MQTT is working fine.

Let’s create a quick Home Assistant automation that will create a persistent message when motion is detected. Open your automations.yaml file and paste the following YAML code inside:

# automations.yaml entry
- id: '1615465470665'
  alias: Motion is detected
  description: ''
  - platform: state
    entity_id: sensor.YOUR_SHELLY_MOTION_SENSOR
    to: 'True'
  condition: []
  - service: persistent_notification.create
      message: motion is detected maybe someone is hitting the like button
  mode: single

Don’t forget to change YOUR_SHELLY_MOTION_SENSOR with the name of your motion sensor. Save the file and reload the automations. Now, if the Shelly Motion sensor detect any movement the text that is defined in the message will appear in Home Assistant as persistent notification.

Home Assistant Shelly Motion Blueprint

I will show you how to use the latest My Home Assistant feature to import my custom Shelly Motion Blueprint that will help creating Shelly Motion sensor automations a faster and a lot easier.

Click on the following link to add my custom Home Assistant Shelly Motion Blueprint:

Open your Home Assistant instance and show the blueprint import dialog with a specific blueprint pre-filled.
Home Assistant Shelly Motion Blueprint
Home Assistant Shelly Motion Blueprint

Now you can create automations based on this Shelly Motion Blueprint.

Where to buy Shelly Motion?

If you want to buy Shelly Motion, you can use the Shelly official store and my affiliate link below, doing so I will earn some small commission from your purchases with no additional cost for you:

UPDATE: Shelly Motion was discontinued and replaced by Shelly Motion 2 which is almost the same but a bit better and at the same price!


With that being said we can conclude our Home Assistant Shelly Motion journey for now. I wish you to stay safe and don’t forget Home Smart, But Not Hard.

Thank you for reading and I will see you in my next article.


Bieniu · 18/03/2021 at 9:25 pm

If you prefer MQTT you can use Shellies Discovery.

    Kiril · 23/03/2021 at 9:26 pm

    Thanks for the hint I’ve only heart about that and I never use it till the moment 🙂

Nicola Pavan · 08/04/2021 at 6:49 pm

Hi all, is possible on home assistent with mqtt enable/disable motion detection?
I wolud create a button to have this task available 🙂


    Kiril · 09/04/2021 at 11:59 pm

    Not sure about that. The only thing that I could think of is to call a REST command from HA to do that if the Shelly Web interface support that for enabling/disabling the motion detection. You can try it and let us know the result.

Rob Miller · 05/08/2022 at 4:45 pm

My experience is somewhat different. Using Mosquitto MQTT at the command line I see occasional message sets from the Shelly Motion 1, but in fact nothing is sent for a motion or vibration event. Now on firmware version 2.17 their support has confirmed to me that “others have also complained” and they – as yet – have no firmware version that actually sends a timely motion detected event.

Darcy · 28/08/2023 at 3:07 am

You cannot paste this code into configuration.yaml

It shows many error messages.

If you do not test your posts with more current versions of Home Assistant, and create failures when people try to follow your suggestions, you will lose subscribers.

Leave a Reply

Avatar placeholder

Your email address will not be published. Required fields are marked *