Hi everyone ![]()
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.
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
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.
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.)
Agent-friendly by design
Entities are intentionally simple and semantic:
sensor.zerodha_portfolio_valuesensor.zerodha_cash_availablesensor.zerodha_unrealized_pnl
This makes them suitable for:
- Home Assistant Agent reasoning
- Natural language queries
- Financial health summaries
Authentication notes
- Uses Zerodhaโs web login flow (
enctoken) - Supports TOTP (PyOTP) for automated login
- Intended for personal / educational use
- Not affiliated with Zerodha
Code & installation
GitHub repository:
Manual install via custom_components, UI setup supported.
Dependencies are handled automatically by Home Assistant.
Disclaimer
This project is not officially supported by Zerodha.
Use responsibly and at your own risk.
Feedback welcome
Thanks, and hope this is useful to others in the community! ![]()