Skip to content

Commit 5a27b0e

Browse files
authored
[huesync] Initial contribution (openhab#16516)
* ☠️ Binding skeleton created for org.openhab.binding.huesync Signed-off-by: Patrik Gfeller <[email protected]> Signed-off-by: Patrik Gfeller <[email protected]>
1 parent 36bde00 commit 5a27b0e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+2937
-0
lines changed

CODEOWNERS

+1
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@
159159
/bundles/org.openhab.binding.hpprinter/ @cossey
160160
/bundles/org.openhab.binding.http/ @J-N-K
161161
/bundles/org.openhab.binding.hue/ @cweitkamp @andrewfg
162+
/bundles/org.openhab.binding.huesync/ @pgfeller
162163
/bundles/org.openhab.binding.hydrawise/ @digitaldan
163164
/bundles/org.openhab.binding.hyperion/ @tavalin
164165
/bundles/org.openhab.binding.iammeter/ @lewei50

bom/openhab-addons/pom.xml

+5
Original file line numberDiff line numberDiff line change
@@ -796,6 +796,11 @@
796796
<artifactId>org.openhab.binding.hue</artifactId>
797797
<version>${project.version}</version>
798798
</dependency>
799+
<dependency>
800+
<groupId>org.openhab.addons.bundles</groupId>
801+
<artifactId>org.openhab.binding.huesync</artifactId>
802+
<version>${project.version}</version>
803+
</dependency>
799804
<dependency>
800805
<groupId>org.openhab.addons.bundles</groupId>
801806
<artifactId>org.openhab.binding.hydrawise</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

bundles/org.openhab.binding.huesync/README.md

+220
Large diffs are not rendered by default.
Loading
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
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>4.3.0-SNAPSHOT</version>
11+
</parent>
12+
13+
<artifactId>org.openhab.binding.huesync</artifactId>
14+
15+
<name>openHAB Add-ons :: Bundles :: Hue Sync Box Binding</name>
16+
17+
</project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<features name="org.openhab.binding.huesync-${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-huesync" description="Hue Sync Box Binding" version="${project.version}">
6+
<feature>openhab-runtime-base</feature>
7+
<feature>openhab-transport-mdns</feature>
8+
<bundle start-level="80">mvn:org.openhab.addons.bundles/org.openhab.binding.huesync/${project.version}</bundle>
9+
</feature>
10+
</features>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/**
2+
* Copyright (c) 2010-2024 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.huesync.internal;
14+
15+
import org.eclipse.jdt.annotation.NonNullByDefault;
16+
17+
/**
18+
*
19+
* @author Patrik Gfeller - Initial contribution
20+
*/
21+
@NonNullByDefault
22+
public class HdmiChannels {
23+
public String name;
24+
public String type;
25+
public String mode;
26+
public String status;
27+
28+
public HdmiChannels(String name, String type, String mode, String status) {
29+
this.name = name;
30+
this.type = type;
31+
this.mode = mode;
32+
this.status = status;
33+
}
34+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
/**
2+
* Copyright (c) 2010-2024 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.huesync.internal;
14+
15+
import org.eclipse.jdt.annotation.NonNullByDefault;
16+
import org.openhab.core.thing.ThingTypeUID;
17+
18+
/**
19+
* The {@link HueSyncConstants} class defines common constants, which are
20+
* used across the whole binding.
21+
*
22+
* @author Patrik Gfeller - Initial contribution
23+
*/
24+
@NonNullByDefault
25+
public class HueSyncConstants {
26+
public static class ENDPOINTS {
27+
public static final String DEVICE = "device";
28+
public static final String REGISTRATIONS = "registrations";
29+
public static final String HDMI = "hdmi";
30+
public static final String EXECUTION = "execution";
31+
32+
public static class COMMANDS {
33+
public static final String MODE = "mode";
34+
public static final String SYNC = "syncActive";
35+
public static final String HDMI = "hdmiActive";
36+
public static final String SOURCE = "hdmiSource";
37+
public static final String BRIGHTNESS = "brightness";
38+
}
39+
}
40+
41+
public static class CHANNELS {
42+
public static class DEVICE {
43+
public static class INFORMATION {
44+
public static final String FIRMWARE = "device-firmware#firmware";
45+
public static final String FIRMWARE_AVAILABLE = "device-firmware#available-firmware";
46+
}
47+
}
48+
49+
public static class COMMANDS {
50+
public static final String MODE = "device-commands#mode";
51+
public static final String SYNC = "device-commands#sync-active";
52+
public static final String HDMI = "device-commands#hdmi-active";
53+
public static final String SOURCE = "device-commands#hdmi-source";
54+
public static final String BRIGHTNESS = "device-commands#brightness";
55+
}
56+
57+
public static class HDMI {
58+
public static final HdmiChannels IN_1 = new HdmiChannels("device-hdmi-in-1#name", "device-hdmi-in-1#type",
59+
"device-hdmi-in-1#mode", "device-hdmi-in-1#status");
60+
public static final HdmiChannels IN_2 = new HdmiChannels("device-hdmi-in-2#name", "device-hdmi-in-2#type",
61+
"device-hdmi-in-2#mode", "device-hdmi-in-2#status");
62+
public static final HdmiChannels IN_3 = new HdmiChannels("device-hdmi-in-3#name", "device-hdmi-in-3#type",
63+
"device-hdmi-in-3#mode", "device-hdmi-in-3#status");
64+
public static final HdmiChannels IN_4 = new HdmiChannels("device-hdmi-in-4#name", "device-hdmi-in-4#type",
65+
"device-hdmi-in-4#mode", "device-hdmi-in-4#status");
66+
67+
public static final HdmiChannels OUT = new HdmiChannels("device-hdmi-out#name", "device-hdmi-out#type",
68+
"device-hdmi-out#mode", "device-hdmi-out#status");
69+
}
70+
}
71+
72+
public static final String APPLICATION_NAME = "openHAB";
73+
74+
/** Minimal API Version required. Only apiLevel >= 7 is supported. */
75+
public static final Integer MINIMAL_API_VERSION = 7;
76+
77+
public static final String BINDING_ID = "huesync";
78+
public static final String THING_TYPE_ID = "box";
79+
public static final ThingTypeUID THING_TYPE_UID = new ThingTypeUID(BINDING_ID, THING_TYPE_ID);
80+
81+
public static final String PARAMETER_HOST = "host";
82+
public static final String PARAMETER_PORT = "port";
83+
84+
public static final Integer REGISTRATION_INITIAL_DELAY = 3;
85+
public static final Integer REGISTRATION_INTERVAL = 1;
86+
87+
public static final String REGISTRATION_ID = "registrationId";
88+
public static final String API_TOKEN = "apiAccessToken";
89+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
/**
2+
* Copyright (c) 2010-2024 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.huesync.internal.api.dto.device;
14+
15+
import org.eclipse.jdt.annotation.NonNullByDefault;
16+
import org.eclipse.jdt.annotation.Nullable;
17+
18+
/**
19+
* HDMI Sync Box Device Information
20+
*
21+
* @author Patrik Gfeller - Initial Contribution
22+
*
23+
* @see <a href=
24+
* "https://developers.meethue.com/develop/hue-entertainment/hue-hdmi-sync-box-api/#Resource%20Table">Hue
25+
* HDMI Sync Box API</a>
26+
*/
27+
@NonNullByDefault
28+
public class HueSyncDevice {
29+
/** Friendly name of the device */
30+
public @Nullable String name;
31+
/** Device Type identifier */
32+
public @Nullable String deviceType;
33+
/**
34+
* Capitalized hex string of the 6 byte / 12 characters device id without
35+
* delimiters. Used as unique id on label, certificate common name, hostname
36+
* etc.
37+
*/
38+
public @Nullable String uniqueId;
39+
/**
40+
* Increased between firmware versions when api changes. Only apiLevel >= 7 is
41+
* supported.
42+
*/
43+
public int apiLevel = 0;
44+
/**
45+
* User readable version of the device firmware, starting with decimal major
46+
* .minor .maintenance format e.g. “1.12.3”
47+
*/
48+
public @Nullable String firmwareVersion;
49+
/**
50+
* Build number of the firmware. Unique for every build with newer builds
51+
* guaranteed a higher number than older.
52+
*/
53+
public int buildNumber = 0;
54+
55+
public boolean termsAgreed;
56+
57+
/** uninitialized, disconnected, lan, wan */
58+
public @Nullable String wifiState;
59+
public @Nullable String ipAddress;
60+
61+
public @Nullable HueSyncDeviceCapabilitiesInfo capabilities;
62+
63+
public boolean beta;
64+
public boolean overheating;
65+
public boolean bluetooth;
66+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/**
2+
* Copyright (c) 2010-2024 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.huesync.internal.api.dto.device;
14+
15+
import org.eclipse.jdt.annotation.NonNullByDefault;
16+
17+
/**
18+
* HDMI Sync Box Device Information Capabilities
19+
*
20+
* @author Patrik Gfeller - Initial Contribution
21+
*
22+
* @see <a href=
23+
* "https://developers.meethue.com/develop/hue-entertainment/hue-hdmi-sync-box-api/#Resource%20Table">Hue
24+
* HDMI Sync Box API</a>
25+
*/
26+
@NonNullByDefault
27+
public class HueSyncDeviceCapabilitiesInfo {
28+
/** The total number of IR codes configurable */
29+
public int maxIrCodes;
30+
/** The total number of Presets configurable */
31+
public int maxPresets;
32+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
/**
2+
* Copyright (c) 2010-2024 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.huesync.internal.api.dto.device;
14+
15+
import java.util.Date;
16+
17+
import org.eclipse.jdt.annotation.NonNullByDefault;
18+
import org.eclipse.jdt.annotation.Nullable;
19+
20+
/**
21+
* HDMI Sync Box Device Information - Extended information (only available
22+
* to registered clients)
23+
*
24+
* @author Patrik Gfeller - Initial Contribution
25+
*
26+
* @see <a href=
27+
* "https://developers.meethue.com/develop/hue-entertainment/hue-hdmi-sync-box-api/#Resource%20Table">Hue
28+
* HDMI Sync Box API</a>
29+
*/
30+
@NonNullByDefault
31+
public class HueSyncDeviceDetailed extends HueSyncDevice {
32+
public @Nullable HueSyncDeviceDetailedWifiInfo wifi;
33+
public @Nullable HueSyncDeviceDetailedUpdateInfo update;
34+
35+
/** UTC time when last check for update was performed. */
36+
public @Nullable Date lastCheckedUpdate;
37+
/**
38+
* Build number that is available to update to. Item is set to null when there
39+
* is no update available.
40+
*/
41+
public int updatableBuildNumber;
42+
/**
43+
* User readable version of the firmware the device can upgrade to. Item is set
44+
* to null when there is no update available.
45+
*/
46+
public @Nullable String updatableFirmwareVersion;
47+
/**
48+
* 1 = regular;
49+
* 0 = off in powersave, passthrough or sync mode;
50+
* 2 = dimmed in powersave or passthrough mode and off in sync mode
51+
*/
52+
public int ledMode = -1;
53+
54+
/** none, doSoftwareRestart, doFirmwareUpdate */
55+
public @Nullable String action;
56+
public @Nullable String pushlink;
57+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
/**
2+
* Copyright (c) 2010-2024 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.huesync.internal.api.dto.device;
14+
15+
import org.eclipse.jdt.annotation.NonNullByDefault;
16+
17+
/**
18+
* HDMI Sync Box Device Information - Automatic Firmware update
19+
*
20+
* @author Patrik Gfeller - Initial Contribution
21+
*
22+
* @see <a href=
23+
* "https://developers.meethue.com/develop/hue-entertainment/hue-hdmi-sync-box-api/#Resource%20Table">Hue
24+
* HDMI Sync Box API</a>
25+
*/
26+
@NonNullByDefault
27+
public class HueSyncDeviceDetailedUpdateInfo {
28+
/**
29+
* Sync Box checks daily for a firmware update. If true, an available update
30+
* will automatically be installed. This will be postponed if Sync Box is
31+
* passing through content to the TV and being used.
32+
*/
33+
public boolean autoUpdateEnabled;
34+
/**
35+
* TC hour when the automatic update will check and execute, values 0 – 23.
36+
* Default is 10. Ideally this value should be set to 3AM according to user’s
37+
* timezone.
38+
*/
39+
public int autoUpdateTime;
40+
}

0 commit comments

Comments
 (0)