Skip to content

About

JSON-first CLI for myzenner.ae (UAE utility billing) accounts: balance, bills, history and consumption. Built for people and AI agents.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

3 Commits

Folders and files

Repository files navigation

zenner-cli

Python 3.12+ License: MIT

Check your myzenner.ae account from the terminal: what you owe and when it's due, your bills, your payment history and how much energy you use. Readable output for people, stable JSON for scripts and AI agents. No browser needed.

Unofficial. Not affiliated with or endorsed by Zenner. It talks to the same undocumented endpoints the website uses, which can change without notice. When they do, the CLI stops with an unexpected_response error instead of returning wrong numbers.

Features

  • Balance at a glance: amount owed or in credit, due date, days left, last payment.
  • Bills and history: every bill and every charge and payment, newest first.
  • Consumption by day or by month, built from your meter readings. Days without a reading stay unknown (null), never zero. Monthly figures start when your account started: older meter data belongs to a previous occupant.
  • One-call summary: zenner on its own answers "how am I doing?".
  • Agent-friendly: one JSON document per command, documented exit codes, errors with a hint.
  • Read-only by design: there is no code path that pays, submits readings or changes settings.
  • Gentle with Zenner: a handful of requests per command, no polling, no retry loops.

Install

Requires Python 3.12+ and uv. Not on PyPI; install from Git:

uv tool install git+https://github.com/jmaznar/zenner-cli
zenner --version

Quick start

zenner auth login --save-password   # once; asks for your myzenner.ae email and password
zenner                              # summary
zenner bills
zenner consumption --by month

In a terminal you get text:

$ zenner
  Balance       AED 312.45 owed · due Tue 24 Nov (in 3 days)
  Last bill     October 2026 · AED 312.45
  Chilling      71 kWh in 4 of the last 7 days (3 without reading) · 17.8 kWh/day
  Last payment  AED 58.10 on Sat 10 Oct

Scripts and agents ask for JSON:

$ zenner balance --json
{
  "status": "owed",
  "amount_due": 312.45,
  "currency": "AED",
  "due_date": "2026-11-24",
  "days_until_due": 3,
  "last_payment": {
    "date": "2026-10-10",
    "amount": 58.1
  },
  "as_of": "2026-11-10T12:05:51+04:00",
  "fetched_at": "2026-11-21T17:52:10+04:00"
}

$ zenner balance --json | jq -r '"\(.amount_due) \(.currency) due \(.due_date)"'
312.45 AED due 2026-11-24

All examples in this README use invented data.

Commands

Command What it does
zenner Summary: balance, last bill, last payment, last 7 days of consumption
zenner balance Amount owed or in credit, due date, last payment
zenner bills [--limit 12] Bills, newest first
zenner history [--limit 20] Charges and payments, newest first
zenner consumption [--by day|month] [--last N] Consumption per supply (default: last 7 days)
zenner auth login [--save-password] Log in and store the session
zenner auth status Is the session valid? (one request, never logs in)
zenner auth refresh Log in again with the stored credentials
zenner auth logout [--forget-password] Delete the local session (and the saved password)

Every command accepts --json and --pretty, before or after the command name.

Logging in

Two ways to provide credentials, checked in this order:

  1. Environment variables, recommended for agents and servers. Inject them from a secret manager; don't write them in scripts.

    ZENNER_EMAIL=you@example.com ZENNER_PASSWORD=… zenner balance --json
  2. macOS Keychain: zenner auth login --save-password stores the password there.

After logging in, the session cookie is kept in ~/.config/zenner-cli/session.json, readable only by you (mode 600). It respects XDG_CONFIG_HOME, or ZENNER_CONFIG_DIR to put it elsewhere.

When the session expires, any command logs in again once with the available credentials and retries once. Without credentials it stops with auth_required (exit code 3).

Only email and password login is supported, not "Continue with Google / Apple".

Output

Where the output goes Format
A terminal Text
A pipe, a file, a program capturing it JSON
--json JSON, always
--pretty Text, always
ZENNER_OUTPUT=json or =pretty Same, without the flag

Precedence: --json > --pretty > ZENNER_OUTPUT > terminal detection.

Agents and scripts: always pass --json (or set ZENNER_OUTPUT=json). Some agent shells look like a terminal and would get text otherwise.

Conventions in every JSON document:

  • Dates are YYYY-MM-DD; timestamps are ISO 8601 with the Dubai offset (+04:00).
  • Amounts are positive numbers (up to 2 decimals) next to a currency. Direction is in words (status, kind), never in the sign.
  • Unknown values are null, usually with a reason. Never an invented 0.
  • fetched_at is when the CLI asked; as_of is the date Zenner's figure refers to.

What the fields mean

balance

Field Meaning
status owed, overdue (owed and past due_date), credit, or settled
amount_due What you owe (0 if nothing). With credit, see credit_amount
due_date, days_until_due Due date of the latest bill; negative days when overdue
last_payment Most recent payment, or null
as_of Zenner updates the balance when it issues a bill, so this is usually the last bill date, not today. A payment made since may not show yet

bills

id (Zenner's bill ID), bill_number, period (YYYY-MM when the bill covers one calendar month, else null), period_start, period_end, issued_at, amount, credited.

There is no "paid" flag: Zenner doesn't provide one per bill, and the CLI doesn't guess. For what's outstanding, use balance.

history

Each row has date, kind (charge or payment), category (bill, payment, deposit, fee or other), Zenner's original label, description, amount, and balance_after ({status, amount}, the account position after that row).

$ zenner history --pretty --limit 3
  2026-11-10  Statement         −    AED 312.45   → AED 312.45 owed
  2026-10-10  Payment           +     AED 58.10   → settled
  2026-10-09  Statement         −     AED 58.10   → AED 58.10 owed

consumption

$ zenner consumption --by month --json
{
  "by": "month",
  "last": 6,
  "properties": [
    {
      "property": "Test Tower, A-101",
      "supplies": [
        {
          "name": "Chilling",
          "unit": "kWh",
          "since": "2026-09-28",
          "total": 1505,
          "periods_with_data": 2,
          "missing": 1,
          "average": 1400,
          "average_over": 1,
          "periods": [
            { "period": "2026-11", "consumption": 105, "partial": true,
              "source": "meter_readings", "missing_days": 13 },
            { "period": "2026-10", "consumption": 1400, "partial": false },
            { "period": "2026-09", "consumption": null, "partial": true,
              "reason": "account_started_mid_month", "meter_month_total": 760 }
          ]
        }
      ]
    }
  ],
  "fetched_at": "2026-11-21T17:52:10+04:00"
}
  • By day (default, up to 28 days): from meter readings. A day's consumption is the next day's reading minus that day's reading, the same convention as Zenner's own chart. Duplicate readings are dropped; days without one are null with reason: "missing_reading".
  • By month (up to 24 months):
    • Only months since your account started (the start of your first bill).
    • The first month, if the account started mid-month, has consumption: null: Zenner's figure for it includes days before you, so it's only given as meter_month_total.
    • The current month is not in Zenner's monthly data; the CLI rebuilds it from daily readings and marks it partial.
  • total adds up every known value; periods_with_data says how many there are.
  • average divides by average_over: periods that have data and are complete. Missing days are never counted as zero. That's why "71 kWh in 4 of the last 7 days" averages 17.8 kWh/day, not 10.1.

Gentle with Zenner

Command Requests
zenner (summary) 6
balance 3
bills, history 1 per page of up to 30 rows, never past the total
consumption 2 by day, 4 by month
auth status 1
auth login 2

Each request times out after 20 s. There is no polling and no retry loop: at most one automatic re-login per command. Network failures stop with network_error (exit code 5).

Errors and exit codes

In JSON mode, errors are JSON on stdout too:

{ "error": { "code": "auth_required", "message": "Not logged in, or the session expired.",
             "hint": "Set ZENNER_EMAIL and ZENNER_PASSWORD, or run: zenner auth login" } }

In a terminal they are printed to stderr as Error: and Hint: lines.

Exit code error.code Meaning
0 OK
2 usage_error Bad option or value
3 auth_required, login_failed No usable session or credentials, or Zenner rejected them
4 upstream_error, unexpected_response Zenner answered with an error or with data in an unexpected shape (the site may have changed)
5 network_error Couldn't reach myzenner.ae

Privacy and security

  • The password and the session cookie are never printed: not in output, errors or tracebacks. A test enforces it.
  • The session file is mode 600. Nothing is sent anywhere except myzenner.ae.
  • The CLI only reads. Payment and settings endpoints are not implemented.

Known behaviour (observed 2026-11-21)

  • Sessions can end well before the cookie's own 24 h expiry (one ended in under an hour). The CLI never trusts the expiry date: it detects the redirect to the login page and logs in again.
  • The server sometimes renews the session cookie; the CLI saves the renewed one.
  • Meter readings can have gaps of a few days and duplicate rows; the latest reading is often 1–2 days old.
  • Timestamps from Zenner carry no timezone; the CLI assumes Asia/Dubai.

Contributing

git clone https://github.com/jmaznar/zenner-cli && cd zenner-cli
uv sync
git config core.hooksPath .githooks   # enable the personal-data guard (see below)
uv run pytest                         # offline: runs against a fake Zenner, never the real one
uv run ruff check . && uv run ruff format --check .
  • Never rename or remove a JSON field; add new ones instead. Scripts and agents depend on them.
  • Tests and docs use invented data only (see tests/fake_zenner.py).
  • Personal-data guard: .githooks/ blocks commits containing real-looking emails, session cookies, UAE phone numbers, Emirates IDs or IBANs. Add your own values (email, address, account and meter numbers) to .pii-blocklist at the repo root, one per line. That file is git-ignored and must stay that way.
  • API discovery notes are in docs/api-notes.md; design decisions in docs/design.md.

License

MIT. "Zenner" and "myzenner" are trademarks of their respective owners; this project is not affiliated with them.

About

JSON-first CLI for myzenner.ae (UAE utility billing) accounts: balance, bills, history and consumption. Built for people and AI agents.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages