Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[huesync][WIP] Hue Play HDMI Sync Box Binding - Initial contribution #16516

Open
wants to merge 47 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
9e7fa3a
☠️ Binding skeleton created for org.openhab.binding.huesync
pgfeller Feb 8, 2024
bc72f9a
🔃 Version Sync - we'll use 4.1.x for development ...
pgfeller Feb 9, 2024
377df2f
💳 updated credits in headers (initial code by Marco Kawon)
pgfeller Feb 9, 2024
360f167
✏️ class & filenames updated to be consistent with other bindings
pgfeller Feb 9, 2024
676fe38
🔎 skeleton mDNS discovery implemented
pgfeller Feb 9, 2024
452df77
🔎 mDNS device discovery - use API to get device information (wip 🔨)
pgfeller Feb 10, 2024
0b18704
🔐 preparation(s) to support SSL (wip), create ThingUID for discovered…
pgfeller Feb 13, 2024
f72a383
🏭 Inbox/Thing Factory (wip)
pgfeller Feb 14, 2024
edbf604
🔎 device discovery improvements (wip)
pgfeller Feb 16, 2024
0c59b98
💬 Basic JSON de-serialization added to Thing-Handler to get device in…
pgfeller Feb 17, 2024
f52e9b7
🔐 SSL Handshake & 🔎 Discovery working - 👍
pgfeller Feb 24, 2024
3178f26
🔓 Registration (acquire API token) - wip 🔧
pgfeller Feb 25, 2024
eab70d1
🔧 Prototype to use resource strings for loggger, exceptions & UI ...
pgfeller Feb 29, 2024
f7a9a76
🔓 Registration (acquire API token) - wip 🔧
pgfeller Mar 2, 2024
a2a03ec
🔓 Registration (acquire API token)
pgfeller Mar 7, 2024
416137b
⏫ pom version change to 4.2
pgfeller Mar 12, 2024
ba801a2
📜 linter fix ...
pgfeller Mar 12, 2024
a42500f
📜 linter fix
pgfeller Mar 13, 2024
e51e230
📜 ... temporary refactoring/removal of log message consistency mechan…
pgfeller Mar 16, 2024
7c7bd48
📦 Device information DTO
pgfeller Mar 17, 2024
397dacb
Merge branch 'openhab:main' into 10218-hue-add-hue-sync-box
pgfeller Mar 18, 2024
5b5f6e6
👤 Added myself as owner of the huesync binding
pgfeller Mar 21, 2024
d3f4f64
🔧 refactoring to simplify API connection
pgfeller Mar 22, 2024
c6ce2dc
feat(unregistration): 👋 Device unregistration
pgfeller Mar 23, 2024
51fe84e
fix(linter): 🔎 Format should be constant. Use placeholder to reduce t…
pgfeller Mar 23, 2024
fdf069e
fix(linter): 🔎 Format should be constant. Use placeholder to reduce t…
pgfeller Mar 23, 2024
cd5b2b9
refactor: 📜 code moved and group areas added to improve overview
pgfeller Mar 29, 2024
31923c7
refactor: 📜 refactoring to simplify maintentance and pending implemen…
pgfeller Mar 31, 2024
8fae6c1
fix(linter): 🔎 linter performance check fixed
pgfeller Mar 31, 2024
9b01c45
feat(infrastructure): 🔌 check online/offline state (poll) - wip ...
pgfeller Apr 6, 2024
84f3704
refactor(code review): 🔎 improved null handling based on code review
pgfeller Apr 12, 2024
b51b136
refactor(code review): 🔎 improved null handling based on code review
pgfeller Apr 12, 2024
4a12cf1
refactor(code review): 🔎 improved null handling based on code review
pgfeller Apr 12, 2024
5e97fc4
refactor(code review): 🔎 improved null handling based on code review
pgfeller Apr 12, 2024
d992334
refactor(code review): 🔎 code split (single response) and better enca…
pgfeller Apr 15, 2024
3bdbdc7
refactor(code review): 🔎 improved null handling based on code review …
pgfeller Apr 15, 2024
2196f10
refactor(code review): 🔎 improved null handling based on code review
pgfeller Apr 18, 2024
7cce127
refactor(connection): 📜 Simplified authentication mechanism
pgfeller Apr 26, 2024
153d91f
refactor(communication): 📜 improved error handling and manual configu…
pgfeller Apr 30, 2024
a4e7e94
feat(channel): 🔧 firmware channel group added
pgfeller May 3, 2024
0549ac6
fix(channel): 🔃 keep properties and firmware channel information in sync
pgfeller May 7, 2024
ca9af19
feat(dto): 📺 HDMI Status DTO & Get API implemented
pgfeller May 8, 2024
9a33031
feat(channel): Some HDMI input and ouput channels added (read only) -…
pgfeller May 14, 2024
52fa73e
feat(channel): Additional channel `connection-status`added
pgfeller May 18, 2024
5481bfc
feat(channel): ➕ Additional channel `connection-lastSyncMode` added
pgfeller May 19, 2024
41208a7
Merge branch 'openhab:main' into 10218-hue-add-hue-sync-box
pgfeller May 25, 2024
1c948dd
refactor(dto class renamed): 📜 Dto classes renamed to include the nat…
pgfeller May 25, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@
/bundles/org.openhab.binding.hpprinter/ @cossey
/bundles/org.openhab.binding.http/ @openhab/add-ons-maintainers
/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 @@ -756,6 +756,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
1 change: 1 addition & 0 deletions bundles/org.openhab.binding.huesync/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
scripts
15 changes: 15 additions & 0 deletions bundles/org.openhab.binding.huesync/AUTHORS
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# This is the list of huesync's significant contributors.
#
# This does not necessarily list everyone who has contributed code,
# To see the full list of contributors, see the revision history in
# source control.

@pgfeller - Patrik Gfeller <patrik.gfeller@proton.me>

# The binding used work from the following developvers as reference
# and base for the implementation:
@HHomey-GER - Marco Kawon (https://github.com/Homey-GER/openhab-addons)

@andrewfg - Andrew Fiddian-Green (hue binding)
@cweitkamp - Christoph Weitkamp (hue binding)

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
217 changes: 217 additions & 0 deletions bundles/org.openhab.binding.huesync/README.md

Large diffs are not rendered by default.

Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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.2.0-SNAPSHOT</version>
</parent>

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

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

</project>
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 HDMI 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,96 @@
/**
* 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 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 HDMI {
public static class IN_1 {
public static final String NAME = "device-hdmi-in-1#name";
public static final String TYPE = "device-hdmi-in-1#type";
public static final String STATUS = "device-hdmi-in-1#status";
public static final String MODE = "device-hdmi-in-1#mode";
}

public static class IN_2 {
public static final String NAME = "device-hdmi-in-2#name";
public static final String TYPE = "device-hdmi-in-2#type";
public static final String STATUS = "device-hdmi-in-2#status";
public static final String MODE = "device-hdmi-in-2#mode";
}

public static class IN_3 {
public static final String NAME = "device-hdmi-in-3#name";
public static final String TYPE = "device-hdmi-in-3#type";
public static final String STATUS = "device-hdmi-in-3#status";
public static final String MODE = "device-hdmi-in-3#mode";
}

public static class IN_4 {
public static final String NAME = "device-hdmi-in-4#name";
public static final String TYPE = "device-hdmi-in-4#type";
public static final String STATUS = "device-hdmi-in-4#status";
public static final String MODE = "device-hdmi-in-4#mode";
}

public static class OUT {
public static final String NAME = "device-hdmi-out#name";
public static final String TYPE = "device-hdmi-out#type";
public static final String STATUS = "device-hdmi-out#status";
public static final String MODE = "device-hdmi-out#mode";
}
}
}

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 = "huesyncthing";
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 DTO
*
* @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 HueSyncDeviceDto {
/** 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 HueSyncDeviceDtoCapabilitiesInfo 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 DTO
*
* @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 HueSyncDeviceDtoCapabilitiesInfo {
/** 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 DTO - 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 HueSyncDeviceDtoDetailed extends HueSyncDeviceDto {
public @Nullable HueSyncDeviceDtoDetailedWifiInfo wifi;
public @Nullable HueSyncDeviceDtoDetailedUpdateInfo 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 DTO - 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 HueSyncDeviceDtoDetailedUpdateInfo {
/**
* 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;
}