Joshua King d76cde1af5 Presence and custody model with total validation (Feature 05, task 1)
presence.py — a PURE module (no HA imports, no DB access, no timezone
logic): PresenceSchedule (child_id, cycle_length_weeks, anchor_date,
pattern mapping week index -> frozenset of present weekdays) and
PresenceOverride (child_id, inclusive start/end range, real-bool
is_present, optional note) with construction that rejects every
invalid shape up front:

- cycle length: integer 1..4 (the 4 cap mirrors schema.py's documented
  CHECK); bools/floats/strings rejected.
- pattern: dict required; week indices validated as non-bool ints
  covering 0..n-1 exactly (gaps and extras rejected); weekday sets
  validated as ints 0..6 (bools rejected — True would silently mean
  Monday; strings rejected — '02' would silently mean {0,2}); an
  explicitly empty week is valid (absent all week — distinct from no
  schedule, the engine's default).
- anchor/override dates: datetime.date or strict YYYY-MM-DD (strptime
  round-trip; '2026-1-5' rejected).
- override range: end >= start; is_present must be a real bool;
  note optional string.
- child ids: non-bool ints (SQLite binds True as 1).

Serialization: encode() emits the database's pipe-separated CSV
(sorted weekdays per week, empty segment for an absent week);
decode() derives the cycle length from the segment count (mirroring
the schema's segment-count CHECK) and validates strictly, so
decode(encode(x)) round-trips losslessly and equal patterns encode
identically. Tests: 59 (construction matrix, round-trips, encode
shapes, override coverage). Suite: 972 passed.
2026-09-15 17:43:09 -04:00
2026-09-14 21:31:55 -04:00

NestQuest - House Chaos Coordination

Home Assistant custom integration for managing chores, custody schedules, and house coordination.

Overview

NestQuest helps households coordinate daily life, chore tracking, custody schedules, and shared tasks directly within Home Assistant. Version 0.2.0 ships the integration foundation (a configuration scaffold providing the package and manifest, shared constants, a single-instance config flow, setup/unload lifecycle handling with an options-reload listener, an options flow for horizon days / day rollover time / panel idle timeout, and HACS metadata) plus its persistence layer: an integration-owned SQLite database (nestquest.db) with WAL mode and foreign keys, a versioned migration runner stamping schema version 1 across eight tables (children, admin_users, schedule_rules, task_definitions, presence_schedules, presence_overrides, task_instances, completion_events), typed DAO layers so no other feature writes raw SQL, an append-only completion-event log, and startup handling that creates a missing database, opens a valid one, and refuses — without touching a single byte — to start on a corrupt one. Sensors, calendar events, and service calls are forthcoming in later releases and are not yet part of the integration.

Installation

  1. Ensure HACS (Home Assistant Community Store) is installed.
  2. In Home Assistant, open HACS > Integrations.
  3. Select the three-dots menu in the top right and click Custom repositories.
  4. Enter the repository URL: https://github.com/talon2king/NestQuest
  5. Select category Integration and click Add.
  6. Search for NestQuest and click Download.
  7. Restart Home Assistant.

Note: Development happens in the private Gitea repository (https://code.cubecraftlabs.com/Maniacs_Mansion/NestQuest). The GitHub repository is a public mirror maintained for HACS distribution.

Manual Installation

  1. Download the latest release from the repository.
  2. Copy the custom_components/nestquest directory into your Home Assistant installation's config/custom_components/ folder:
    cp -R custom_components/nestquest <config_dir>/custom_components/
    
  3. Restart Home Assistant.

Configuration

After installation and restart:

  1. Navigate to Settings > Devices & Services in Home Assistant.
  2. Click Add Integration and search for NestQuest.
  3. Follow the on-screen configuration flow.

Developer Setup and Testing

This project uses uv for fast Python package and dependency management.

Prerequisites

  • Python 3.11 or newer
  • uv installed on your machine

Setup Environment

To set up the development environment and install dependencies:

uv sync

Running Tests

Run the test suite with pytest:

uv run pytest

License

This project is licensed under the MIT License - see the LICENSE file for details.

S
Description
No description provided
Readme MIT
6.7 MiB
Languages
TypeScript 41.2%
Python 39.7%
JavaScript 17.9%
CSS 1.1%