Zerodha Portfolio Integration for Home Assistant ๐Ÿ‡ฎ๐Ÿ‡ณ

Hi everyone :wave:

I wanted to share a custom Home Assistant integration for Zerodha (Kite) that Iโ€™ve been using to track my Indian stock portfolio directly inside Home Assistant.

The goal was to expose clean, agent-friendly sensors that work well with InfluxDB, Grafana, and future Home Assistant Agent workflows, while keeping API usage minimal.


:sparkles: What it does

The integration creates three primary sensors:

  • Portfolio Value
  • Cash Available
  • Unrealized PnL

All sensors:

  • Update together via a single coordinator
  • Use last-known values when no fresh data is available
  • Are safe for time-series storage and visualization

:stopwatch: Smart update strategy

To avoid rate limits and unnecessary logins:

  • Market hours (Monโ€“Fri, 09:15โ€“15:30 IST) โ†’ update every 1 hour
  • Off-market hours โ†’ update every 6 hours

This works well for long-term portfolio monitoring without hammering Zerodha endpoints.


:bar_chart: Dashboards & Grafana

The sensors are designed to work cleanly with InfluxDB + Grafana:

  • Stacked bars for Cash vs Portfolio value
  • Line overlay for PnL
  • Forward-filled values so charts stay aligned
  • Easy alerting (cash below threshold, PnL drawdown, etc.)

:robot: Agent-friendly by design

Entities are intentionally simple and semantic:

  • sensor.zerodha_portfolio_value
  • sensor.zerodha_cash_available
  • sensor.zerodha_unrealized_pnl

This makes them suitable for:

  • Home Assistant Agent reasoning
  • Natural language queries
  • Financial health summaries

:closed_lock_with_key: Authentication notes

  • Uses Zerodhaโ€™s web login flow (enctoken)
  • Supports TOTP (PyOTP) for automated login
  • Intended for personal / educational use
  • Not affiliated with Zerodha

:link: Code & installation

:package: GitHub repository:

Manual install via custom_components, UI setup supported.
Dependencies are handled automatically by Home Assistant.


:warning: Disclaimer

This project is not officially supported by Zerodha.
Use responsibly and at your own risk.


:pray: Feedback welcome

Thanks, and hope this is useful to others in the community! :rocket:

1 Like