Combining a smart plug with motion sensors


Newbie here.
I just bought/connected and got the c7 up and running.

I also bought a tp-link Kasa smart plug, Hue motion sensor and Xiaomi mi motion sensor (YTC4041GL)
I've downloaded the Package Manager and the kasa plug integration, so I am able to control the smart plug from the hubitat.

I've connected the smart plug to a regular power socket that controls a light source and my goal is to add the Hue motion sensor or Xiaomi mi motion sensor to the chain, so that one of them will make the plug/light source turn off when I'm not around and, of course, turn on when the sensor detects movement.

Can I integrate the Hue motion sensor or Xiaomi mi motion sensor to the chain? If yes, what's the best method to do it?

First, welcome to HE and to the forum. You'll find lots of helpful folks and TONS of opinions.

Particularly if you're just starting out I'd suggest sticking with zigbee and zwave devices that are on the compatibility list. Doesn't mean you can't get other stuff to work just fine, but it sometimes requires more fiddling. You'll also find a lot of folks here (me included) that suggest you avoid wifi devices unless there really is no alternative. Most of them require some sort of cloud integration point, which sort of defeats the whole "local control" benefit of HE. I'm not sure if the Kasa stuff has this limitation but it may. The Xiaomi devices in particular can be problematic because they do not fully implement the Zigbee standard. Some folks have had good luck with them. I am not one of those people.

The hue motion sensors work well, and you do not need a Hue hub to pair them directly with HE. I find the indoor motion sensor mounting system is a little underwhelming but that could just be me.

Check out the motion and mode built in lighting app. It'll do everything you want.


Certainly, it's not too difficult. Welcome to Hubitat! I started with Wink myself, took a small foray into HomeSeer, then landed on Hubitat and like this platform far above the others.

I don't have any experience with either of those sensors, but if you have any challenges pairing with Hubitat, you can search this forum and usually find a solution. Here is a post on the Hue Sensor:

For the integration you're looking for, install the Rule Machine app (it's a built-in app). Very powerful, and there are many topics on how to build rules for a wide variety of applications, including what you are looking for.

Good luck, and by all means, reach out to the community if you get stuck or run into any problems!


Thanks for the greetings.
Yeah, I should have done a bit of research on which devices work best with HE before I bought the mentioned devices.
Thanks for the link. I'll dive into it and try to find a solution.

I just did the exact thing yesterday. I had a Kasa smart plug that I plugged into a light in the basement and positioned a Hue motion sensor so that when I'm near the area, the light goes on. The light goes off 5 minutes after no motion is detected. I almost use Simple Automation exclusively. Easy peasy.

edit: Hue motion is supported natively-something like generic zigbee motion sensor. Hubitat id's it automatically upon discovery. The Kasa integration is great.

1 Like

Thanks for the greetings and also for the link and the Rule Machine app tip.
I'll will look into it and hopefully figure it out myself.
If not, good to know that you're here for more assistance.

Oh ,that's exactly what I need! Can you please explain how you did it? what is "Simple Automation"?

You go into Apps, add Simple Automation Rules, and go from there.
I think you have to do a little reading and experimenting.
Here's just a tiny bit of my rules, lol:

I sure have a lot to learn :relaxed:
Thanks for this. It's a start. You're stirring me in the right direction.

1 Like

No problem - the learning will come quickly and lots of people out here to help.

To add to previous comments and a comparison:
Simple automation is a simpler set of automation rules/routines that you can implement to do common routines. Turn on lights at sunset off at sunrise/etc. Powerful within their own right, designed to be easier to use for most common actions. Definitely a good place to start.

Rule Machine is more complex and thorough. Not difficult, and easy to learn, especially if you understand and have no issues implementing logic flow. Automation possibilities are virtually endless under Rule Machine.


Ok, so I was able to create a rule via rule machine where if the motion sensor is activated the lights that I want to be on are on, and when inactivated, the lights go off.

My issue is that the sensor is in my kitchen and it's activating the kitchen sink light, so if I'm cleaning the dishes in the sink and not moving so much, the lights go off and I need to make a move or wave in order for the lights to go on again.

Is there a way to make it more sensitive or any other trick?

Put a delay on the OFF action, or probably better in this case, add a wait event with a delay (wait for sensor inactive, timeout xxx ). Many discussions about how to do that, here is one which I think covers what you're trying to do:

The wait starts when no motion, then xx minutes must pass before moving on to the next step (turn off). Any motion retriggers / restarts the wait event.

Here is another with a more detailed discussion of delays and wait events:

Needlessly complex for this situation.

Yes, you can adjust the sensitivity of the Hue motion sensor in the device page.

Also, you have to figure out how long you could be motionless: 5 minutes, 10 minutes, etc. Motion sensors can be tricky to get to do what you want.

I suggest you use the Simple Automation Rules app. It's much simpler.