Metadata-Version: 2.4
Name: rdc-correlate
Version: 0.2.0
Summary: Correlates Kohler RDC TLV wire protocol against Rehlko cloud API to verify and discover parameter mappings.
Author: andrewroydshayes
License: MIT
Project-URL: Homepage, https://github.com/andrewroydshayes/rdc-correlate
Project-URL: Repository, https://github.com/andrewroydshayes/rdc-correlate
Project-URL: Issues, https://github.com/andrewroydshayes/rdc-correlate/issues
Keywords: kohler,rdc,rehlko,tlv,correlation,reverse-engineering
Classifier: Development Status :: 4 - Beta
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: POSIX :: Linux
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Topic :: Scientific/Engineering
Classifier: Topic :: System :: Networking
Requires-Python: >=3.10
Description-Content-Type: text/markdown
Requires-Dist: requests>=2.25
Provides-Extra: dev
Requires-Dist: pytest>=7.0; extra == "dev"

# rdc-correlate

Correlates Kohler RDC generator **wire-protocol TLV parameters** (`0xXXXX` IDs
streaming over TCP 5253) against **Rehlko cloud API fields** to verify or
discover new parameter mappings.

When it finds new high-confidence mappings, it opens a PR on
[rdc-protocol-research](https://github.com/andrewroydshayes/rdc-protocol-research)
that updates `PARAMETERS.md` with the discoveries.

## What it does

1. Reads `kohler.sqlite` — a database populated by the rdc-proxy pcap capture
   pipeline (wire_records) and a Rehlko cloud poller (cloud_fields).
2. For every `(wire_param_id, cloud_field_path)` pair, computes Pearson r on
   time-aligned samples + a median scale ratio.
3. Emits the highest-confidence match per wire ID that clears a threshold.
4. Diffs those findings against the current `PARAMETERS.md` in
   rdc-protocol-research. New entries are bundled into a branch and opened as
   a PR for human review.

## Quick start

See **[docs/SETUP.md](docs/SETUP.md)** for the full walkthrough (it assumes a
Pi already running rdc-proxy). The short version:

```bash
curl -fsSL https://raw.githubusercontent.com/andrewroydshayes/rdc-correlate/main/install/install.sh \
  | sudo bash

# Once credentials + gh auth are set up:
sudo /opt/rdc-correlate/venv/bin/python -m rdc_correlate correlate --out /tmp/f.json
sudo /opt/rdc-correlate/venv/bin/python -m rdc_correlate publish --findings /tmp/f.json --dry-run
sudo /opt/rdc-correlate/venv/bin/python -m rdc_correlate publish --findings /tmp/f.json
```

## Subcommands

| Command | Purpose |
|---|---|
| `correlate` | Run correlation on the sqlite db; write `findings.json` |
| `publish` | Open a PR on rdc-protocol-research for new findings (+ `--dry-run`) |
| `poll` | Test Rehlko API credentials (lists homes and devices) |

## Development

```bash
pip install -e ".[dev]"
pytest
```

## License

MIT.
