https://github.com/oakbrad/raspi-pir-mqtt-homeassistant
Simple script to read PIR sensor on Raspberry Pi and publish to MQTT, for use in HomeAssistant.
https://github.com/oakbrad/raspi-pir-mqtt-homeassistant
gpio hass homeassistant motion mqtt pir raspberrypi rpi sensor
Last synced: 23 days ago
JSON representation
Simple script to read PIR sensor on Raspberry Pi and publish to MQTT, for use in HomeAssistant.
- Host: GitHub
- URL: https://github.com/oakbrad/raspi-pir-mqtt-homeassistant
- Owner: oakbrad
- Created: 2017-06-04T22:49:38.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2017-06-04T22:59:44.000Z (almost 8 years ago)
- Last Synced: 2025-04-12T02:05:14.771Z (23 days ago)
- Topics: gpio, hass, homeassistant, motion, mqtt, pir, raspberrypi, rpi, sensor
- Language: Python
- Size: 1.95 KB
- Stars: 17
- Watchers: 1
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# raspi-pir-mqtt-homeassistant
Simple script to read PIR sensor on Raspberry Pi and publish to MQTT, for use in HomeAssistant.Instructions:
* Uses Paho MQTT library & process managed by forever
* Connect PIR sensor to 5v, Ground, and GPIO 4 on the Raspberry Pi
* Edit the script with your MQTT password, username, and host IP. You change the PIR GPIO if you hooked up to a different one
* forever start -c python3 raspi-pir-mqtt.pyIn Home Assistant, using the MQTT Binary Sensor component:
https://home-assistant.io/components/binary_sensor.mqtt/```yaml
binary_sensor:
- platform: mqtt
state_topic: "CHANNEL/Motion/Switch"
device_class: motion
payload_on: "1"
payload_off: "0"
name: "Motion Sensor"
```