mirror of
https://github.com/openhab/openhab-addons.git
synced 2025-01-30 17:12:01 +01:00
f699c8526e
Signed-off-by: Ciprian Pascu <contact@ciprianpascu.ro>
2.4 KiB
2.4 KiB
SBUS Binding Development
This document provides information for developers who want to contribute to the OpenHAB SBUS binding.
Development Setup
- Clone the OpenHAB addons repository:
git clone https://github.com/openhab/openhab-addons.git
cd openhab-addons
- Build the binding:
cd bundles/org.openhab.binding.sbus
mvn clean install
Project Structure
org.openhab.binding.sbus/
├── src/main/java/org/openhab/binding/sbus/
│ ├── handler/ # Thing handlers
│ │ ├── SbusRgbwHandler.java
│ │ ├── SbusSwitchHandler.java
│ │ └── SbusTemperatureHandler.java
│ └── internal/ # Internal implementation
│ └── SbusBridgeHandler.java
└── src/main/resources/
└── OH-INF/ # OpenHAB configuration files
├── binding/ # Binding definitions
├── thing/ # Thing type definitions
└── i18n/ # Internationalization
Key Components
SbusBridgeHandler
: Manages the UDP connection to SBUS devicesSbusRgbwHandler
: Handles RGBW light controlSbusSwitchHandler
: Handles switch controlSbusTemperatureHandler
: Handles temperature sensor readings
Testing
-
Unit Tests
- Run unit tests with:
mvn test
- Add new tests in
src/test/java/
- Run unit tests with:
-
Integration Testing
- Test with real SBUS devices
- Verify all supported channels work correctly
- Test error handling and recovery
Debugging
- Enable debug logging in OpenHAB:
log:set DEBUG org.openhab.binding.sbus
- Monitor SBUS communication:
openhab> sbus:monitor start
Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Follow OpenHAB coding guidelines
- Add appropriate unit tests
- Update documentation
- Submit a pull request
Code Style
- Follow OpenHAB's code style guidelines
- Use the provided code formatter
- Run
mvn spotless:apply
before committing
Documentation
When adding new features:
- Update README.md with user-facing changes
- Update thing-types.xml for new channels/configurations
- Add appropriate JavaDoc comments
- Update this DEVELOPERS.md if needed
Building from Source
cd openhab-addons/bundles/org.openhab.binding.sbus
mvn clean install
The built JAR will be in target/org.openhab.binding.sbus-[version].jar