-
-
Notifications
You must be signed in to change notification settings - Fork 0
Home
Welcome to the Marstek Cloud Battery integration wiki! This page provides comprehensive documentation, troubleshooting guides, and tips for using this Home Assistant integration.
- Quick Start Guide
- Installation
- Configuration
- Troubleshooting
- Energy Dashboard Setup
- Advanced Configuration
- API Information
- Frequently Asked Questions
- Development & Contributing
The fastest way to get started:
- Install via HACS (recommended) or manually
- Restart Home Assistant
- Go to Settings → Devices & Services → Add Integration
- Search for "Marstek Cloud Battery"
- Enter your Marstek cloud credentials
- Configure scan interval (default: 60 seconds)
- Set battery capacities if needed
Once configured, your battery sensors will appear in Home Assistant!
- Install HACS if you haven't already
- In HACS, go to Integrations
- Click the three dots menu (⋮) and select Custom repositories
- Add repository:
https://github.com/d0n0van/marstek_cloud - Select Integration as the category
- Click Add then Install
- Restart Home Assistant
- Download the latest release from the Releases page
- Extract the
marstek_cloudfolder - Copy it to your Home Assistant
custom_componentsdirectory:-
Home Assistant OS/Supervised:
/config/custom_components/ -
Home Assistant Container:
/config/custom_components/ -
Home Assistant Core: Your config directory's
custom_components/
-
Home Assistant OS/Supervised:
- Restart Home Assistant
During setup, you'll be asked for:
- Email: Your Marstek cloud account email
- Password: Your Marstek cloud account password
- Scan Interval: How often to poll the API (10-3600 seconds, default: 60)
- Default Battery Capacity: Default capacity for all batteries in kWh (default: 5.12)
After initial setup, you can update settings via:
- Go to Settings → Devices & Services
- Find Marstek Cloud Battery integration
- Click Configure (or the three dots menu)
- Update scan interval or battery capacities
Each battery can have its own capacity setting:
- Set during initial setup for all batteries
- Update individual battery capacities via the Options menu
- Capacity is used to calculate
total_charge(soc × capacity)
Problem: Can't find "Marstek Cloud Battery" in the integration search.
Solutions:
- Ensure the integration is properly installed in
custom_components/marstek_cloud/ - Check that
manifest.jsonexists in the integration folder - Restart Home Assistant
- Clear browser cache
Problem: "Authentication failed" or "Login failed" errors.
Solutions:
- Verify your email and password are correct
- Check your Marstek cloud account status
- Ensure your account has API access
- Check Home Assistant logs for detailed error messages
Problem: Sensors show as "unavailable" or don't update.
Solutions:
- Check the
connection_statusdiagnostic sensor - Review
api_latencydiagnostic sensor for slow responses - Verify your scan interval is appropriate (not too frequent)
- Check Home Assistant logs for API errors
- Verify your devices are online in the Marstek cloud portal
Problem: Getting rate limit errors in logs.
Solutions:
- Increase your scan interval (reduce API call frequency)
- Recommended minimum: 60 seconds
- The integration automatically handles rate limits with retries
Problem: High latency reported in diagnostic sensor.
Solutions:
- High latency usually indicates network or API server issues
- Check your internet connection
- Marstek API servers may be experiencing high load
- Consider increasing scan interval to reduce load
This integration provides native Energy Dashboard support!
- Go to Settings → Energy
- In the Battery section, click Add battery storage
- Select your battery's
charge_power_kwhsensor - Select your battery's
discharge_power_kwhintermittent sensor - Repeat for each battery if you have multiple
If you prefer custom sensor names, you can create template sensors:
template:
- sensor:
- name: "Marstek Charge"
unit_of_measurement: "kWh"
state: "{{ (states('sensor.mst_vnse3_a4c2_charge_power') | float(0) / 1000) | round(2) }}"
state_class: total
device_class: energy
- name: "Marstek Discharge"
unit_of_measurement: "kWh"
state: "{{ (states('sensor.mst_vnse3_a4c2_discharge_power') | float烟雾(0) / 1000) | round(2) }}"
state_class: total
device_class: energyNote: Replace mst_vnse3_a4c2 with your actual device ID (found in Settings → Devices & Services → Entities).
The scan interval affects:
- API load: More frequent = higher load
- Data freshness: More frequent = more up-to-date data
- Battery usage: More frequent = more battery usage (for mobile installations)
Recommendations:
- Default: 60 seconds (good balance)
- Low power/rate limit concerns: 300-600 seconds
- Maximum freshness: 10-30 seconds (use with caution)
If you have multiple Marstek battery systems:
- Each system requires its own integration instance
- Use different scan intervals if needed
- Sensors will have unique names per instance
The total_charge sensor calculates: (soc / 100) × capacity_kwh
- Ensure your battery capacity is correctly set
- Update capacity via Options menu if incorrect
- Capacity can be set per device
-
Login:
POST https://eu.hamedata.com/app/Solar/v2_get_device.php -
Get Devices:
GET https://eu.hamedata.com/ems/api/v1/getDeviceList
- Uses MD5 hashed passwords (required by Marstek API)
- Tokens automatically refresh when expired
- Handles authentication errors gracefully
- Passwords are encrypted at rest by Home Assistant
- Sensitive data is never logged
- All API communication uses HTTPS
A: The Marstek cloud API requires client-side MD5 hashing. This is an API requirement, not a choice by this integration. Passwords are properly secured in Home Assistant's encrypted storage and never logged.
A: Yes! Add multiple integration instances, each with different credentials.
A: 60 seconds is recommended for most users. Reduce frequency if experiencing rate limits, increase if you need more frequent updates (but be mindful of API load).
A: Go to Settings → Devices & Services → Marstek Cloud Battery → Configure (or Options) and update the capacity for the specific battery.
A: Yes! Home Assistant automatically stores sensor history. You can view it in the sensor history panel or create graphs in Lovelace.
A: Yes! The integration provides native kWh sensors specifically designed for the Energy Dashboard. See the Energy Dashboard Setup section above.
A: The API endpoints point to eu.hamedata.com. If you're outside Europe, you may experience higher latency. Contact Marstek support if you need region-specific endpoints.
# Activate development environment
source activate_env.sh
# Run unit tests
python -m pytest tests/test_coordinator.py -v
# Run all tests (excluding integration tests)
python run_tests.py
# Run integration tests (requires real credentials)
python run_integration_test.py- Uses
blackfor code formatting - Uses
flake8for linting - Uses
mypyfor type checking - Pre-commit hooks available
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Ensure all tests pass
- Submit a pull request
See the README for more development details.
- GitHub Repository: https://github.com/d0n0van/marstek_cloud
- Issues & Support: GitHub Issues
- 空Original Integration: @DoctaShizzle/marstek_cloud
- HACS: https://hacs.xyz/
- Home Assistant Forum: Community Forum
- v0.6.9 - Security improvements: Password redaction, security documentation
- v0.6.8 - Previous stable release
- See Releases for full changelog
Note: This is a community-maintained integration. For official Marstek support, contact Marstek directly.