{"id":13414447,"url":"https://github.com/mongoose-os-apps/losant-motion-sensor","last_synced_at":"2026-06-22T22:31:16.440Z","repository":{"id":103984846,"uuid":"102386028","full_name":"mongoose-os-apps/losant-motion-sensor","owner":"mongoose-os-apps","description":"Detecting Motion Using a PIR sensor, ESP8266, and Mongoose OS","archived":false,"fork":false,"pushed_at":"2020-08-20T19:03:13.000Z","size":183,"stargazers_count":1,"open_issues_count":2,"forks_count":2,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-07-31T21:52:58.584Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mongoose-os-apps.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2017-09-04T17:32:11.000Z","updated_at":"2020-03-30T08:55:34.000Z","dependencies_parsed_at":null,"dependency_job_id":"d2856821-b243-4b99-9fda-15ab214fbb75","html_url":"https://github.com/mongoose-os-apps/losant-motion-sensor","commit_stats":null,"previous_names":[],"tags_count":50,"template":false,"template_full_name":null,"purl":"pkg:github/mongoose-os-apps/losant-motion-sensor","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mongoose-os-apps%2Flosant-motion-sensor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mongoose-os-apps%2Flosant-motion-sensor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mongoose-os-apps%2Flosant-motion-sensor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mongoose-os-apps%2Flosant-motion-sensor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mongoose-os-apps","download_url":"https://codeload.github.com/mongoose-os-apps/losant-motion-sensor/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mongoose-os-apps%2Flosant-motion-sensor/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34668500,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-22T02:00:06.391Z","response_time":106,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":[],"created_at":"2024-07-30T21:00:21.388Z","updated_at":"2026-06-22T22:31:16.426Z","avatar_url":"https://github.com/mongoose-os-apps.png","language":"JavaScript","funding_links":[],"categories":["Awesome Mongoose OS [![Awesome](https://awesome.re/badge.svg)](https://awesome.re)"],"sub_categories":["Official Examples"],"readme":"# Detecting Motion Using a PIR sensor, ESP8266, and Mongoose OS. \n\nThis example application is a motion detector. It uses the ESP8266 NodeMCU and a PIR sensor. This example code is apart of a [tutorial](https://www.losant.com/blog/detecting-motion-using-a-pir-sensor-esp8266-and-mongoose-os). The tutorial demonstrates how to send the data to the [Losant IoT Platform](https://www.losant.com), where we can create a dashboard to monitor activity, and send alerts based on customizable rules.\n\n## Tested Hardware\n- ESP8266\n- ESP32\n\n## Installation \u0026 Flashing\n\nBefore beginning, you must have the `mos` tool installed. For more info, see the mos [installation instructions](https://mongoose-os.com/docs/quickstart/setup.html). \n\n1. First, clone the losant app\n\n```\n$ git clone git@github.com:Losant/losant-mongoose-motion-sensor.git\n```\n\n2. Build the firmware: (esp8266 or esp32)\n\n```\n$ mos build --arch esp8266 \n```\n\n3. Flash the device: (esp8266 or esp32)\n\n```\n$ mos flash \n```\n\n4. Configure WiFi:\n```\nmos wifi WIFI_SSID WIFI_PASSWORD \n```\nYou must replace the following values:\n- WIFI_SSID\n- WIFI_PASSWORD\n\n5. Login to Losant service. Create and app, device, and security credentials for your device:\nThe device will have the following attributes: \n![](images/losant-device-attribute.png)\nHere is where you can obtain security crendentials: \n![](images/losant-access-keys.png)\n\n6. Configure MQTT connection to Losant:\n```\nmos config-set mqtt.client_id=LOSANT_DEVICE_ID \\\n  mqtt.user=LOSANT_ACCESS_KEY \\\n  mqtt.pass=LOSANT_ACCESS_SECRET\n```  \n\nYou obtain the `LOSANT_DEVICE_ID`, `LOSANT_ACCESS_KEY`, and `LOSANT_ACCESS_SECRET` values from [Losant](www.losant.com). \n\n7. To stream logs to the terminal: \n\n```\n$ mos console\n```\n\n8. To open up the mos web UI:\n\n```\n$ mos\n```\n\n9. Switch back to Losant page, watch data graph:\n\n![](images/losant-data-explorer.png)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmongoose-os-apps%2Flosant-motion-sensor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmongoose-os-apps%2Flosant-motion-sensor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmongoose-os-apps%2Flosant-motion-sensor/lists"}