{"id":20834169,"url":"https://github.com/harperreed/emfit-summary-bot","last_synced_at":"2025-10-09T05:32:45.952Z","repository":{"id":66694573,"uuid":"122118401","full_name":"harperreed/emfit-summary-bot","owner":"harperreed","description":"A simple bot that sends you a text of your previous nights sleep","archived":false,"fork":false,"pushed_at":"2024-08-30T13:09:57.000Z","size":42,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-09T01:28:50.777Z","etag":null,"topics":["bot","emfit","home-automation","sleep","twilio"],"latest_commit_sha":null,"homepage":"","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/harperreed.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,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2018-02-19T20:44:59.000Z","updated_at":"2024-08-30T13:09:59.000Z","dependencies_parsed_at":null,"dependency_job_id":"be1c70ed-fa39-4e0b-a188-9374606700cd","html_url":"https://github.com/harperreed/emfit-summary-bot","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/harperreed/emfit-summary-bot","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/harperreed%2Femfit-summary-bot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/harperreed%2Femfit-summary-bot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/harperreed%2Femfit-summary-bot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/harperreed%2Femfit-summary-bot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/harperreed","download_url":"https://codeload.github.com/harperreed/emfit-summary-bot/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/harperreed%2Femfit-summary-bot/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279000742,"owners_count":26082932,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-09T02:00:07.460Z","response_time":59,"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":["bot","emfit","home-automation","sleep","twilio"],"created_at":"2024-11-18T00:18:24.362Z","updated_at":"2025-10-09T05:32:45.939Z","avatar_url":"https://github.com/harperreed.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Emfit Morning Summary Bot\n\n## Overview\n\nThis Sleep Bot project aims to handle multiple responsibilities, including initializing state files, logging into a service, fetching user and device data, and sending messages via Pushover. The project is built using Node.js and relies on a `config.yaml` file for various settings.\n\n## Table of Contents\n1. [Installation](#installation)\n2. [Configuration](#configuration)\n3. [Usage](#usage)\n4. [Functions](#functions)\n5. [Contributing](#contributing)\n6. [License](#license)\n\n## Installation\n\nClone the repository and navigate to the project folder. Run the following command to install the required Node.js packages:\n\n```bash\nnpm install\n```\n\n## Configuration\n\nCreate a `config.yaml` file in the root directory with the following structure:\n\n```yaml\ndefault:\n  emfit:\n    username: email@address\n    password: XXX\n    devices:\n      4613:\n        name: NAME\n        enabled: true\n        deviceId: 5555\n        number: 12223335555\n        discord_at: \"xxxx\"\n        pushover_userkey: xxxx\n        pushover_priority: -1\n    stateFile: /tmp/statefile.json\n  chat:\n    space: XX\n    key: XX\n    token: XX\n  twilio:\n    accountSid: XX\n    authToken: XX\n    fromNumber: 12223335555\n  openai: \n    apikey: \"sk-xxxx\"\n    model: \"gpt-4\"\n  pushover: \n    apikey: xxxx\n    userkey: xxxx\n```\n\nReplace the placeholder values (`XXX`, `XX`, `xxxx`, etc.) with your actual credentials and settings.\n\n## Usage\n\nTo start the bot, simply run:\n\n```bash\nnode index.js\n```\n\n## Functions\n\n### `instantiateSleepBot()`\n\nAn asynchronous function that initializes state files, logs into the Emfit service, fetches user data, and processes each device setting.\n\n### `processDevice(deviceSettings)`\n\nA helper function to process individual device settings. It fetches the latest sleep data for each device and sends messages if conditions are met.\n\n### `sendChatMessage(subject, message, pushoverUser, priority)`\n\nAn asynchronous function that sends a Pushover message.\n\n## Contributing\n\nIf you'd like to contribute, please fork the repository and make changes as you'd like. Pull requests are warmly welcome.\n\n## License\n\nMIT\n\n---\n\nFeel free to modify this README to better suit your project's needs.\n## config.yml\n\nHere is an example config.yml. It should be pretty self explanatory. \n\n    default:\n      emfit:\n        username: email@address\n        password: XXX\n        devices:\n          4613:\n            name: NAME\n            deviceId: 5555\n            number: 12223335555\n        stateFile: /tmp/statefile.json\n\n      chat:\n        space: XX\n        key: XX\n        token: XX\n\n\n\n\n## Cron config\nhere is my cron\n\n`*/15 6,7,8,9,10,11 * * *  /usr/local/bin/node /home/harper/scripts/emfit-summary-bot/index.js /home/harper/scripts/emfit-summary-bot/cron.log 2\u003e\u00261`\n\nTheoretically it should run every 15 minutes from 6am-11am.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fharperreed%2Femfit-summary-bot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fharperreed%2Femfit-summary-bot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fharperreed%2Femfit-summary-bot/lists"}