-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[hue] Add new API support infrastructure #19309
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
Merged
Merged
Changes from 3 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
406a582
hue add new API infrastructure
andrewfg 3fd7c71
fix alerts unit test failure
andrewfg ba6a720
exclude not yet available json from tests
andrewfg 502de15
Merge branch 'openhab:main' into hue-new-apis
andrewfg ac8aac4
Update bundles/org.openhab.binding.hue/src/main/java/org/openhab/bind…
andrewfg cacd08d
Update bundles/org.openhab.binding.hue/src/main/java/org/openhab/bind…
andrewfg 469835d
spotless
andrewfg File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
36 changes: 36 additions & 0 deletions
36
...penhab.binding.hue/src/main/java/org/openhab/binding/hue/internal/api/dto/clip2/Mute.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| /* | ||
| * Copyright (c) 2010-2025 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.hue.internal.api.dto.clip2; | ||
|
|
||
| import org.eclipse.jdt.annotation.NonNullByDefault; | ||
| import org.eclipse.jdt.annotation.Nullable; | ||
| import org.openhab.binding.hue.internal.api.dto.clip2.enums.MuteType; | ||
|
|
||
| /** | ||
| * DTO for mute state of a sound. | ||
| * | ||
| * @author Andrew Fiddian-Green - Initial contribution | ||
| */ | ||
| @NonNullByDefault | ||
| public class Mute { | ||
| private @Nullable MuteType mute; | ||
|
|
||
| public @Nullable MuteType getMute() { | ||
| return this.mute; | ||
| } | ||
|
|
||
| public Mute setMute(MuteType muteType) { | ||
| this.mute = muteType; | ||
| return this; | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
...enhab.binding.hue/src/main/java/org/openhab/binding/hue/internal/api/dto/clip2/Sound.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| /* | ||
| * Copyright (c) 2010-2025 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.hue.internal.api.dto.clip2; | ||
|
|
||
| import java.util.List; | ||
| import java.util.Objects; | ||
| import java.util.stream.Collectors; | ||
|
|
||
| import org.eclipse.jdt.annotation.NonNullByDefault; | ||
| import org.eclipse.jdt.annotation.Nullable; | ||
| import org.openhab.binding.hue.internal.api.dto.clip2.enums.SoundType; | ||
|
|
||
| import com.google.gson.annotations.SerializedName; | ||
|
|
||
| /** | ||
| * DTO for a chime. | ||
| * | ||
| * @author Andrew Fiddian-Green - Initial contribution | ||
| */ | ||
| @NonNullByDefault | ||
| public class Sound { | ||
| private @Nullable @SerializedName("sound_values") List<String> soundValues; | ||
| private @Nullable SoundStatus status; | ||
|
|
||
| public @Nullable SoundStatus getStatus() { | ||
| return this.status; | ||
| } | ||
|
|
||
| public List<SoundType> getSoundValues() { | ||
| List<String> soundValues = this.soundValues; | ||
| if (Objects.nonNull(soundValues)) { | ||
| return soundValues.stream().map(SoundType::of).collect(Collectors.toList()); | ||
| } | ||
| return List.of(); | ||
| } | ||
|
|
||
| public Sound setStatus(SoundStatus soundStatus) { | ||
| this.status = soundStatus; | ||
| return this; | ||
| } | ||
| } | ||
52 changes: 52 additions & 0 deletions
52
...binding.hue/src/main/java/org/openhab/binding/hue/internal/api/dto/clip2/SoundStatus.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| /* | ||
| * Copyright (c) 2010-2025 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.hue.internal.api.dto.clip2; | ||
|
|
||
| import java.util.List; | ||
| import java.util.Objects; | ||
| import java.util.stream.Collectors; | ||
|
|
||
| import org.eclipse.jdt.annotation.NonNullByDefault; | ||
| import org.eclipse.jdt.annotation.Nullable; | ||
| import org.openhab.binding.hue.internal.api.dto.clip2.enums.SoundType; | ||
|
|
||
| import com.google.gson.annotations.SerializedName; | ||
|
|
||
| /** | ||
| * DTO for 'sound status' of a chime. | ||
| * | ||
| * @author Andrew Fiddian-Green - Initial contribution | ||
| */ | ||
| @NonNullByDefault | ||
| public class SoundStatus { | ||
| private @Nullable String sound; | ||
| private @Nullable @SerializedName("sound_values") List<String> soundValues; | ||
|
|
||
| public @Nullable SoundType getSound() { | ||
| String sound = this.sound; | ||
| return Objects.nonNull(sound) ? SoundType.of(sound) : null; | ||
| } | ||
|
|
||
| public List<SoundType> getSoundValues() { | ||
| List<String> soundValues = this.soundValues; | ||
| if (Objects.nonNull(soundValues)) { | ||
| return soundValues.stream().map(SoundType::of).collect(Collectors.toList()); | ||
andrewfg marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| } | ||
| return List.of(); | ||
| } | ||
|
|
||
| public SoundStatus setSound(SoundType soundType) { | ||
| this.sound = soundType.name().toLowerCase(); | ||
| return this; | ||
| } | ||
| } | ||
38 changes: 38 additions & 0 deletions
38
...ding.hue/src/main/java/org/openhab/binding/hue/internal/api/dto/clip2/enums/MuteType.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| /* | ||
| * Copyright (c) 2010-2025 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.hue.internal.api.dto.clip2.enums; | ||
|
|
||
| import org.eclipse.jdt.annotation.NonNullByDefault; | ||
| import org.eclipse.jdt.annotation.Nullable; | ||
|
|
||
| /** | ||
| * Enum for sound mute state. | ||
| * | ||
| * @author Andrew Fiddian-Green - Initial contribution | ||
| */ | ||
| @NonNullByDefault | ||
| public enum MuteType { | ||
| MUTE, | ||
| UNMUTE; | ||
|
|
||
| public static MuteType of(@Nullable String value) { | ||
| if (value != null) { | ||
| try { | ||
| return valueOf(value.toUpperCase()); | ||
| } catch (IllegalArgumentException e) { | ||
| // fall through | ||
| } | ||
| } | ||
| return UNMUTE; | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.