{"id":15086203,"url":"https://github.com/soerenschneider/gobot-pir","last_synced_at":"2026-02-05T07:02:24.091Z","repository":{"id":38297922,"uuid":"404985168","full_name":"soerenschneider/gobot-pir","owner":"soerenschneider","description":"Configurable motion detection bot sending events via MQTT and exposing metrics","archived":false,"fork":false,"pushed_at":"2025-02-18T21:47:23.000Z","size":278,"stargazers_count":0,"open_issues_count":12,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-07-19T23:29:33.537Z","etag":null,"topics":["gobot","golang","home-assistant","mqtt","pir-sensor","raspberry","sensors"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/soerenschneider.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2021-09-10T06:55:23.000Z","updated_at":"2024-06-10T08:18:36.000Z","dependencies_parsed_at":"2023-10-16T11:12:35.648Z","dependency_job_id":"c6a06bba-d699-46b5-b5c2-b93582ec7b1f","html_url":"https://github.com/soerenschneider/gobot-pir","commit_stats":{"total_commits":99,"total_committers":4,"mean_commits":24.75,"dds":"0.46464646464646464","last_synced_commit":"8f5538d8dfd29fc677525de4847f125afba3ec0c"},"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"purl":"pkg:github/soerenschneider/gobot-pir","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/soerenschneider%2Fgobot-pir","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/soerenschneider%2Fgobot-pir/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/soerenschneider%2Fgobot-pir/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/soerenschneider%2Fgobot-pir/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/soerenschneider","download_url":"https://codeload.github.com/soerenschneider/gobot-pir/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/soerenschneider%2Fgobot-pir/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29114965,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-05T05:31:32.482Z","status":"ssl_error","status_checked_at":"2026-02-05T05:31:29.075Z","response_time":65,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["gobot","golang","home-assistant","mqtt","pir-sensor","raspberry","sensors"],"created_at":"2024-09-25T07:33:19.921Z","updated_at":"2026-02-05T07:02:24.076Z","avatar_url":"https://github.com/soerenschneider.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# gobot-pir\n[![Go Report Card](https://goreportcard.com/badge/github.com/soerenschneider/gobot-pir)](https://goreportcard.com/report/github.com/soerenschneider/gobot-pir)\n![test-workflow](https://github.com/soerenschneider/gobot-pir/actions/workflows/test.yaml/badge.svg)\n![release-workflow](https://github.com/soerenschneider/gobot-pir/actions/workflows/release.yaml/badge.svg)\n![golangci-lint-workflow](https://github.com/soerenschneider/gobot-pir/actions/workflows/golangci-lint.yaml/badge.svg)\n\nDetects and forwards motion events using a [PIR sensor](https://gobot.io/documentation/drivers/pir-motion-sensor/) and a Raspberry PI\n\n## Features\n\n🤖 Integrates with Home-Assistant\u003cbr/\u003e\n📊 Calculates statistics about motion events over time windows, accessible via MQTT and metrics\u003cbr/\u003e\n🔐 Allows connecting to secure MQTT brokers using TLS client certificates\u003cbr/\u003e\n🔭 Expose PIR events as metrics to enable alerting and Grafana dashboards\u003cbr/\u003e\n\n## Installation\n\n### Binaries\nDownload a prebuilt binary from the [releases section](https://github.com/soerenschneider/gobot-pir/releases) for your system.\n\n### From Source\nAs a prerequisite, you need to have [Golang SDK](https://go.dev/dl/) installed. Then you can install gobot-pir from source by invoking:\n```shell\n$ go install github.com/soerenschneider/gobot-pir@latest\n```\n\n## Configuration\n\ngobot-pir can be fully configured using either environment variables or a config file.\n\n| Field Name       | Type         | JSON Key       | Env Variable                  | Validation           | Default       | Description                      |\n|------------------|--------------|----------------|-------------------------------|----------------------|---------------|----------------------------------|\n| Placement        | string       | placement      | GOBOT_PIR_PLACEMENT           | required             | -             | Placement configuration          |\n| MetricsAddr      | string       | metrics_addr   | GOBOT_PIR_METRICS_LISTEN_ADDR | omitempty,tcp_addr   | 0.0.0.0:9191  | Metrics address                  |\n| IntervalSecs     | int          | interval_s     | GOBOT_PIR_INTERVAL_S          | min=1,max=300        |               | Interval in seconds              |\n| StatIntervals    | []int        | stat_intervals | GOBOT_PIR_STAT_INTERVALS      | dive,min=10,max=3600 |               | Statistic intervals              |\n| LogSensor        | bool         | log_sensor     | GOBOT_PIR_LOG_SENSOR_READINGS | false                |               | Log sensor readings              |\n| MessageOn        | string       | message_on     | GOBOT_PIR_MSG_ON              |                      | ON            | Message when event is registered |\n| MessageOff       | string       | message_off    | GOBOT_PIR_MSG_OFF             |                      | OFF           | Message when event stops         |\n| MqttConfig       | MqttConfig   | -              |                               |                      |               | MQTT configuration               |\n| SensorConfig     | SensorConfig |                |                               |                      |               | Sensor configuration             |\n\n\n| Field Name       | Type     | JSON Key           | Env Variable                       | Validation                                       | Default | Description               |\n|------------------|----------|--------------------|------------------------------------|--------------------------------------------------|---------|---------------------------|\n| Disabled         | bool     | disable_mqtt       | GOBOT_PIR_MQTT_DISABLED            |                                                  | N/A     | Disabled MQTT             |\n| Host             | string   | mqtt_host          | GOBOT_PIR_MQTT_BROKER              | required_if=Disabled false,mqtt_broker           | N/A     | MQTT broker host          |\n| Topic            | string   | mqtt_topic         | GOBOT_PIR_MQTT_TOPIC               | required_if=Disabled false,mqtt_topic            | N/A     | MQTT topic                |\n| StatsTopic       | string   | mqtt_stats_topic   | GOBOT_PIR_MQTT_STATS_TOPIC         | omitempty,mqtt_topic                             | N/A     | MQTT statistics topic     |\n| ClientKeyFile    | string   | mqtt_ssl_key_file  | GOBOT_PIR_MQTT_TLS_CLIENT_KEY_FILE | required_unless=ClientCertFile '',omitempty,file | N/A     | MQTT client SSL key file  |\n| ClientCertFile   | string   | mqtt_ssl_cert_file | GOBOT_PIR_MQTT_TLS_CLIENT_CRT_FILE | required_unless=ClientKeyFile '',omitempty,file  | N/A     | MQTT client SSL cert file |\n| ServerCaFile     | string   | mqtt_ssl_ca_file   | GOBOT_PIR_MQTT_TLS_SERVER_CA_FILE  | omitempty,file                                   | N/A     | MQTT server SSL CA file   |\n\n\n| Field Name               | Type     | JSON Key                 | Env Variable                       | Validation             | Default | Description                    |\n|--------------------------|----------|--------------------------|------------------------------------|------------------------|---------|--------------------------------|\n| GpioPin                  | string   | gpio_pin                 | GOBOT_PIR_GPIO_PIN                 | required,min=0         | 7       | GPIO pin configuration         |\n| GpioPollingIntervalMs    | int      | gpio_polling_interval_ms | GOBOT_PIR_GPIO_POLLING_INTERVAL_MS | required,min=5,max=500 | 75      | GPIO polling interval in ms    |\n\n## Metrics\n\nThis project exposes the following metrics in Open Metrics format under the prefix `gobot_pir`\n\n| Variable Name                      | Metric Type        | Description                                    | Labels              |\n|------------------------------------|--------------------|------------------------------------------------|---------------------|\n| version                            | GaugeVec           | Version information of this robot              | version, commit     |\n| heartbeat_timestamp_seconds        | GaugeVec           | Heartbeat of this robot                        | placement           |\n| motions_detected_total             | CounterVec         | Amount of motions detected                     | placement           |\n| motions_detected_timestamp_seconds | GaugeVec           | Timestamp of latest motion detected            | placement           |\n| messages_published_total           | CounterVec         | The assembleBot temperature in degrees Celsius | placement           |\n| message_publish_errors_total       | CounterVec         | The assembleBot temperature in degrees Celsius | placement           |\n| events_per_interval                | GaugeVec           | The number of events during given intervals    | interval, placement |\n| slice_entries_total                | GaugeVec           | The amount of entries in the stats slice       | placement           |\n\n\n## CHANGELOG\nThe changelog can be found [here](CHANGELOG.md)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsoerenschneider%2Fgobot-pir","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsoerenschneider%2Fgobot-pir","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsoerenschneider%2Fgobot-pir/lists"}