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] Hue Play HDMI Sync Box Binding - Initial contribution #16516

Open
wants to merge 85 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
85 commits
Select commit Hold shift + click to select a range
418eb57
☠️ Binding skeleton created for org.openhab.binding.huesync
pgfeller Feb 8, 2024
1fbd2b6
🔃 Version Sync - we'll use 4.1.x for development ...
pgfeller Feb 9, 2024
053f7eb
💳 updated credits in headers (initial code by Marco Kawon)
pgfeller Feb 9, 2024
656008d
✏️ class & filenames updated to be consistent with other bindings
pgfeller Feb 9, 2024
d5d9b62
🔎 skeleton mDNS discovery implemented
pgfeller Feb 9, 2024
cc6d39a
🔎 mDNS device discovery - use API to get device information (wip 🔨)
pgfeller Feb 10, 2024
a16c04c
🔐 preparation(s) to support SSL (wip), create ThingUID for discovered…
pgfeller Feb 13, 2024
beadc45
🏭 Inbox/Thing Factory (wip)
pgfeller Feb 14, 2024
c72c5e3
🔎 device discovery improvements (wip)
pgfeller Feb 16, 2024
7b4fffc
💬 Basic JSON de-serialization added to Thing-Handler to get device in…
pgfeller Feb 17, 2024
294deb3
🔐 SSL Handshake & 🔎 Discovery working - 👍
pgfeller Feb 24, 2024
eb06000
🔓 Registration (acquire API token) - wip 🔧
pgfeller Feb 25, 2024
4b66cda
🔧 Prototype to use resource strings for loggger, exceptions & UI ...
pgfeller Feb 29, 2024
2d3cfc9
🔓 Registration (acquire API token) - wip 🔧
pgfeller Mar 2, 2024
871e286
🔓 Registration (acquire API token)
pgfeller Mar 7, 2024
267fc75
⏫ pom version change to 4.2
pgfeller Mar 12, 2024
f18346f
📜 linter fix ...
pgfeller Mar 12, 2024
142f8f9
📜 linter fix
pgfeller Mar 13, 2024
57b8ca7
📜 ... temporary refactoring/removal of log message consistency mechan…
pgfeller Mar 16, 2024
2d981b5
📦 Device information DTO
pgfeller Mar 17, 2024
9f64cc9
👤 Added myself as owner of the huesync binding
pgfeller Mar 21, 2024
9b66703
🔧 refactoring to simplify API connection
pgfeller Mar 22, 2024
6e840ac
feat(unregistration): 👋 Device unregistration
pgfeller Mar 23, 2024
de14fc1
fix(linter): 🔎 Format should be constant. Use placeholder to reduce t…
pgfeller Mar 23, 2024
70bb80b
fix(linter): 🔎 Format should be constant. Use placeholder to reduce t…
pgfeller Mar 23, 2024
36b8d0c
refactor: 📜 code moved and group areas added to improve overview
pgfeller Mar 29, 2024
6f9b46a
refactor: 📜 refactoring to simplify maintentance and pending implemen…
pgfeller Mar 31, 2024
428b3e3
fix(linter): 🔎 linter performance check fixed
pgfeller Mar 31, 2024
7f3a4e5
feat(infrastructure): 🔌 check online/offline state (poll) - wip ...
pgfeller Apr 6, 2024
a76e439
refactor(code review): 🔎 improved null handling based on code review
pgfeller Apr 12, 2024
072bee7
refactor(code review): 🔎 improved null handling based on code review
pgfeller Apr 12, 2024
cb0c86c
refactor(code review): 🔎 improved null handling based on code review
pgfeller Apr 12, 2024
4dd836e
refactor(code review): 🔎 improved null handling based on code review
pgfeller Apr 12, 2024
4e1a812
refactor(code review): 🔎 code split (single response) and better enca…
pgfeller Apr 15, 2024
5e60e97
refactor(code review): 🔎 improved null handling based on code review …
pgfeller Apr 15, 2024
048ce86
refactor(code review): 🔎 improved null handling based on code review
pgfeller Apr 18, 2024
0ce8d19
refactor(connection): 📜 Simplified authentication mechanism
pgfeller Apr 26, 2024
dbd0bcc
refactor(communication): 📜 improved error handling and manual configu…
pgfeller Apr 30, 2024
024b8f6
feat(channel): 🔧 firmware channel group added
pgfeller May 3, 2024
3399194
fix(channel): 🔃 keep properties and firmware channel information in sync
pgfeller May 7, 2024
4c72662
feat(dto): 📺 HDMI Status DTO & Get API implemented
pgfeller May 8, 2024
f7a6d91
feat(channel): Some HDMI input and ouput channels added (read only) -…
pgfeller May 14, 2024
520713d
feat(channel): Additional channel `connection-status`added
pgfeller May 18, 2024
a95d401
feat(channel): ➕ Additional channel `connection-lastSyncMode` added
pgfeller May 19, 2024
7ec2c02
refactor(dto class renamed): 📜 Dto classes renamed to include the nat…
pgfeller May 25, 2024
adf46e7
feat(channel): ➕ "execution" API channel group implementation started…
pgfeller May 30, 2024
87eae1f
chore(documentation): 📜 new "remote control" group added to readme
pgfeller May 30, 2024
0cf1991
feat(channel): ➕ Infrastructure to handle command execution (🔧 wip)
pgfeller May 31, 2024
73b3ea6
chore(documentation): 📜 readme updated: bug fixes & "mode" channel added
pgfeller May 31, 2024
5adecd6
chore(documentation): 📜 readme - item configuration header level changed
pgfeller May 31, 2024
0744fcd
fix(channel): 🐞Command executors are not global, but are defined per …
pgfeller Jun 1, 2024
77e1c10
feat(channel): ➕ write support for "mode" channel added
pgfeller Jun 2, 2024
4c18512
chore(documentation): 📜 readme - "mode" chanel is now R/W
pgfeller Jun 2, 2024
1088264
chore(documentation): 🐞 bugfix in readme ...
pgfeller Jun 2, 2024
78a9c79
fix(connection): 🐞 bugfix to improve handling of invalid API token
pgfeller Jun 11, 2024
e6e72d0
fix(communication): 🐞 bugfix: de-serialization is more tolerant if we…
pgfeller Jun 16, 2024
8274825
feat(channel): ➕ "syncActive" ON/OFF switch added to thing
pgfeller Jun 19, 2024
a885cc8
build(vscode): 🔧 configuration files added for IDE ... [wip]
pgfeller Jul 6, 2024
91daa6a
feat(channel): ➕ channel to select HDMI source added
pgfeller Jul 7, 2024
c760b56
Update bundles/org.openhab.binding.huesync/pom.xml
pgfeller Jul 9, 2024
b22683f
style(format): code format fixes (whitespace)
pgfeller Jul 14, 2024
65915aa
fix(localization): 🐛Suppress "Null type mismatch" linter error - the …
pgfeller Jul 14, 2024
a46fecb
style(format): code format fixes (whitespace)
pgfeller Jul 14, 2024
be1087f
refactor(i18n): Different handling of resource key resolution (linter…
pgfeller Jul 16, 2024
df5b459
refactor(i18n): Different handling of resource key resolution (linter…
pgfeller Jul 17, 2024
1116696
build(vscode): ⚙️ Small improvements in the utility build script(s)
pgfeller Jul 31, 2024
353956c
docs(channel): 📜 Use of "Material Design Icons" to visualize category.
pgfeller Aug 12, 2024
61e88ec
feat(channel): ➕ Add support to adjust brightness
pgfeller Aug 16, 2024
e69fd3f
fix(channel): 🐛 default execution handler fixed
pgfeller Aug 26, 2024
a201ee5
docs(readme): 🧹 Prepare for 1st official code review round of the PR
pgfeller Sep 11, 2024
27a3e97
fix(channel): 🐛 PUT command payload problem solved for `StringType` c…
pgfeller Sep 13, 2024
90476fb
chore(project): 🔎 Resolve code review findings
pgfeller Sep 29, 2024
b815915
chore(project): 🔎 Resolve code review findings
pgfeller Sep 29, 2024
f0b72ac
chore(project): 🔎 Resolve code review findings
pgfeller Sep 29, 2024
4cf94bd
Update bundles/org.openhab.binding.huesync/src/main/feature/feature.xml
pgfeller Sep 29, 2024
ea8c492
Update bundles/org.openhab.binding.huesync/src/main/resources/OH-INF/…
pgfeller Sep 29, 2024
1b7dcf1
Update bundles/org.openhab.binding.huesync/src/main/resources/OH-INF/…
pgfeller Sep 29, 2024
2866bd3
chore(project): 🔎 Resolve code review findings
pgfeller Oct 5, 2024
d9f1a97
Update bundles/org.openhab.binding.huesync/src/main/feature/feature.xml
pgfeller Oct 5, 2024
45babc6
chore(project): 🔎 Resolve code review findings
pgfeller Oct 5, 2024
b64be6e
chore(project): 🔎 Resolve code review findings
pgfeller Oct 5, 2024
19b4efc
chore(project): 🔎 Resolve code review findings
pgfeller Oct 11, 2024
9301a43
chore(project): 🔎 Resolve code review findings
pgfeller Oct 11, 2024
8bc8285
chore(project): 🔎 Resolve code review findings
pgfeller Oct 16, 2024
3917018
chore(project): 🔎 Resolve code review findings
pgfeller Oct 17, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ xtend-gen/
**/.settings/org.eclipse.*

bundles/**/src/main/history
bundles/**/.vscode
features/**/src/main/history
features/**/src/main/feature

Expand Down
1 change: 1 addition & 0 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,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 @@ -781,6 +781,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
320 changes: 320 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.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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>
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,112 @@
/**
* 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 EXECUTION_ENDPOINTS {
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 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 = "huesyncbox";
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