{"id":47209826,"url":"https://github.com/joedborg/alarm-dot-com-rs","last_synced_at":"2026-03-13T15:41:03.710Z","repository":{"id":340434628,"uuid":"1166080096","full_name":"joedborg/alarm-dot-com-rs","owner":"joedborg","description":"An Alarm.com / ADT Control library in Rust","archived":false,"fork":false,"pushed_at":"2026-02-24T21:51:22.000Z","size":52,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-02-25T00:21:02.321Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/joedborg.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-02-24T21:22:24.000Z","updated_at":"2026-02-24T21:46:18.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/joedborg/alarm-dot-com-rs","commit_stats":null,"previous_names":["joedborg/alarm-dot-com-rs"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/joedborg/alarm-dot-com-rs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joedborg%2Falarm-dot-com-rs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joedborg%2Falarm-dot-com-rs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joedborg%2Falarm-dot-com-rs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joedborg%2Falarm-dot-com-rs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/joedborg","download_url":"https://codeload.github.com/joedborg/alarm-dot-com-rs/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joedborg%2Falarm-dot-com-rs/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30469336,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-13T11:00:43.441Z","status":"ssl_error","status_checked_at":"2026-03-13T11:00:23.173Z","response_time":60,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: 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":[],"created_at":"2026-03-13T15:41:03.082Z","updated_at":"2026-03-13T15:41:03.695Z","avatar_url":"https://github.com/joedborg.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# alarm-dot-com\n\nA Rust library for interfacing with [Alarm.com](https://www.alarm.com/) security panels.\n\nThis library reverse-engineers the Alarm.com web portal's AJAX API to provide programmatic access to your alarm panel, sensors, locks, garage doors, lights, and thermostats.\n\n\u003e **Note:** ADT Control uses Alarm.com as its backend platform, so this library is fully compatible with ADT Control systems.\n\n\u003e **Disclaimer:** This is an unofficial library, not affiliated with Alarm.com or ADT. The underlying API is undocumented and may change without notice.\n\n## Features\n\n- **Partitions** -- arm stay, arm away, arm night, disarm, clear faults\n- **Sensors** -- door/window, motion, glass break, smoke, CO, flood, temperature\n- **Locks** -- lock, unlock, state monitoring\n- **Garage doors** -- open, close, state monitoring\n- **Lights** -- on, off, brightness control for dimmers\n- **Thermostats** -- mode, heat/cool setpoints, ambient temperature and humidity\n- **Session management** -- automatic retry on transient failures, re-login on expired sessions\n\n## Prerequisites\n\nThis library requires a **trusted device cookie** to bypass Alarm.com's two-factor authentication. Follow these steps to obtain it:\n\n1. Go to [www.alarm.com](https://www.alarm.com) and log in with your credentials\n2. Complete the 2FA challenge when prompted (you may be asked to name the device — this can be anything)\n3. Open your browser's developer tools:\n   - **Chrome / Edge:** right-click the page → _Inspect_ → _Application_ tab → _Cookies_ → `https://www.alarm.com`\n   - **Firefox:** right-click → _Inspect_ → _Storage_ tab → _Cookies_ → `https://www.alarm.com`\n   - **Safari:** _Develop_ menu → _Show Web Inspector_ → _Storage_ tab → _Cookies_\n4. Find the cookie named `twoFactorAuthenticationId` — its value is a 64-character alphanumeric string\n5. Copy that value and set it as your `ALARM_MFA_COOKIE` environment variable\n\n## Quick Start\n\nAdd to your `Cargo.toml`:\n\n```toml\n[dependencies]\nalarm-dot-com = \"0.1\"\ntokio = { version = \"1\", features = [\"full\"] }\n```\n\n```rust\nuse alarm_dot_com::AlarmDotCom;\n\n#[tokio::main]\nasync fn main() -\u003e Result\u003c(), Box\u003cdyn std::error::Error\u003e\u003e {\n    let mut alarm = AlarmDotCom::new(\"user@example.com\", \"password\");\n    alarm.set_trusted_device_cookie(\"your-mfa-cookie-value\");\n\n    alarm.login().await?;\n\n    let status = alarm.fetch_status().await?;\n    println!(\"System: {}\", status.system.name);\n\n    for p in \u0026status.partitions {\n        println!(\"  Partition {}: {}\", p.name, p.state);\n    }\n    for s in \u0026status.sensors {\n        println!(\"  Sensor {} ({}): {}\", s.name, s.sensor_type, s.state);\n    }\n\n    // Arm in stay mode\n    if let Some(partition) = status.partitions.first() {\n        alarm.arm_stay(\u0026partition.id, \u0026[]).await?;\n    }\n\n    Ok(())\n}\n```\n\n## CLI Examples\n\nSet your credentials as environment variables, then run the examples:\n\n```sh\nexport ALARM_USERNAME=\"you@email.com\"\nexport ALARM_PASSWORD=\"your-password\"\nexport ALARM_MFA_COOKIE=\"your-twoFactorAuthenticationId-cookie\"\n```\n\n### Get system status\n\n```sh\ncargo run --example status\n```\n\nPrints all partitions, sensors, locks, garage doors, lights, and thermostats with their current states.\n\n### Arm/disarm\n\n```sh\n# Arm stay\ncargo run --example arm -- stay\n\n# Arm away\ncargo run --example arm -- away\n\n# Arm night\ncargo run --example arm -- night\n\n# Disarm\ncargo run --example arm -- disarm\n\n# Arm stay, bypassing open sensors\ncargo run --example arm -- stay-bypass\n\n# Target a specific partition\ncargo run --example arm -- stay PARTITION_ID\n```\n\n## API Overview\n\n### `AlarmDotCom`\n\nThe main entry point. Created with credentials, then `login()` to authenticate.\n\n| Method                                           | Description                                                                      |\n| ------------------------------------------------ | -------------------------------------------------------------------------------- |\n| `set_trusted_device_cookie(cookie)`              | Set the MFA bypass cookie (required for 2FA accounts).                           |\n| `login()`                                        | Authenticate. Returns `Err(TwoFactorRequired)` if MFA cookie is missing/invalid. |\n| `keep_alive()`                                   | Prevent session timeout. Returns `false` if expired.                             |\n| `fetch_status()`                                 | Fetch full system snapshot (all device types).                                   |\n| `fetch_partitions()`                             | Fetch alarm panel partitions.                                                    |\n| `arm_stay(id, opts)`                             | Arm a partition in Stay mode.                                                    |\n| `arm_away(id, opts)`                             | Arm a partition in Away mode.                                                    |\n| `arm_night(id, opts)`                            | Arm a partition in Night mode.                                                   |\n| `disarm(id)`                                     | Disarm a partition.                                                              |\n| `fetch_sensors()`                                | Fetch all sensors.                                                               |\n| `fetch_locks()`                                  | Fetch all locks.                                                                 |\n| `lock(id)` / `unlock(id)`                        | Lock or unlock a lock.                                                           |\n| `fetch_garage_doors()`                           | Fetch all garage doors.                                                          |\n| `open_garage_door(id)` / `close_garage_door(id)` | Open or close a garage door.                                                     |\n| `fetch_lights()`                                 | Fetch all lights.                                                                |\n| `turn_on_light(id)` / `turn_off_light(id)`       | Turn a light on or off.                                                          |\n| `set_light_brightness(id, level)`                | Set dimmer brightness (0-100).                                                   |\n| `fetch_thermostats()`                            | Fetch all thermostats.                                                           |\n| `set_thermostat_mode(id, mode)`                  | Set thermostat mode (off/heat/cool/auto).                                        |\n| `set_heat_setpoint(id, temp)`                    | Set heat target temperature.                                                     |\n| `set_cool_setpoint(id, temp)`                    | Set cool target temperature.                                                     |\n\n### Arming Options\n\nPass to `arm_stay`, `arm_away`, or `arm_night`:\n\n```rust\nuse alarm_dot_com::models::partition::ArmingOption;\n\nalarm.arm_away(\u0026id, \u0026[\n    ArmingOption::BypassSensors,\n    ArmingOption::SilentArming,\n]).await?;\n```\n\n| Option          | Description                                         |\n| --------------- | --------------------------------------------------- |\n| `BypassSensors` | Force bypass all open zones.                        |\n| `NoEntryDelay`  | Sound alarm immediately on entry zone trigger.      |\n| `SilentArming`  | Suppress arming/exit delay tones at the panel.      |\n| `NightArming`   | Enable night arming (auto-included by `arm_night`). |\n| `ForceArm`      | Force arm regardless of faults.                     |\n\n## Error Handling\n\nAll operations return `Result\u003cT, AlarmError\u003e`. Key variants:\n\n| Error                  | Meaning                                                  |\n| ---------------------- | -------------------------------------------------------- |\n| `TwoFactorRequired`    | MFA cookie missing or invalid -- set `ALARM_MFA_COOKIE`. |\n| `AuthenticationFailed` | Bad credentials.                                         |\n| `SessionExpired`       | Session timed out -- re-login needed.                    |\n| `ServiceUnavailable`   | Alarm.com unreachable or returned server error.          |\n| `NotAuthorized`        | Account lacks permission for this operation.             |\n| `UnknownDevice`        | Device ID not found.                                     |\n\n## Project Structure\n\n```\nsrc/\n  lib.rs              High-level AlarmDotCom API\n  auth.rs             Login flow, ViewState parsing\n  client.rs           HTTP client, cookie jar, retry logic\n  error.rs            Error types\n  models/\n    jsonapi.rs        JSON:API response deserialization\n    device.rs         Shared traits and ResourceType enum\n    partition.rs      Alarm panel state and commands\n    sensor.rs         Sensor types and state\n    lock.rs           Lock state and commands\n    garage_door.rs    Garage door state and commands\n    light.rs          Light state and commands\n    thermostat.rs     Thermostat state and commands\n    system.rs         System-level info\n  controllers/\n    partitions.rs     Partition fetch/command operations\n    sensors.rs        Sensor fetch operations\n    locks.rs          Lock fetch/command operations\n    garage_doors.rs   Garage door fetch/command operations\n    lights.rs         Light fetch/command operations\n    thermostats.rs    Thermostat fetch/command operations\n    systems.rs        System discovery and fetch\nexamples/\n  status.rs           Print full system status\n  arm.rs              Arm/disarm via CLI\n```\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoedborg%2Falarm-dot-com-rs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjoedborg%2Falarm-dot-com-rs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoedborg%2Falarm-dot-com-rs/lists"}