Hey there! 👋 Thanks for considering contributing to this project! We're excited to have you here!
Whether you're fixing a typo, squashing a bug, or adding a cool new feature - every contribution matters! 🎉
There are just a few things to keep in mind to make sure everything runs smoothly:
First time contributing to open source? Welcome! 🎉
We've got you covered with issues tagged as "good first issue" - these are perfect for getting started! They're:
- 🎯 Well-defined and focused
- 📚 Have clear acceptance criteria
- 💡 Include hints or guidance
- 🚀 Great learning opportunities
How to find them:
- Go to Issues
- Filter by label:
good first issue - Pick one that interests you
- Comment on the issue to let others know you're working on it
- Follow the development workflow below
Need help? Don't hesitate to ask questions in the issue comments or open a discussion! We're here to help! 💪
- 🐛
bug- Something isn't working correctly - ✨
enhancement- New feature or request - 📝
documentation- Improvements or additions to documentation - 🌟
good first issue- Good for newcomers - 🆘
help wanted- Extra attention is needed - ❓
question- Further information is requested - 🔄
dependencies- Pull requests that update a dependency file - 🚨
priority: high- High priority issues - 💥
breaking change- Changes that break backward compatibility
Let's keep things organized! Here's how we handle branches:
- 🎯 Merge your PR to the
devbranch - This is where all the magic happens! (PRs againstmainwill be rejected) - 🏠 The
mainbranch is our "production" version - only stable releases here - 🚀 The
devbranch is where we test new stuff before it goes live
We use conventional commits - sounds fancy, but it's actually pretty simple!
Examples:
feat: add temperature monitoring for spools🆕fix: resolve issue with color visualization🐛docs: update README with new sensor info📝refactor: improve code structure🔧
This helps our CI/CD pipeline automatically create releases and changelogs. Pretty cool, right? 🎉
We've got you covered! This project includes a fully configured Dev Container that sets up everything for you automatically. No more "works on my machine" problems! 🎉
- Docker installed and running 🐋
- Visual Studio Code with the Dev Containers extension 💻
-
Clone the repository:
git clone https://github.com/Disane87/spoolman-homeassistant.git cd spoolman-homeassistant -
Open in Dev Container:
- Open the project in VS Code
- When prompted, click "Reopen in Container" (or press
F1and select "Dev Containers: Reopen in Container") - Wait for the container to build and start (first time takes a few minutes)
-
What's Included:
- ✅ Home Assistant Core - Full Home Assistant instance for testing
- ✅ Python 3.13 - Latest Python with all required dependencies
- ✅ Pre-configured tasks - Start/stop Home Assistant with a single click
- ✅ Linting tools - pylint, black, isort pre-configured
- ✅ Git - Latest version for version control
- ✅ Node.js & npm - For any frontend tooling needs
-
🚀 Start Home Assistant:
- Press
Ctrl+Shift+B(orCmd+Shift+Bon Mac) - Select "startHomeAssistant" task
- Or run:
./scripts/developin the terminal - Home Assistant will start at
http://localhost:8123🏠
- Press
-
🛑 Stop Home Assistant:
- Use the "stopHomeAssistant" task
- Or press
Ctrl+Cin the terminal running Home Assistant
-
📂 Configuration Location:
- Home Assistant config:
/config/🏠 - Integration code:
/spoolman-homeassistant/custom_components/spoolman/📝 - Logs:
/config/home-assistant.log📋
- Home Assistant config:
-
🧪 Testing Your Changes:
- Make changes to the integration code ✏️
- Restart Home Assistant (stop + start) 🔄
- Check logs for any errors:
tail -f /config/home-assistant.log🔍 - Configure the integration at
http://localhost:8123/config/integrations
-
🧪 Running Tests:
# Run all tests pytest tests/ # Run specific test file pytest tests/test_sensor.py # Run with coverage pytest --cov=custom_components.spoolman tests/
-
✨ Linting and Code Quality:
# Run pylint ./scripts/lint # Format code with black black custom_components/spoolman/ # Sort imports isort custom_components/spoolman/
You'll need a running Spoolman instance to test the integration. Here are your options:
Option 1: Use Docker (Recommended) 🐋
docker run -d \
--name spoolman \
-p 7912:8000 \
-v spoolman_data:/home/app/.local/share/spoolman \
ghcr.io/donkie/spoolman:latestOption 2: Use existing Spoolman instance 🌐
- Point the integration to your existing Spoolman URL during setup
-
📝 Enable Debug Logging: Add to
/config/configuration.yaml:logger: default: info logs: custom_components.spoolman: debug
-
🔍 Use VS Code Debugger:
- Set breakpoints in your code 🎯
- Use the included launch configuration "Python: Home Assistant"
- Press
F5to start debugging - Step through your code like a pro! 😎
-
📋 Check Logs:
# Follow logs in real-time tail -f /config/home-assistant.log # Search for errors grep -i "error" /config/home-assistant.log # Filter integration logs grep "spoolman" /config/home-assistant.log
Here's what goes where (so you don't get lost! 🗺️):
/spoolman-homeassistant/
├── custom_components/
│ └── spoolman/ # Main integration code
│ ├── __init__.py # Integration setup
│ ├── sensor.py # Sensor platform
│ ├── coordinator.py # Data update coordinator
│ ├── config_flow.py # Configuration flow
│ ├── select.py # Location select entity
│ ├── services.yaml # Service definitions
│ ├── manifest.json # Integration manifest
│ └── sensors/ # Individual sensor classes (27 files)
├── config/ # Home Assistant config directory
├── tests/ # Unit tests
├── scripts/ # Helper scripts
│ ├── develop # Start Home Assistant
│ ├── lint # Run linting
│ └── setup # Setup development environment
├── .devcontainer/ # Dev Container configuration
└── docs/ # Documentation
Want to test with a newer Home Assistant version? No problem! Here's how:
Option 1: Update Python Package (Quick) ⚡
# Update to latest stable
pip install --upgrade homeassistant
# Or install specific version
pip install homeassistant==2024.11.0
# Restart Home Assistant after update
./scripts/developOption 2: Rebuild Dev Container (Clean) 🧹
# Exit and rebuild container
# In VS Code: Press F1 → "Dev Containers: Rebuild Container"
# Or rebuild from command line:
docker-compose -f .devcontainer/docker-compose.yml build --no-cache🔍 Check Home Assistant Version:
# In terminal
hass --version
# Or in Home Assistant UI
# Settings → System → About📦 Update All Dependencies:
# Update all Python packages
pip install --upgrade -r requirements.txt
# Verify integration dependencies
pip list | grep -E "homeassistant|aiohttp|pillow"Little things that'll save you time:
- ⚡ Reload Integration: Instead of restarting HA completely, use Developer Tools → YAML → Reload "Custom Integrations" (much faster!)
- 🧹 Clear Cache: Delete
/config/.storage/core.config_entriesif you need to reconfigure the integration from scratch - 📊 Monitor Performance: Use Home Assistant's built-in performance monitoring tools to see how your changes affect speed
- 📝 Entity Registry: Check
/config/.storage/core.entity_registryto see what entities are registered - 🐍 Python Cache: Clear
__pycache__folders if you get weird import issues:find . -type d -name __pycache__ -exec rm -rf {} + - 🗄️ Database Reset: Delete
/config/home-assistant_v2.dbto start fresh (warning: loses all history!)
Prefer to keep things local? That's cool too! Here's how:
-
📋 Requirements:
- Python 3.11 or higher
- Home Assistant Core installed
- Git
-
Setup:
# Create virtual environment python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate # Install dependencies pip install -r requirements.txt # Link integration to your HA config ln -s $(pwd)/custom_components/spoolman ~/.homeassistant/custom_components/spoolman
-
Start Home Assistant:
hass -c ~/.homeassistant
💡 Note: We really recommend the Dev Container approach - it just works! But hey, you do you! 😊
- Adhering to these guidelines is crucial because our CI/CD pipeline depends on this workflow. The
devbranch is used for testing and validation, whilemainis reserved for stable releases.
-
Code Quality:
- Ensure your code is clean, well-documented, and follows the project’s coding standards.
- Write clear, concise, and descriptive comments where necessary.
- Refactor code where needed to maintain readability and simplicity.
-
Testing:
- Write unit tests for your code to ensure functionality.
- Run all existing tests to make sure your changes do not break any existing functionality.
- Ensure your code passes the CI tests before submitting a PR.
-
Documentation:
- Update the documentation to reflect any changes in the code.
- Ensure new features or changes are documented with examples and usage instructions.
-
Issue Tracking:
- Reference any relevant issues in your commit messages and PR descriptions.
- Use keywords like "fixes" or "closes" followed by the issue number to link PRs to issues.
-
Code Reviews:
- Be responsive to feedback from code reviewers and make necessary changes promptly.
- Review others' PRs if you have the expertise and provide constructive feedback.
-
Style Guidelines:
- Follow the established coding style of the project. Consistency is key.
- Use linting tools provided in the project to maintain code style.
-
Communication:
- Be respectful and considerate in all communications.
- Discuss any significant changes or new features with the project maintainers before starting work to ensure alignment with project goals.
We value all contributions! Contributors will be:
- 📋 Listed in our
README.md(via our automated contributor workflow) - 🏆 Mentioned in release notes for significant contributions
- ⭐ Featured in our GitHub contributors page
This project uses several GitHub Actions to make contributing easier:
- ✅ Auto-labeling: Area labels added automatically based on changes
- ✅ PR validation: Checks for conventional commits, target branch, linked issues
- ✅ Size labeling: PRs automatically tagged by size
- ✅ Welcome messages: First-time contributors get helpful guidance
- ✅ Stale issue management: Old good first issues are cleaned up automatically
See our Automations Guide for full details!
- Home Assistant Developer Documentation
- Spoolman API Documentation
- Conventional Commits
- Python Type Hints
- GitHub Automations
- Issues: Report bugs and request features
- Discussions: Ask questions and share ideas
- Pull Requests: Submit your contributions
Thank you for contributing and helping to maintain the quality and consistency of the project! Every contribution, no matter how small, makes a difference! 🙏✨