Motion Sensor Basic Question

Hi all, pretty new to HASS, just wanting to set up a simple project. Are there any single cheap motion sensors? Are there any that just directly be set up and accessed from Home assistant, or do they have to go through a hub/ require other accounts for (like having to download Panasonic’s app if i bought one from them to set it up). Im looking to just buy a single motion sensor but I am not sure if you need all these other products that are generally bundled with the motion sensors from my findings (generally they come with hubs that control the device ect but I just want to know if theres a option that ignores all this). Any tips much appreciated! :^)

If you are basing your HA setup off a Raspberry Pi it is extremely easy to wire a PIR sensor in. I have one on my Pi and it was three wires and a tiny bit of config adjustments and it was up and running. I think the sensor was 9 or 10 dollars from Radio Shack, however, you can get them pretty cheap online .

Thanks for the reply! I do not have much experience manually doing stuff like that haha but im sure i could learn, do you know if there is a sensor thats available on the components page that I could just buy and configure from there or would they all need hubs ect? If the only solution is to get a Raspberry Pi and wire in a Sensor, do you know of a resource I could follow to add the component? Also in the future I may want to start adding more motion detectors, would this method be suitable for that?

Thanks!

Im hoping that the xiaomi smart home gear will work (they are currently integrating it into HASS at the moment, and my gear should arrive soon.

Their hub is about USD25, and each motion sensor is about USD10.

perhaps have a look in january and see how people have progressed on the integration of it into HASS.

read here for xiaomi integration thread

1 Like

Most of the cases cheap and much work, expensive and easy is the factors that fits together when it comes to IOT, and mostly other things also.

The cheapest and easiest in my opinion is to go for a ESP8266 wifi module loaded with ESPEasy firmware and then use MQTT to send the message to HA with. The ESP8266 connects to your wifi network and doesn’t require any hub to use it.
One of the ESP8266 development boards(Nodemcu, Wemos, Witty) and a simple PIR motion sensor would cost around USD 4 from china, then you need a USB charger or UBS connection to power it, it could also be powered by battery if you put it in deep sleep. The ESP8266 could also be easily extended with additionally sensors that you might want, if you connect a BME280 sensor you would have temperature, humidity and pressure for instance, and you can build all that for around USD 8.

Information about the MQTT component: https://home-assistant.io/components/mqtt/
Here you’ll find information about the ESPEasy firmware: http://www.letscontrolit.com/wiki/index.php/ESPEasy

3 Likes

Thanks for the replies :smiley:

@Ree, i just had the Xiaomi motion sensors integrated, thanks to the work of a couple of people. It isn’t quite a HASS component yet, but it looks like it is going to be a cheap, neat and reliable solution. There are two issues i have:

  • the beam is angled downwards, which means installing them upside down will be an issue (ie on the ceiling)
  • I dont know what the battery life will be like, or if they report on low battery.

you can get a hub for $25 USD, and each sensor is ~$10 USD.

1 Like

How did you do it?

I’m running the ESPEasy setup and it asks for the broker I’m going to use.
What should I select to connect it with HA?
I was thinking about the mosquitto broker but I don’t see how/where I can select that.

Are you sure it is asking for what broker you are going to use? Or do you mean protocol as shown in this picture?

Yes sorry I mean protocol :).

Also I don’t see the PIR device I have in the Devices tab.
I have this HC-SR501 PIR Motion Sensor Module
any idea how I can add that?

edit: I got it working!
I used the openhab mqtt protocol and changed a few other things and now it works! :slight_smile:

Seems like you got it all figured out by your own :slight_smile:

This is also good reading regarding the espeasy firmware and HA:

Did you get the PIR sensor working? Have not build one yet, just know it should work

Almost.

I still have this error in the log:
_ 17-01-06 23:10:45 homeassistant.helpers.template: Error parsing value: ‘int object’ has no attribute ‘state’ (value: 1, template: {{ value_json.state.status }})_

This is my config:
_ _binary_sensor:_ _ platform: mqtt_ _ name: 'PIR1'_ _ state_topic: "/esp1/pir/switch"_ _ value_template: '{{ value_json.state.status }}' _ _ payload_on: "1"_ _ payload_off: "0" _ _

Any idea what I’m doing wrong?

Fixed this as well, I just took out the value template:

binary_sensor:
  platform: mqtt
  name: 'PIR1'
  state_topic: "/esp1/pir/switch"
  payload_on: "1"
  payload_off: "0" 

I’ll post everything I did to get it working in another post soon.

1 Like

Hi, I’m successfully running a temperature sensor and a relay on the esp easy firmware linked to Hass, but can’t make the PIR work on it. can you share your esp easy firmware config for your PIR and the way you wire it?
As info:
The PIR is running on 3.3v (bypassing the voltage regulator).
I’m using the release 120 of easy esp.
I’ve tried to make it work as a regular switch but the thing is that I can’t figure out how to configure the esp(01) gpio as a right input for it since I need to monitor the 3.3v/0v PIR state.

Thanks for your help.

I have this PIR: https://www.aliexpress.com/item/Free-shipping-1PCS-LOT-HC-SR501-HCSR501-SR501-human-infrared-sensor-module-Pyroelectric-infrared-sensor-imports/2036142641.html
and connected it to a Wemos D1 Mini:
5V
Ground
D7

then try this config:
http://imageshack.com/i/pmbfBHDWp
http://imageshack.com/i/pnwg1n5Pp

and in your HASS config:

binary_sensor:
  platform: mqtt
  name: 'PIR1'
  state_topic: "/esp1/pir/switch"
  payload_on: "1"
  payload_off: "0" 

@PuckStar how did you power your esp?

Normal microusb adapter. Like to charge your phone.

But I have issues with the setup because apparently the wifi is interfering a lot with the PIR. I found many complaints about this on the interwebs. It’s triggering like every 5 minutes
Solutions (that I didn’t try yet) are: have the PIR sensor far away from the ESP (like more than 1 meter), or let the ESP go in deep sleep and only wake up when the PIR detects motion (to pass the signal to the mqtt broker), and then go to sleep again.

1 Like

This is a common issue with PIR/ESP8266. Solution that Bruh figured out is the actual motion sensor needs to be a certain kind. AM312 pir sensor. Check out his multi sensor video on YouTube, around 6:30 to get more details. Once I got these sensors, I had no problem. I’ve now got 4 motion sensors in my house, using esp easy and actually lights up rooms in floorplan. Pretty neat.

@Kareem could you provide details on getting a relay working with esp easy? I’m stuck on getting any relay working. I’ve got esp12e, d1 mini and basic relay as well as a d1 relay shield. No matter what I try, the relay doesn’t seem to trigger. Maybe direct message me so I’m not highjacking the thread. Thanks in advance.

Hello there! Could you!? :slight_smile: