Skip to content

Commit 2a7a76f

Browse files
authored
[sbus] Initial contribution (openhab#18019)
* Initial contribution Signed-off-by: Ciprian Pascu <[email protected]>
1 parent ee9697b commit 2a7a76f

25 files changed

+1884
-0
lines changed

CODEOWNERS

+1
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,7 @@
332332
/bundles/org.openhab.binding.salus/ @magx2
333333
/bundles/org.openhab.binding.samsungtv/ @NickWaterton
334334
/bundles/org.openhab.binding.satel/ @druciak
335+
/bundles/org.openhab.binding.sbus/ @cipianpascu
335336
/bundles/org.openhab.binding.semsportal/ @itb3
336337
/bundles/org.openhab.binding.senechome/ @vctender @KorbinianP @eguib
337338
/bundles/org.openhab.binding.seneye/ @nikotanghe

bom/openhab-addons/pom.xml

+5
Original file line numberDiff line numberDiff line change
@@ -1636,6 +1636,11 @@
16361636
<artifactId>org.openhab.binding.satel</artifactId>
16371637
<version>${project.version}</version>
16381638
</dependency>
1639+
<dependency>
1640+
<groupId>org.openhab.addons.bundles</groupId>
1641+
<artifactId>org.openhab.binding.sbus</artifactId>
1642+
<version>${project.version}</version>
1643+
</dependency>
16391644
<dependency>
16401645
<groupId>org.openhab.addons.bundles</groupId>
16411646
<artifactId>org.openhab.binding.semsportal</artifactId>
+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
This content is produced and maintained by the openHAB project.
2+
3+
* Project home: https://www.openhab.org
4+
5+
== Declared Project Licenses
6+
7+
This program and the accompanying materials are made available under the terms
8+
of the Eclipse Public License 2.0 which is available at
9+
https://www.eclipse.org/legal/epl-2.0/.
10+
11+
== Source Code
12+
13+
https://github.com/openhab/openhab-addons
+136
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
# Sbus Binding
2+
3+
This binding integrates Sbus devices with openHAB, allowing control and monitoring of Sbus-compatible devices over UDP.
4+
Sbus is a protocol used for home automation devices that communicate over UDP networks.
5+
The binding supports various device types including RGB/RGBW controllers, temperature sensors, and switch controllers.
6+
7+
## Supported Things
8+
9+
- `udp` - Sbus Bridge for UDP communication
10+
- `rgbw` - RGB/RGBW Controllers for color and brightness control
11+
- `temperature` - Temperature Sensors for monitoring environmental conditions
12+
- `switch` - Switch Controllers for basic on/off and dimming control
13+
14+
## Discovery
15+
16+
Sbus devices communicate via UDP broadcast, but manual configuration is required to set up the devices in openHAB.
17+
Auto-discovery is not supported at this moment.
18+
19+
## Binding Configuration
20+
21+
The binding itself does not require any special configuration.
22+
23+
## Thing Configuration
24+
25+
### Bridge Configuration
26+
27+
The Sbus Bridge has the following configuration parameters:
28+
29+
| Name | Type | Description | Default | Required | Advanced |
30+
|---------|---------|------------------------------------------------------|---------|----------|-----------|
31+
| host | text | IP address of the Sbus device (typically broadcast) | N/A | yes | no |
32+
| port | integer | UDP port number | 6000 | no | no |
33+
34+
### RGBW Controller Configuration
35+
36+
| Name | Type | Description | Default | Required | Advanced |
37+
|---------|---------|------------------------------------------------------|---------|----------|-----------|
38+
| subnetId| integer | Subnet ID the RGBW controller is part of | N/A | yes | no |
39+
| id | integer | Device ID of the RGBW controller | N/A | yes | no |
40+
| refresh | integer | Refresh interval in seconds | 30 | no | yes |
41+
42+
### Temperature Sensor Configuration
43+
44+
| Name | Type | Description | Default | Required | Advanced |
45+
|---------|---------|------------------------------------------------------|---------|----------|-----------|
46+
| subnetId| integer | Subnet ID the temperature sensor is part of | N/A | yes | no |
47+
| id | integer | Device ID of the temperature sensor | N/A | yes | no |
48+
| refresh | integer | Refresh interval in seconds | 30 | no | yes |
49+
50+
### Switch Controller Configuration
51+
52+
| Name | Type | Description | Default | Required | Advanced |
53+
|---------|---------|------------------------------------------------------|---------|----------|-----------|
54+
| subnetId| integer | Subnet ID the switch controller is part of | N/A | yes | no |
55+
| id | integer | Device ID of the switch controller | N/A | yes | no |
56+
| refresh | integer | Refresh interval in seconds | 30 | no | yes |
57+
58+
## Channels
59+
60+
### RGBW Controller Channels
61+
62+
| Channel | Type | Read/Write | Description |
63+
|---------|--------|------------|------------------------------------------------------------|
64+
| color | Color | RW | HSB color picker that controls RGBW components (0-100%) |
65+
| switch | Switch | RW | On/Off control for the RGBW output with optional timer |
66+
67+
### Temperature Sensor Channels
68+
69+
| Channel | Type | Read/Write | Description |
70+
|-------------|---------------------|------------|--------------------------------|
71+
| temperature | Number:Temperature | R | Current temperature reading. Can be configured to use Celsius (default) or Fahrenheit units |
72+
73+
### Switch Controller Channels
74+
75+
| Channel | Type | Read/Write | Description |
76+
|---------|---------|------------|-----------------------------------------------------------|
77+
| switch | Switch | RW | Basic ON/OFF state control |
78+
| dimmer | Dimmer | RW | ON/OFF state with timer transition |
79+
| paired | Contact | RW | OPEN/CLOSED state for two paired channels (e.g., curtains)|
80+
81+
## Full Example
82+
83+
### Thing Configuration
84+
85+
```java
86+
Bridge sbus:udp:mybridge [ host="192.168.1.255", port=5000 ] {
87+
Thing rgbw colorctrl [ id=72, refresh=30 ] {
88+
Channels:
89+
Type color-channel : color [ channelNumber=1 ] // HSB color picker, RGBW values stored at channel 1
90+
Type switch-channel : power [ channelNumber=1 ] // On/Off control for the RGBW output For complex scenes, one Sbus color controller can keep up to 40 color states. The switch channelNumber has to fall into this range.
91+
}
92+
93+
Thing temperature temp1 [ id=62, refresh=30 ] {
94+
Channels:
95+
Type temperature-channel : temperature [ channelNumber=1 ]
96+
}
97+
98+
Thing switch switch1 [ id=75, refresh=30 ] {
99+
Channels:
100+
Type switch-channel : first_switch [ channelNumber=1 ]
101+
Type dimmer-channel : second_switch [ channelNumber=2 ]
102+
Type paired-channel : third_switch [ channelNumber=3 ]
103+
}
104+
}
105+
```
106+
107+
### Item Configuration
108+
109+
```java
110+
// Temperature Sensor
111+
Number:Temperature Temp_Sensor "Temperature [%.1f °C]" { channel="sbus:temperature:mybridge:temp1:temperature" }
112+
113+
// Basic Switch
114+
Switch Light_Switch "Switch" { channel="sbus:switch:mybridge:switch1:switch" }
115+
116+
// Paired Channel (e.g., for curtains)
117+
Contact Curtain_Switch "Curtain [%s]" { channel="sbus:switch:mybridge:switch1:third_switch" }
118+
119+
// RGBW Controller with Power Control
120+
Group gLight "RGBW Light" <light> ["Lighting"]
121+
Color rgbwColor "Color" <colorwheel> (gLight) ["Control", "Light"] { channel="sbus:rgbw:mybridge:colorctrl:color" }
122+
Switch rgbwPower "Power" <switch> (gLight) ["Switch", "Light"] { channel="sbus:rgbw:mybridge:colorctrl:power" }
123+
```
124+
125+
### Sitemap Configuration
126+
127+
```perl
128+
sitemap sbus label="Sbus Demo"
129+
{
130+
Frame label="Sbus Controls" {
131+
Colorpicker item=Light_RGB
132+
Text item=Temp_Sensor
133+
Switch item=Light_Switch
134+
Text item=Curtain_Switch
135+
}
136+
}
+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
4+
5+
<modelVersion>4.0.0</modelVersion>
6+
7+
<parent>
8+
<groupId>org.openhab.addons.bundles</groupId>
9+
<artifactId>org.openhab.addons.reactor.bundles</artifactId>
10+
<version>5.0.0-SNAPSHOT</version>
11+
</parent>
12+
13+
<artifactId>org.openhab.binding.sbus</artifactId>
14+
15+
<name>openHAB Add-ons :: Bundles :: Sbus Binding</name>
16+
17+
<dependencies>
18+
<dependency>
19+
<groupId>ro.ciprianpascu</groupId>
20+
<artifactId>j2sbus</artifactId>
21+
<version>1.5.7</version>
22+
<scope>compile</scope>
23+
</dependency>
24+
</dependencies>
25+
26+
</project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<features name="org.openhab.binding.sbus-${project.version}" xmlns="http://karaf.apache.org/xmlns/features/v1.4.0">
3+
<repository>mvn:org.openhab.core.features.karaf/org.openhab.core.features.karaf.openhab-core/${ohc.version}/xml/features</repository>
4+
5+
<feature name="openhab-binding-sbus" description="Sbus Binding" version="${project.version}">
6+
<feature>openhab-runtime-base</feature>
7+
<bundle start-level="80">mvn:org.openhab.addons.bundles/org.openhab.binding.sbus/${project.version}</bundle>
8+
</feature>
9+
</features>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
/*
2+
* Copyright (c) 2010-2025 Contributors to the openHAB project
3+
*
4+
* See the NOTICE file(s) distributed with this work for additional
5+
* information.
6+
*
7+
* This program and the accompanying materials are made available under the
8+
* terms of the Eclipse Public License 2.0 which is available at
9+
* http://www.eclipse.org/legal/epl-2.0
10+
*
11+
* SPDX-License-Identifier: EPL-2.0
12+
*/
13+
package org.openhab.binding.sbus;
14+
15+
import org.eclipse.jdt.annotation.NonNullByDefault;
16+
import org.openhab.core.thing.ThingTypeUID;
17+
18+
/**
19+
* The {@link BindingConstants} class defines common constants used across the Sbus binding.
20+
*
21+
* @author Ciprian Pascu - Initial contribution
22+
*/
23+
@NonNullByDefault
24+
public class BindingConstants {
25+
26+
private BindingConstants() {
27+
// Prevent instantiation
28+
}
29+
30+
public static final String BINDING_ID = "sbus";
31+
32+
// Bridge Type
33+
public static final ThingTypeUID THING_TYPE_UDP_BRIDGE = new ThingTypeUID(BINDING_ID, "udp");
34+
35+
// Thing Types
36+
public static final ThingTypeUID THING_TYPE_SWITCH = new ThingTypeUID(BINDING_ID, "switch");
37+
public static final ThingTypeUID THING_TYPE_TEMPERATURE = new ThingTypeUID(BINDING_ID, "temperature");
38+
public static final ThingTypeUID THING_TYPE_RGBW = new ThingTypeUID(BINDING_ID, "rgbw");
39+
40+
// Channel IDs for Switch Device
41+
public static final String CHANNEL_SWITCH_STATE = "state";
42+
43+
// Channel IDs for Temperature Device
44+
public static final String CHANNEL_TEMPERATURE = "temperature";
45+
46+
// Channel IDs for RGBW Device
47+
public static final String CHANNEL_RED = "red";
48+
public static final String CHANNEL_GREEN = "green";
49+
public static final String CHANNEL_BLUE = "blue";
50+
public static final String CHANNEL_WHITE = "white";
51+
public static final String CHANNEL_COLOR = "color";
52+
53+
// Channel Types
54+
public static final String CHANNEL_TYPE_COLOR = "color-channel";
55+
public static final String CHANNEL_TYPE_SWITCH = "switch-channel";
56+
public static final String CHANNEL_TYPE_DIMMER = "dimmer-channel";
57+
public static final String CHANNEL_TYPE_PAIRED = "paired-channel";
58+
}

0 commit comments

Comments
 (0)