Skip to content

Add MFA by email: optional IMAP code retrieval, preserve console prompt#175

Closed
joyjit wants to merge 1 commit into
tronikos:mainfrom
joyjit:imap-mfa
Closed

Add MFA by email: optional IMAP code retrieval, preserve console prompt#175
joyjit wants to merge 1 commit into
tronikos:mainfrom
joyjit:imap-mfa

Conversation

@joyjit
Copy link
Copy Markdown

@joyjit joyjit commented Feb 24, 2026

  • Add opower.email_mfa module: ImapMfaCodeSource (poll inbox for 6-digit code), ConsoleMfaCodeSource, RestApiMfaCodeSource, MfaCodeSource protocol.
  • CLI: --mfa_imap_host, --mfa_imap_user, --mfa_imap_password, --mfa_imap_port. When set, auto-select Email option and read code from IMAP; otherwise prompt for MFA option and code (original behavior).
  • No new dependencies (stdlib imaplib + existing aiohttp).
  • Works with PG&E and Exelon (any utility offering Email MFA option).

@joyjit joyjit marked this pull request as draft February 24, 2026 23:25
@joyjit joyjit marked this pull request as ready for review February 24, 2026 23:42
@tronikos
Copy link
Copy Markdown
Owner

tronikos commented Mar 1, 2026

Can you fix pre-commit?

- opower.email_mfa: ImapMfaCodeSource, ConsoleMfaCodeSource, MfaCodeSource protocol
- CLI: --mfa_imap_host, --mfa_imap_user, --mfa_imap_password, --mfa_imap_port
- When set, auto-select Email and read code from inbox; else prompt (original behavior)
- Refactor: _handle_mfa_challenge() to satisfy C901; fix E501, B904, ruff in email_mfa

Co-authored-by: Cursor <cursoragent@cursor.com>
Made-with: Cursor
@tronikos
Copy link
Copy Markdown
Owner

Curious, how are you using this? Would you want to use this in Home Assistant?

@joyjit
Copy link
Copy Markdown
Author

joyjit commented Mar 19, 2026

Curious, how are you using this? Would you want to use this in Home Assistant?

I had a very old "Legacy" Rainforest Eagle device ( See https://support.rainforestautomation.com/collection/84-eagle-aka-originalclassiclegacy ) that I have now revived and working properly with Home Assistant. So I dont need to use the Opower integration any more...

But I did play around with Opower and found it quite useful... except for the 2FA verification part

@tronikos
Copy link
Copy Markdown
Owner

As implemented this won't work in Home Assistant. And I'm not sure this would be OK in HA anyway. Since I don't see a particular use case I'll reject this to reduce maintenance burden.

@tronikos tronikos closed this Mar 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants