This repository has been archived by the owner on Nov 27, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add save preset action, and new white sat threshold feature.
Signed-off-by: Matthew Skinner <[email protected]>
- Loading branch information
Showing
13 changed files
with
116 additions
and
20 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
62 changes: 62 additions & 0 deletions
62
src/main/java/org/openhab/binding/wled/internal/WLedActions.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,62 @@ | ||
/** | ||
* Copyright (c) 2010-2020 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.wled.internal; | ||
|
||
import org.eclipse.jdt.annotation.NonNullByDefault; | ||
import org.eclipse.jdt.annotation.Nullable; | ||
import org.eclipse.smarthome.core.thing.binding.ThingActions; | ||
import org.eclipse.smarthome.core.thing.binding.ThingActionsScope; | ||
import org.eclipse.smarthome.core.thing.binding.ThingHandler; | ||
import org.openhab.core.automation.annotation.ActionInput; | ||
import org.openhab.core.automation.annotation.RuleAction; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
/** | ||
* The {@link WLedActions} is responsible for Actions. | ||
* | ||
* @author Matthew Skinner - Initial contribution | ||
*/ | ||
|
||
@ThingActionsScope(name = "wled") | ||
@NonNullByDefault | ||
public class WLedActions implements ThingActions { | ||
public final Logger logger = LoggerFactory.getLogger(getClass()); | ||
private @Nullable WLedHandler handler; | ||
|
||
@Override | ||
public void setThingHandler(@Nullable ThingHandler handler) { | ||
this.handler = (WLedHandler) handler; | ||
} | ||
|
||
@Override | ||
public @Nullable ThingHandler getThingHandler() { | ||
return handler; | ||
} | ||
|
||
@RuleAction(label = "Save Preset", description = "Save a WLED state to a preset location") | ||
public void savePreset( | ||
@ActionInput(name = "presetNumber", label = "Save Preset Number", description = "Enter the number of the preset you wish to save") int presetNumber) { | ||
if (presetNumber > 0 && handler != null) { | ||
handler.savePreset(presetNumber); | ||
} | ||
} | ||
|
||
public static void savePreset(@Nullable ThingActions actions, int presetNumber) { | ||
if (actions instanceof WLedActions) { | ||
((WLedActions) actions).savePreset(presetNumber); | ||
} else { | ||
throw new IllegalArgumentException("Instance is not a WLED class."); | ||
} | ||
} | ||
} |
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
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
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
Manifest-Version: 1.0 | ||
Automatic-Module-Name: org.openhab.binding.wled | ||
Bnd-LastModified: 1601294873574 | ||
Bnd-LastModified: 1601535602378 | ||
Bundle-Description: This project contains the official add-ons of open | ||
HAB | ||
Bundle-Developers: openhab;email="[email protected]";name=openHAB;organ | ||
|
@@ -20,16 +20,17 @@ Bundle-SCM: url="https://github.com/openhab/openhab-addons/org.openhab | |
tor.bundles/org.openhab.binding.wled",tag=HEAD | ||
Bundle-SymbolicName: org.openhab.binding.wled | ||
Bundle-Vendor: openHAB.org | ||
Bundle-Version: 2.5.9.202009281207 | ||
Bundle-Version: 2.5.9.202010010700 | ||
Created-By: 1.8.0_231 (Oracle Corporation) | ||
Import-Package: org.eclipse.smarthome.config.discovery,org.eclipse.sma | ||
rthome.config.discovery.mdns,org.eclipse.smarthome.core.library.types | ||
,org.eclipse.smarthome.core.thing,org.eclipse.smarthome.core.thing.bi | ||
nding,org.eclipse.smarthome.core.thing.i18n,org.eclipse.smarthome.cor | ||
e.thing.type,org.eclipse.smarthome.core.types,org.eclipse.smarthome.i | ||
o.net.http,javax.jmdns;version="[3.5,4)",org.eclipse.jetty.client;ver | ||
sion="[9.3,10)",org.eclipse.jetty.client.api;version="[9.3,10)",org.e | ||
clipse.jetty.http;version="[9.3,10)",org.slf4j;version="[1.7,2)" | ||
Import-Package: org.openhab.core.automation.annotation;resolution:=opt | ||
ional,org.eclipse.smarthome.config.discovery,org.eclipse.smarthome.co | ||
nfig.discovery.mdns,org.eclipse.smarthome.core.library.types,org.ecli | ||
pse.smarthome.core.thing,org.eclipse.smarthome.core.thing.binding,org | ||
.eclipse.smarthome.core.thing.i18n,org.eclipse.smarthome.core.thing.t | ||
ype,org.eclipse.smarthome.core.types,org.eclipse.smarthome.io.net.htt | ||
p,javax.jmdns;version="[3.5,4)",org.eclipse.jetty.client;version="[9. | ||
3,10)",org.eclipse.jetty.client.api;version="[9.3,10)",org.eclipse.je | ||
tty.http;version="[9.3,10)",org.slf4j;version="[1.7,2)" | ||
Private-Package: ESH-INF.binding,ESH-INF.thing,org.openhab.binding.wle | ||
d.internal | ||
Provide-Capability: osgi.service;objectClass:List<String>="org.eclipse | ||
|
Binary file modified
BIN
+64 Bytes
(100%)
target/classes/org/openhab/binding/wled/internal/WLedBindingConstants.class
Binary file not shown.
Binary file modified
BIN
+30 Bytes
(110%)
target/classes/org/openhab/binding/wled/internal/WLedConfiguration.class
Binary file not shown.
Binary file modified
BIN
+619 Bytes
(100%)
target/classes/org/openhab/binding/wled/internal/WLedHandler.class
Binary file not shown.