Skip to content

Add enphase solar monitor#193

Open
ammyyou112 wants to merge 14 commits intoopenhome-dev:devfrom
ammyyou112:add-enphase-solar-monitor
Open

Add enphase solar monitor#193
ammyyou112 wants to merge 14 commits intoopenhome-dev:devfrom
ammyyou112:add-enphase-solar-monitor

Conversation

@ammyyou112
Copy link
Contributor

What does this Ability do?

Voice-activated solar monitoring for Enphase IQ Gateway systems. Users can check real-time solar production, battery status, consumption, and grid import/export with natural voice commands.

Suggested Trigger Words

  • "solar"
  • "how's my solar"
  • "solar status"
  • "solar production"
  • "battery level"
  • "battery status"
  • "am I exporting"
  • "grid status"
  • "solar today"
  • "enphase"
  • "solar panels"

Type

  • New community Ability
  • Improvement to existing Ability
  • Bug fix
  • Documentation update

External APIs

  • No external APIs
  • Uses external API(s):
    • Enphase Cloud API v4 (requires OAuth 2.0 authentication)
    • Endpoints: /systems/{system_id}/summary, /systems/{system_id}/encharge, /systems/{system_id}/consumption_stats
    • Requires: System ID, API key, OAuth client ID/secret, access/refresh tokens

Testing

  • Tested in OpenHome Live Editor
  • All exit paths tested (said "stop", "exit", etc.)
  • Error scenarios tested (API down, bad input, etc.)

Checklist

  • Files are in community/enphase-solar-monitor/
  • main.py follows SDK pattern (extends MatchingCapability, has register_capability + call)
  • README.md included with description, suggested triggers, and setup
  • resume_normal_flow() called on every exit path
  • No print() — using editor_logging_handler
  • No hardcoded API keys — using placeholders
  • No blocked imports (redis, connection_manager, user_config)
  • No asyncio.sleep() or asyncio.create_task() — using session_tasks
  • Error handling on all external calls
  • Tested in OpenHome Live Editor

Anything else?

Demo Mode Included:
The ability includes a DEMO_MODE = True flag that returns realistic fake data for testing without real Enphase credentials. Perfect for trying out the conversation flow before connecting a real system.

Features:

  • 15-minute data caching to minimize API calls
  • OAuth token auto-refresh
  • Multi-intent classification (production, battery, consumption, grid status)
  • Voice-optimized formatting ("kilowatts" not "kW")
  • Conversational loop with context awareness

Conversation Example:

User: "enphase"
Assistant: "Sure! Let me check your solar system."
Assistant: "You're producing 4.2 kilowatts right now."
Assistant: "Today you've generated 28.0 kilowatt hours."
Assistant: "Your battery is at 73 percent and charging."
User: "what about consumption?"
Assistant: "You're using 3.1 kilowatts right now."
User: "stop"
Assistant: "Okay, talk to you later!"

Loom Demo: https://www.loom.com/share/0ae21d6369eb4310bc96446dd5f5923c


---

## 📋 **Files to Include in PR:**

community/enphase-solar-monitor/
├── main.py
└── README.md

@ammyyou112 ammyyou112 requested review from a team as code owners March 5, 2026 16:16
@github-actions
Copy link
Contributor

github-actions bot commented Mar 5, 2026

🔀 Branch Merge Check

PR direction: add-enphase-solar-monitordev

Passedadd-enphase-solar-monitordev is a valid merge direction

@github-actions github-actions bot added first-contribution First-time contributor community-ability Community-contributed ability templates Starter templates labels Mar 5, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Mar 5, 2026

✅ Community PR Path Check — Passed

All changed files are inside the community/ folder. Looks good!

@github-actions
Copy link
Contributor

github-actions bot commented Mar 5, 2026

❌ Ability Validation Failed

📋 Validating: community/enphase-solar-monitor
  ❌ Missing register capability tag — add one of the following to your class:
    #{{register_capability}}
    # {{register_capability}}
See: https://docs.openhome.com/how_to_build_an_ability
  ❌ 1 error(s) found

📚 How to fix

@github-actions
Copy link
Contributor

github-actions bot commented Mar 5, 2026

🔍 Lint Results

🔧 Auto-formatted

Some files were automatically cleaned and formatted with autoflake + autopep8 and committed.

  • Unused imports removed (autoflake)
  • Unused variables removed (autoflake)
  • PEP8 formatting applied (autopep8)

__init__.py — Empty as expected

Files linted: community/enphase-solar-monitor/main.py

✅ Flake8 — Passed

✅ All checks passed!

@ammyyou112
Copy link
Contributor Author

@uzair401 I have fixed it, and now all the relevant files are within the community folder. Please check, and let me know if there is still an issue.

@ammyyou112 ammyyou112 mentioned this pull request Mar 5, 2026
19 tasks
Copy link
Contributor

@uzair401 uzair401 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please review the code and apply changes as per the latest SDK documentation. Once the code is compliant with the SDK requirements, I'll take another look.

@ammyyou112
Copy link
Contributor Author

Addressed SDK compliance: implemented delete-then-write pattern for _save_prefs() per OpenHome File Storage API requirements for JSON files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community-ability Community-contributed ability first-contribution First-time contributor templates Starter templates

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants