-
-
Notifications
You must be signed in to change notification settings - Fork 113
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implemented ability to skip and execute the device initialization (#409)
- Introduced thing property 'zigbee_initialised'. The property will be checked before the channels are initialized and skips the device initialization when it is 'true'. On the first initialization the property will be set to 'true' after the channel initialization. - Introduced class that provides thing config description parameters. - Introduced thing config parameter 'zigbee_initialise_device' in order to allow the user to (re-)initialize the device by updating the config. The config parameter will be checked when the config is updated and executes a device initialization. Signed-off-by: Tommaso Travaglino <[email protected]>
- Loading branch information
1 parent
54bf5bd
commit 3e64c04
Showing
5 changed files
with
280 additions
and
21 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
41 changes: 41 additions & 0 deletions
41
.../src/main/java/org/openhab/binding/zigbee/internal/ZigBeeConfigDescriptionParameters.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,41 @@ | ||
package org.openhab.binding.zigbee.internal; | ||
|
||
import java.util.ArrayList; | ||
import java.util.Collections; | ||
import java.util.List; | ||
|
||
import org.eclipse.smarthome.config.core.ConfigDescriptionParameter; | ||
import org.eclipse.smarthome.config.core.ConfigDescriptionParameterBuilder; | ||
import org.openhab.binding.zigbee.ZigBeeBindingConstants; | ||
|
||
/** | ||
* Provides {@link ConfigDescriptionParameter}s which are supposed to exist in all things | ||
*/ | ||
public class ZigBeeConfigDescriptionParameters { | ||
|
||
private static final String PARAM_ZIGBEE_INITIALIZE_DEVICE_LABEL = "Initialize device"; | ||
|
||
private static List<ConfigDescriptionParameter> configDescriptionParameters = Collections | ||
.unmodifiableList(createConfigDescriptionParameters()); | ||
|
||
/** | ||
* Provides the list of {@link ConfigDescriptionParameter} | ||
* | ||
* @return list of {@link ConfigDescriptionParameter} | ||
*/ | ||
public static List<ConfigDescriptionParameter> getParameters() { | ||
return configDescriptionParameters; | ||
} | ||
|
||
private static List<ConfigDescriptionParameter> createConfigDescriptionParameters() { | ||
List<ConfigDescriptionParameter> configDescriptionParameters = new ArrayList<>(); | ||
|
||
configDescriptionParameters.add(ConfigDescriptionParameterBuilder | ||
.create(ZigBeeBindingConstants.CONFIGURATION_INITIALIZE_DEVICE, ConfigDescriptionParameter.Type.BOOLEAN) | ||
.withLabel(PARAM_ZIGBEE_INITIALIZE_DEVICE_LABEL).withDefault(Boolean.FALSE.toString()) | ||
.withAdvanced(Boolean.TRUE).withRequired(Boolean.FALSE).build()); | ||
|
||
return configDescriptionParameters; | ||
} | ||
|
||
} |
Oops, something went wrong.