Thank you for your interest in contributing to modbus2mqtt! This guide will help you get started.
- Code of Conduct
- Getting Started
- Development Setup
- Development Workflow
- Coding Standards
- Testing
- Submitting Changes
- Contributing Specifications
Please be respectful and constructive in all interactions with the community.
All changes (code comments, documentation, commit messages, pull request titles and descriptions) must be written in English.
Keeping contributions in English ensures that the widest possible audience can review, maintain, and use the repository.
- A workflow runs on pull requests and pushes that scans commit messages and pull request title/body for non-English indicators (for example German umlauts or common German words).
- If the workflow detects potential non-English text, it will comment on the pull request with guidance and/or fail the check for pushes.
- Use simple clear English. It's fine if the language isn't perfect — clarity is more important than grammar.
- If you need help translating a short message, open an issue or ask in the project's discussion.
- The enforcement workflow aims to catch obvious cases (German words and umlauts). It may produce false positives; use judgement when responding.
- The workflow can be adjusted to whitelist project-specific words or to change sensitivity.
- Fork the repository on GitHub
- Clone your fork locally:
git clone https://github.com/YOUR-USERNAME/modbus2mqtt.git cd server - Add the upstream repository:
git remote add upstream https://github.com/modbus2mqtt/modbus2mqtt.git
For detailed development setup instructions, see the Development Guide.
Quick start:
npm install
npm run install-hooks
npm run build.devgit checkout -b feature/my-new-featureBranch naming conventions:
feature/- New featuresfix/- Bug fixesdocs/- Documentation updatestest/- Test additions or fixesrefactor/- Code refactoring
Follow the coding standards below.
# Run unit tests
npm test
# Run specific test file
npm test __tests__/modbus2mqtt/bus_test.tsx
# Run E2E tests
npm run e2e:start
npm run cypress:openCommits are automatically formatted by the pre-commit hook.
git add .
git commit -m "feat: add new feature description"Commit message format:
feat:- New featurefix:- Bug fixdocs:- Documentation changestest:- Test changesrefactor:- Code refactoringchore:- Maintenance tasks
git push origin feature/my-new-feature- Go to the original repository on GitHub
- Click "New Pull Request"
- Select your branch
- Fill in the PR template with:
- Description of changes
- Related issue numbers
- Testing performed
- Screenshots (if UI changes)
- Use TypeScript for all new code
- Enable strict type checking
- Document public APIs with JSDoc comments
- Code is automatically formatted with Prettier on commit
- Run manually:
npm run prettier - Configuration:
.prettierrc
- ESLint is configured for the project
- Run:
npm run lint(if configured) - Fix automatically:
npm run lint -- --fix
- Files: Use kebab-case for files:
modbus-cache.ts - Classes: Use PascalCase:
ModbusCache - Functions/Variables: Use camelCase:
getSpecification - Constants: Use UPPER_SNAKE_CASE:
MAX_RETRIES - Interfaces: Prefix with
I:IModbusSpecification
src/
├── server/ # Backend server code
├── server.shared/ # Shared types for server
├── specification/ # Specification handling
├── specification.shared/ # Shared specification types
└── angular/ # Frontend Angular code
__tests__/ # Test files
├── server/ # Server tests
└── specification/ # Specification tests
Write tests for all new features and bug fixes:
import { expect, it, describe } from '@jest/globals'
describe('MyFeature', () => {
it('should do something', () => {
// Arrange
const input = 'test'
// Act
const result = myFunction(input)
// Assert
expect(result).toBe('expected')
})
})Add E2E tests for UI changes:
describe('My Feature', () => {
it('should interact correctly', () => {
cy.visit('/my-feature')
cy.get('[data-testid="my-button"]').click()
cy.contains('Expected Result')
})
})Aim for:
- Unit test coverage > 80%
- All critical paths tested
- Edge cases covered
Before submitting:
- Code builds without errors:
npm run build - All tests pass:
npm test - Code is formatted:
npm run prettier - Commit messages follow convention
- Documentation updated (if needed)
- Changelog updated (for significant changes)
- Automated checks run on your PR
- Maintainers review your code
- Address review feedback
- Once approved, your PR will be merged
-
Delete your feature branch:
git branch -d feature/my-new-feature git push origin --delete feature/my-new-feature
-
Update your local main branch:
git checkout main git pull upstream main
Specifications define how to communicate with Modbus devices.
- Use the Web UI:
http://localhost:3000 - Navigate to "Specifications" → "Create New"
- Fill in device details:
- Name and manufacturer
- Modbus registers
- Data types and conversions
- MQTT topics
- Add test data in the specification
- Connect to a real device (if available)
- Verify all entities read correctly
- Document any quirks or special requirements
- Export the specification from the UI
- Create a PR with:
- Specification YAML file
- Documentation (README in
specifications/folder) - Images or datasheets (if available)
- Test results
- Use clear, descriptive names
- Include manufacturer and model information
- Document all entities thoroughly
- Add identification rules when possible
- Include links to official documentation
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Documentation: Check the
docs/folder
Contributors will be acknowledged in:
CREDITS.mdfile- Release notes
- Project documentation
Thank you for contributing to modbus2mqtt! 🎉