forked from openhab/openhab-addons
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
HueEmulation IO binding: Support Coloured bulbs (openhab#4216)
* HueEmulation IO binding: Support Coloured bulbs * Use OSGI annotations * Use config holder class * Move code into own subclasses instead of having a giant HueEmulationServlet.class * Introduce UDN class * Introduce user management class * Introduce light items management class * Watch the item registry for changes and keep a cache of published items, instead of quering all items from the item registry for each API call. * Implement /config endpoint. Necessary for Hue App etc. * Implement /whitelist entpoint including user delete. * Implement dummy entpoints for nowadays Hue bridges (/group, /scenes etc). * Fix: Return unauthorized /config * Fix: error/success response * Fix: Only allow POST http method for adding a user * Start service late in the process via the ReadyMarkerService * Automatically turn off the pairing mode after a time * Support "extended color light bulbs" with a hue range 0-65535 * Support wall plugs Signed-off-by: David Graeff <david.graeff@web.de> Signed-off-by: Maximilian Hess <mail@ne0h.de>
- Loading branch information
Showing
30 changed files
with
2,056 additions
and
797 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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 @@ | ||
*.xml |
24 changes: 0 additions & 24 deletions
24
addons/io/org.openhab.io.hueemulation/OSGI-INF/hueemulation.xml
This file was deleted.
Oops, something went wrong.
This file contains 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
21 changes: 21 additions & 0 deletions
21
...penhab.io.hueemulation/src/main/java/org/openhab/io/hueemulation/internal/DeviceType.java
This file contains 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,21 @@ | ||
/** | ||
* Copyright (c) 2010-2018 by the respective copyright holders. | ||
* | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v1.0 | ||
* which accompanies this distribution, and is available at | ||
* http://www.eclipse.org/legal/epl-v10.html | ||
*/ | ||
package org.openhab.io.hueemulation.internal; | ||
|
||
/** | ||
* Device type | ||
* | ||
* @author David Graeff - Initial contribution | ||
*/ | ||
public enum DeviceType { | ||
SwitchType, | ||
WhiteType, | ||
WhiteTemperatureType, | ||
ColorType | ||
} |
56 changes: 56 additions & 0 deletions
56
...o.hueemulation/src/main/java/org/openhab/io/hueemulation/internal/HueEmulationConfig.java
This file contains 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,56 @@ | ||
/** | ||
* Copyright (c) 2010-2018 by the respective copyright holders. | ||
* | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v1.0 | ||
* which accompanies this distribution, and is available at | ||
* http://www.eclipse.org/legal/epl-v10.html | ||
*/ | ||
package org.openhab.io.hueemulation.internal; | ||
|
||
import java.util.Set; | ||
import java.util.stream.Collectors; | ||
import java.util.stream.Stream; | ||
|
||
import org.eclipse.jdt.annotation.NonNullByDefault; | ||
import org.eclipse.jdt.annotation.Nullable; | ||
|
||
/** | ||
* The configuration for {@link HueEmulationServlet}. | ||
* | ||
* @author David Graeff - Initial Contribution | ||
*/ | ||
@NonNullByDefault | ||
public class HueEmulationConfig { | ||
public boolean pairingEnabled = false; | ||
public static final String CONFIG_PAIRING_ENABLED = "pairingEnabled"; | ||
/** | ||
* The Amazon echos have no means to recreate a new api key and they don't care about the 403-forbidden http status | ||
* code. If the addon has pruned its api-key list, echos will not be able to discover new devices. Set this option | ||
* to just create a new user on the fly. | ||
*/ | ||
public boolean createNewUserOnEveryEndpoint = true; | ||
public static final String CONFIG_CREATE_NEW_USER_ON_THE_FLY = "createNewUserOnEveryEndpoint"; | ||
/** Pairing timeout in seconds */ | ||
public int pairingTimeout = 60; | ||
public @Nullable String discoveryIp; | ||
public int discoveryHttpPort = 0; | ||
/** Comma separated list of tags */ | ||
public String restrictToTagsSwitches = "Switchable"; | ||
/** Comma separated list of tags */ | ||
public String restrictToTagsColorLights = "ColorLighting"; | ||
/** Comma separated list of tags */ | ||
public String restrictToTagsWhiteLights = "Lighting"; | ||
|
||
public Set<String> switchTags() { | ||
return Stream.of(restrictToTagsSwitches.split(",")).collect(Collectors.toSet()); | ||
} | ||
|
||
public Set<String> colorTags() { | ||
return Stream.of(restrictToTagsColorLights.split(",")).collect(Collectors.toSet()); | ||
} | ||
|
||
public Set<String> whiteTags() { | ||
return Stream.of(restrictToTagsWhiteLights.split(",")).collect(Collectors.toSet()); | ||
} | ||
} |
Oops, something went wrong.