Skip to content

Commit

Permalink
[huesync] Initial contribution (#16516)
Browse files Browse the repository at this point in the history
* ☠️ Binding skeleton created for org.openhab.binding.huesync

Signed-off-by: Patrik Gfeller <[email protected]>
Signed-off-by: Patrik Gfeller <[email protected]>
  • Loading branch information
pgfeller authored Dec 3, 2024
1 parent 36bde00 commit 5a27b0e
Show file tree
Hide file tree
Showing 44 changed files with 2,937 additions and 0 deletions.
1 change: 1 addition & 0 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@
/bundles/org.openhab.binding.hpprinter/ @cossey
/bundles/org.openhab.binding.http/ @J-N-K
/bundles/org.openhab.binding.hue/ @cweitkamp @andrewfg
/bundles/org.openhab.binding.huesync/ @pgfeller
/bundles/org.openhab.binding.hydrawise/ @digitaldan
/bundles/org.openhab.binding.hyperion/ @tavalin
/bundles/org.openhab.binding.iammeter/ @lewei50
Expand Down
5 changes: 5 additions & 0 deletions bom/openhab-addons/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -796,6 +796,11 @@
<artifactId>org.openhab.binding.hue</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.openhab.addons.bundles</groupId>
<artifactId>org.openhab.binding.huesync</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.openhab.addons.bundles</groupId>
<artifactId>org.openhab.binding.hydrawise</artifactId>
Expand Down
13 changes: 13 additions & 0 deletions bundles/org.openhab.binding.huesync/NOTICE
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
This content is produced and maintained by the openHAB project.

* Project home: https://www.openhab.org

== Declared Project Licenses

This program and the accompanying materials are made available under the terms
of the Eclipse Public License 2.0 which is available at
https://www.eclipse.org/legal/epl-2.0/.

== Source Code

https://github.com/openhab/openhab-addons
220 changes: 220 additions & 0 deletions bundles/org.openhab.binding.huesync/README.md

Large diffs are not rendered by default.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 17 additions & 0 deletions bundles/org.openhab.binding.huesync/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">

<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.openhab.addons.bundles</groupId>
<artifactId>org.openhab.addons.reactor.bundles</artifactId>
<version>4.3.0-SNAPSHOT</version>
</parent>

<artifactId>org.openhab.binding.huesync</artifactId>

<name>openHAB Add-ons :: Bundles :: Hue Sync Box Binding</name>

</project>
10 changes: 10 additions & 0 deletions bundles/org.openhab.binding.huesync/src/main/feature/feature.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<features name="org.openhab.binding.huesync-${project.version}" xmlns="http://karaf.apache.org/xmlns/features/v1.4.0">
<repository>mvn:org.openhab.core.features.karaf/org.openhab.core.features.karaf.openhab-core/${ohc.version}/xml/features</repository>

<feature name="openhab-binding-huesync" description="Hue Sync Box Binding" version="${project.version}">
<feature>openhab-runtime-base</feature>
<feature>openhab-transport-mdns</feature>
<bundle start-level="80">mvn:org.openhab.addons.bundles/org.openhab.binding.huesync/${project.version}</bundle>
</feature>
</features>
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/**
* Copyright (c) 2010-2024 Contributors to the openHAB project
*
* See the NOTICE file(s) distributed with this work for additional
* information.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*/
package org.openhab.binding.huesync.internal;

import org.eclipse.jdt.annotation.NonNullByDefault;

/**
*
* @author Patrik Gfeller - Initial contribution
*/
@NonNullByDefault
public class HdmiChannels {
public String name;
public String type;
public String mode;
public String status;

public HdmiChannels(String name, String type, String mode, String status) {
this.name = name;
this.type = type;
this.mode = mode;
this.status = status;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
/**
* Copyright (c) 2010-2024 Contributors to the openHAB project
*
* See the NOTICE file(s) distributed with this work for additional
* information.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*/
package org.openhab.binding.huesync.internal;

import org.eclipse.jdt.annotation.NonNullByDefault;
import org.openhab.core.thing.ThingTypeUID;

/**
* The {@link HueSyncConstants} class defines common constants, which are
* used across the whole binding.
*
* @author Patrik Gfeller - Initial contribution
*/
@NonNullByDefault
public class HueSyncConstants {
public static class ENDPOINTS {
public static final String DEVICE = "device";
public static final String REGISTRATIONS = "registrations";
public static final String HDMI = "hdmi";
public static final String EXECUTION = "execution";

public static class COMMANDS {
public static final String MODE = "mode";
public static final String SYNC = "syncActive";
public static final String HDMI = "hdmiActive";
public static final String SOURCE = "hdmiSource";
public static final String BRIGHTNESS = "brightness";
}
}

public static class CHANNELS {
public static class DEVICE {
public static class INFORMATION {
public static final String FIRMWARE = "device-firmware#firmware";
public static final String FIRMWARE_AVAILABLE = "device-firmware#available-firmware";
}
}

public static class COMMANDS {
public static final String MODE = "device-commands#mode";
public static final String SYNC = "device-commands#sync-active";
public static final String HDMI = "device-commands#hdmi-active";
public static final String SOURCE = "device-commands#hdmi-source";
public static final String BRIGHTNESS = "device-commands#brightness";
}

public static class HDMI {
public static final HdmiChannels IN_1 = new HdmiChannels("device-hdmi-in-1#name", "device-hdmi-in-1#type",
"device-hdmi-in-1#mode", "device-hdmi-in-1#status");
public static final HdmiChannels IN_2 = new HdmiChannels("device-hdmi-in-2#name", "device-hdmi-in-2#type",
"device-hdmi-in-2#mode", "device-hdmi-in-2#status");
public static final HdmiChannels IN_3 = new HdmiChannels("device-hdmi-in-3#name", "device-hdmi-in-3#type",
"device-hdmi-in-3#mode", "device-hdmi-in-3#status");
public static final HdmiChannels IN_4 = new HdmiChannels("device-hdmi-in-4#name", "device-hdmi-in-4#type",
"device-hdmi-in-4#mode", "device-hdmi-in-4#status");

public static final HdmiChannels OUT = new HdmiChannels("device-hdmi-out#name", "device-hdmi-out#type",
"device-hdmi-out#mode", "device-hdmi-out#status");
}
}

public static final String APPLICATION_NAME = "openHAB";

/** Minimal API Version required. Only apiLevel >= 7 is supported. */
public static final Integer MINIMAL_API_VERSION = 7;

public static final String BINDING_ID = "huesync";
public static final String THING_TYPE_ID = "box";
public static final ThingTypeUID THING_TYPE_UID = new ThingTypeUID(BINDING_ID, THING_TYPE_ID);

public static final String PARAMETER_HOST = "host";
public static final String PARAMETER_PORT = "port";

public static final Integer REGISTRATION_INITIAL_DELAY = 3;
public static final Integer REGISTRATION_INTERVAL = 1;

public static final String REGISTRATION_ID = "registrationId";
public static final String API_TOKEN = "apiAccessToken";
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
/**
* Copyright (c) 2010-2024 Contributors to the openHAB project
*
* See the NOTICE file(s) distributed with this work for additional
* information.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*/
package org.openhab.binding.huesync.internal.api.dto.device;

import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;

/**
* HDMI Sync Box Device Information
*
* @author Patrik Gfeller - Initial Contribution
*
* @see <a href=
* "https://developers.meethue.com/develop/hue-entertainment/hue-hdmi-sync-box-api/#Resource%20Table">Hue
* HDMI Sync Box API</a>
*/
@NonNullByDefault
public class HueSyncDevice {
/** Friendly name of the device */
public @Nullable String name;
/** Device Type identifier */
public @Nullable String deviceType;
/**
* Capitalized hex string of the 6 byte / 12 characters device id without
* delimiters. Used as unique id on label, certificate common name, hostname
* etc.
*/
public @Nullable String uniqueId;
/**
* Increased between firmware versions when api changes. Only apiLevel >= 7 is
* supported.
*/
public int apiLevel = 0;
/**
* User readable version of the device firmware, starting with decimal major
* .minor .maintenance format e.g. “1.12.3”
*/
public @Nullable String firmwareVersion;
/**
* Build number of the firmware. Unique for every build with newer builds
* guaranteed a higher number than older.
*/
public int buildNumber = 0;

public boolean termsAgreed;

/** uninitialized, disconnected, lan, wan */
public @Nullable String wifiState;
public @Nullable String ipAddress;

public @Nullable HueSyncDeviceCapabilitiesInfo capabilities;

public boolean beta;
public boolean overheating;
public boolean bluetooth;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/**
* Copyright (c) 2010-2024 Contributors to the openHAB project
*
* See the NOTICE file(s) distributed with this work for additional
* information.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*/
package org.openhab.binding.huesync.internal.api.dto.device;

import org.eclipse.jdt.annotation.NonNullByDefault;

/**
* HDMI Sync Box Device Information Capabilities
*
* @author Patrik Gfeller - Initial Contribution
*
* @see <a href=
* "https://developers.meethue.com/develop/hue-entertainment/hue-hdmi-sync-box-api/#Resource%20Table">Hue
* HDMI Sync Box API</a>
*/
@NonNullByDefault
public class HueSyncDeviceCapabilitiesInfo {
/** The total number of IR codes configurable */
public int maxIrCodes;
/** The total number of Presets configurable */
public int maxPresets;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/**
* Copyright (c) 2010-2024 Contributors to the openHAB project
*
* See the NOTICE file(s) distributed with this work for additional
* information.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*/
package org.openhab.binding.huesync.internal.api.dto.device;

import java.util.Date;

import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;

/**
* HDMI Sync Box Device Information - Extended information (only available
* to registered clients)
*
* @author Patrik Gfeller - Initial Contribution
*
* @see <a href=
* "https://developers.meethue.com/develop/hue-entertainment/hue-hdmi-sync-box-api/#Resource%20Table">Hue
* HDMI Sync Box API</a>
*/
@NonNullByDefault
public class HueSyncDeviceDetailed extends HueSyncDevice {
public @Nullable HueSyncDeviceDetailedWifiInfo wifi;
public @Nullable HueSyncDeviceDetailedUpdateInfo update;

/** UTC time when last check for update was performed. */
public @Nullable Date lastCheckedUpdate;
/**
* Build number that is available to update to. Item is set to null when there
* is no update available.
*/
public int updatableBuildNumber;
/**
* User readable version of the firmware the device can upgrade to. Item is set
* to null when there is no update available.
*/
public @Nullable String updatableFirmwareVersion;
/**
* 1 = regular;
* 0 = off in powersave, passthrough or sync mode;
* 2 = dimmed in powersave or passthrough mode and off in sync mode
*/
public int ledMode = -1;

/** none, doSoftwareRestart, doFirmwareUpdate */
public @Nullable String action;
public @Nullable String pushlink;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/**
* Copyright (c) 2010-2024 Contributors to the openHAB project
*
* See the NOTICE file(s) distributed with this work for additional
* information.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*/
package org.openhab.binding.huesync.internal.api.dto.device;

import org.eclipse.jdt.annotation.NonNullByDefault;

/**
* HDMI Sync Box Device Information - Automatic Firmware update
*
* @author Patrik Gfeller - Initial Contribution
*
* @see <a href=
* "https://developers.meethue.com/develop/hue-entertainment/hue-hdmi-sync-box-api/#Resource%20Table">Hue
* HDMI Sync Box API</a>
*/
@NonNullByDefault
public class HueSyncDeviceDetailedUpdateInfo {
/**
* Sync Box checks daily for a firmware update. If true, an available update
* will automatically be installed. This will be postponed if Sync Box is
* passing through content to the TV and being used.
*/
public boolean autoUpdateEnabled;
/**
* TC hour when the automatic update will check and execute, values 0 – 23.
* Default is 10. Ideally this value should be set to 3AM according to user’s
* timezone.
*/
public int autoUpdateTime;
}
Loading

0 comments on commit 5a27b0e

Please sign in to comment.