Metadata-Version: 2.4
Name: mordomus-homeassistant
Version: 0.1.0
Summary: Home Assistant custom integration for Mordomus / iThink controllers
Project-URL: Homepage, https://github.com/skymoore/mordomus/tree/main/home-assistant
Project-URL: Documentation, https://github.com/skymoore/mordomus/blob/main/home-assistant/README.md
Project-URL: Repository, https://github.com/skymoore/mordomus
Project-URL: Issues, https://github.com/skymoore/mordomus/issues
Author: Sky
License-Expression: MIT
License-File: LICENSE
Keywords: hacs,home-assistant,home-automation,homeassistant,ithink,mordomus,smart-home
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: End Users/Desktop
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Home Automation
Requires-Python: >=3.11
Requires-Dist: mordomus>=0.1.0
Provides-Extra: dev
Requires-Dist: build>=1.2; extra == 'dev'
Description-Content-Type: text/markdown

# mordomus-homeassistant

Home Assistant custom integration for **Mordomus / iThink** controllers.

This package depends on the [`mordomus`](https://pypi.org/project/mordomus/) library and ships the `custom_components/mordomus` tree plus a small installer CLI.

## Install

### Option A — pip + CLI (recommended)

On the Home Assistant host (or any machine that can write to the HA config dir):

```bash
pip install mordomus-homeassistant
mordomus-ha install /config
# Supervised / Container often uses /config
# Core venv default: ~/.homeassistant
# Or: export HA_CONFIG=/path/to/config && mordomus-ha install
```

Replace an existing install:

```bash
mordomus-ha install /config --force
```

Show where the bundled component lives:

```bash
mordomus-ha path
```

Restart Home Assistant, then:

**Settings → Devices & services → Add integration → Mordomus**

### Option B — manual copy

```bash
pip install mordomus-homeassistant
python -c "import mordomus_homeassistant as m; print(m.COMPONENT_DIR)"
# copy that directory to <config>/custom_components/mordomus
```

### Option C — HACS / symlink (development)

```bash
ln -s /path/to/mordomus/home-assistant/custom_components/mordomus \
  /config/custom_components/mordomus
pip install -e /path/to/mordomus   # library
```

## Features

| Platform | What it maps |
|----------|----------------|
| **Light** | Illumination devices (`dt=1`) with brightness 0–100 |
| **Cover** | Blinds / curtains (`dt=2`) with position 0–100 |
| **Switch** | Equipments, electric valves, HVAC on/off, sirens |
| **Climate** | Room climate zones (setpoint, mode, on/off) |
| **Sensor** | Analog sensors, exterior temperature, system version |
| **Binary sensor** | Alarms (intrusion / technical / tamper), presence |
| **Button** | Quick-menu actions (`$lights`, `$blinds`, …) |

Also includes:

- UI config flow (host, port, user, password, poll interval)
- Options flow to change poll interval
- Re-auth + reconfigure flows
- `DataUpdateCoordinator` polling (default 10s)
- Device registry hierarchy (hub → rooms/devices)
- Diagnostics dump
- Services: `mordomus.refresh`, `mordomus.set_device_value`

## Configuration

| Field | Default | Notes |
|-------|---------|-------|
| Host | — | Controller IP / hostname |
| Port | `8888` | HTTP API port |
| Username / password | — | Same as web UI |
| Poll interval | `10` s | Options flow; min 5, max 300 |

## Services

```yaml
service: mordomus.refresh
data: {}
```

```yaml
service: mordomus.set_device_value
data:
  code: MDO17
  value: 100
```

## Publish

```bash
# from repo root
export UV_PUBLISH_TOKEN=pypi-...
./scripts/publish.sh ha
# or
cd home-assistant && uv build && uv publish
```

PyPI: https://pypi.org/project/mordomus-homeassistant/

## Notes

- The controller is **local polling** only (no push).
- Some API areas (multimedia, energy, emap, video) may return `permission_denied` / `license_required` depending on the license.
- Auth uses the reverse-engineered MD5 session login from the web UI.
- `manifest.json` requires `mordomus>=0.1.0,<0.2.0` so Home Assistant installs the library automatically.
