forked from openhab/openhab1-addons
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into zwave-database-190616
* master: Zwave database 180616 (openhab#4483) Zwave database 180616 (openhab#4479) Add Aeon ZW112 - Door/Window Sensor 6 (openhab#4472) Include Aeon ZW112 - Door/Window Sensor 6 (openhab#4471) Z-Wave: Added support for CENTRAL_SCENE (openhab#4431) ZWave database update (openhab#4476) ZWave addition of clock command class (openhab#4468) Signed-off-by: Chris Jackson <chris@cd-jackson.com> # Conflicts: # bundles/binding/org.openhab.binding.zwave/database/linear/wa105dbz.xml
- Loading branch information
Showing
9 changed files
with
715 additions
and
1 deletion.
There are no files selected for viewing
115 changes: 115 additions & 0 deletions
115
bundles/binding/org.openhab.binding.zwave/database/aeon/zw112.xml
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,115 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Product> | ||
<Model>DoorSensor</Model> | ||
<Label lang="en">Door/Window sensor</Label> | ||
<CommandClasses> | ||
<Class><id>0x20</id></Class> | ||
<Class><id>0x70</id></Class> | ||
<Class><id>0x80</id></Class> | ||
<Class><id>0x00</id></Class> | ||
<Class><id>0x30</id></Class> | ||
<Class><id>0x71</id></Class> | ||
<Class><id>0x86</id></Class> | ||
<Class><id>0x72</id></Class> | ||
<Class><id>0x84</id></Class> | ||
<Class><id>0x85</id></Class> | ||
</CommandClasses> | ||
<Configuration> | ||
<Parameter> | ||
<Index>1</Index> | ||
<Type>list</Type> | ||
<Default>0</Default> | ||
<Size>1</Size> | ||
<Label lang="en">Which value of the Sensor Binary Report or Basic Set will be sent when the Magnet is triggered On/Off.</Label> | ||
<Item> | ||
<Value>0</Value> | ||
<Label lang="en">On=Sensor Binary Report/Basic Set 0xFF; Off=Sensor Binary Report/Basic Set 0x00</Label> | ||
</Item> | ||
<Item> | ||
<Value>1</Value> | ||
<Label lang="en">On=Sensor Binary Report/Basic Set 0x00; Off=Sensor Binary Report/Basic Set 0xFF</Label> | ||
</Item> | ||
</Parameter> | ||
<Parameter> | ||
<Index>39</Index> | ||
<Type>byte</Type> | ||
<Default>20</Default> | ||
<Minimum>10</Minimum> | ||
<Maximum>50</Maximum> | ||
<Size>1</Size> | ||
<Label lang="en">Set the low battery value.</Label> | ||
<Help lang="en">10% to 50%</Help> | ||
</Parameter> | ||
<Parameter> | ||
<Index>101</Index> | ||
<Type>list</Type> | ||
<Default>1</Default> | ||
<Size>1</Size> | ||
<Label lang="en">Enable/disable the function of parameter 111</Label> | ||
<Item> | ||
<Value>0</Value> | ||
<Label lang="en">disable</Label> | ||
</Item> | ||
<Item> | ||
<Value>1</Value> | ||
<Label lang="en">enable</Label> | ||
</Item> | ||
</Parameter> | ||
<Parameter> | ||
<Index>111</Index> | ||
<Type>byte</Type> | ||
<Minimum>0</Minimum> | ||
<Maximum>2147483647</Maximum> | ||
<Default>86640</Default> | ||
<Size>4</Size> | ||
<Label lang="en">Set the interval time of low battery checking.</Label> | ||
<Help lang="en">Minimum interval is 4 minutes, Range is 0 to 2147483647</Help> | ||
</Parameter> | ||
<Parameter> | ||
<Index>121</Index> | ||
<Type>list</Type> | ||
<Default>1</Default> | ||
<Size>1</Size> | ||
<Label lang="en">Configure which sensor report will be sent when the Magnet is triggered On/Off.</Label> | ||
<Item> | ||
<Value>0</Value> | ||
<Label lang="en">send nothing</Label> | ||
</Item> | ||
<Item> | ||
<Value>1</Value> | ||
<Label lang="en">send Basic Set CC</Label> | ||
</Item> | ||
<Item> | ||
<Value>2</Value> | ||
<Label lang="en">send Sensor Binary Report CC</Label> | ||
</Item> | ||
<Item> | ||
<Value>3</Value> | ||
<Label lang="en">send Basic Set CC and Sensor Binary CC</Label> | ||
</Item> | ||
</Parameter> | ||
<Parameter> | ||
<Index>252</Index> | ||
<Type>list</Type> | ||
<Default>0</Default> | ||
<Size>1</Size> | ||
<Label lang="en">Lock/unlock all configuration parameters.</Label> | ||
<Item> | ||
<Value>0</Value> | ||
<Label lang="en">unlock</Label> | ||
</Item> | ||
<Item> | ||
<Value>1</Value> | ||
<Label lang="en">lock</Label> | ||
</Item> | ||
</Parameter> | ||
</Configuration> | ||
<Associations> | ||
<Group> | ||
<Index>1</Index> | ||
<Maximum>5</Maximum> | ||
<Label lang="en">Group 1</Label> | ||
<SetToController>true</SetToController> | ||
</Group> | ||
</Associations> | ||
</Product> |
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 |
---|---|---|
|
@@ -90,4 +90,4 @@ | |
|
||
</Associations> | ||
|
||
</Product> | ||
</Product> |
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
162 changes: 162 additions & 0 deletions
162
...rc/main/java/org/openhab/binding/zwave/internal/converter/ZWaveCentralSceneConverter.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,162 @@ | ||
/** | ||
* Copyright (c) 2014-2016 by the respective copyright holders. | ||
* <p> | ||
* 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.binding.zwave.internal.converter; | ||
|
||
import java.util.Map; | ||
import java.util.Properties; | ||
|
||
import org.openhab.binding.zwave.internal.converter.state.BinaryDecimalTypeConverter; | ||
import org.openhab.binding.zwave.internal.converter.state.IntegerDecimalTypeConverter; | ||
import org.openhab.binding.zwave.internal.converter.state.IntegerOnOffTypeConverter; | ||
import org.openhab.binding.zwave.internal.converter.state.IntegerOpenClosedTypeConverter; | ||
import org.openhab.binding.zwave.internal.converter.state.IntegerPercentTypeConverter; | ||
import org.openhab.binding.zwave.internal.converter.state.ZWaveStateConverter; | ||
import org.openhab.binding.zwave.internal.protocol.SerialMessage; | ||
import org.openhab.binding.zwave.internal.protocol.ZWaveController; | ||
import org.openhab.binding.zwave.internal.protocol.ZWaveNode; | ||
import org.openhab.binding.zwave.internal.protocol.commandclass.ZWaveSceneActivationCommandClass; | ||
import org.openhab.binding.zwave.internal.protocol.event.ZWaveCommandClassValueEvent; | ||
import org.openhab.core.events.EventPublisher; | ||
import org.openhab.core.items.Item; | ||
import org.openhab.core.library.types.DecimalType; | ||
import org.openhab.core.types.Command; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
/** | ||
* ZWaveSceneConverter class. Converters between binding items and the Z-Wave | ||
* API for scene controllers. | ||
* | ||
* @author Chris Jackson, Robert Savage | ||
*/ | ||
public class ZWaveCentralSceneConverter extends ZWaveCommandClassConverter<ZWaveSceneActivationCommandClass> { | ||
|
||
private static final Logger logger = LoggerFactory.getLogger(ZWaveCentralSceneConverter.class); | ||
|
||
/** | ||
* Constructor. Creates a new instance of the | ||
* {@link ZWaveCentralSceneConverter} class. | ||
* | ||
* @param controller the {@link ZWaveController} to use to send messages. | ||
* @param eventPublisher the {@link EventPublisher} that can be used to send updates. | ||
*/ | ||
public ZWaveCentralSceneConverter(ZWaveController controller, EventPublisher eventPublisher) { | ||
super(controller, eventPublisher); | ||
|
||
// State converters used by this converter. | ||
this.addStateConverter(new BinaryDecimalTypeConverter()); | ||
this.addStateConverter(new IntegerOnOffTypeConverter()); | ||
this.addStateConverter(new IntegerOpenClosedTypeConverter()); | ||
this.addStateConverter(new IntegerDecimalTypeConverter()); | ||
this.addStateConverter(new IntegerPercentTypeConverter()); | ||
} | ||
|
||
/** | ||
* {@inheritDoc} | ||
*/ | ||
@Override | ||
int getRefreshInterval() { | ||
return 0; | ||
} | ||
|
||
@Override | ||
SerialMessage executeRefresh(ZWaveNode node, ZWaveSceneActivationCommandClass commandClass, int endpointId, | ||
Map<String, String> arguments) { | ||
return null; | ||
} | ||
|
||
@Override | ||
void handleEvent(ZWaveCommandClassValueEvent event, Item item, Map<String, String> arguments) { | ||
org.openhab.core.types.State itemState = null; | ||
|
||
// get the central scene command value event properties | ||
Properties properties = (Properties) event.getValue(); | ||
int event_scene = (Integer) properties.get("scene"); | ||
int event_key = (Integer) properties.get("key"); | ||
|
||
// if the optional "scene" argument was defined in the item definition, | ||
// then only forward the event for the specified scene number | ||
if (arguments.get("scene") != null) { | ||
|
||
// get the item specified scene number | ||
Integer scene = null; | ||
try { | ||
scene = Integer.parseInt(arguments.get("scene")); | ||
} catch (NumberFormatException e) { | ||
logger.error("NODE {}: Number format exception scene={}", event.getNodeId(), arguments.get("scene")); | ||
return; | ||
} | ||
|
||
// ensure the item specified scene number matches the scene number | ||
// from the received command event | ||
if (scene != null && scene != event_scene) { | ||
return; | ||
} | ||
|
||
// if the optional "key" argument was defined in the item | ||
// definition, | ||
// then only forward the event for the specified matching key state | ||
if (arguments.get("key") != null) { | ||
|
||
// get the item specified key (state) | ||
Integer key = null; | ||
try { | ||
key = Integer.parseInt(arguments.get("key")); | ||
} catch (NumberFormatException e) { | ||
logger.error("NODE {}: Number format exception key={}", event.getNodeId(), arguments.get("key")); | ||
return; | ||
} | ||
|
||
// ensure the item specified key number matches the key number | ||
// from the received command event | ||
if (key != null && key != event_key) { | ||
return; | ||
} | ||
|
||
// get state converter | ||
ZWaveStateConverter<?, ?> converter = this.getStateConverter(item, event_scene); | ||
|
||
if (converter == null) { | ||
logger.warn("No converter found for item = {}, node = {} endpoint = {}, ignoring event.", | ||
item.getName(), event.getNodeId(), event.getEndpoint()); | ||
return; | ||
} | ||
|
||
// convert the scene number and key state to a binary value on a | ||
// successful match | ||
itemState = converter.convertFromValueToState((event_key == key) ? 1 : 0); | ||
} else { | ||
// get state converter | ||
ZWaveStateConverter<?, ?> converter = this.getStateConverter(item, event_key); | ||
|
||
if (converter == null) { | ||
logger.warn("No converter found for item = {}, node = {} endpoint = {}, ignoring event.", | ||
item.getName(), event.getNodeId(), event.getEndpoint()); | ||
return; | ||
} | ||
|
||
// convert the scene's key number to an acceptable conversion | ||
// type and then publish the event | ||
itemState = converter.convertFromValueToState(event_key); | ||
} | ||
} else { | ||
// no scene argument provide, so we will convert the central scene | ||
// number | ||
itemState = new DecimalType(event_scene); | ||
} | ||
|
||
// publish the central scene update | ||
this.getEventPublisher().postUpdate(item.getName(), itemState); | ||
} | ||
|
||
@Override | ||
void receiveCommand(Item item, Command command, ZWaveNode node, ZWaveSceneActivationCommandClass commandClass, | ||
int endpointId, Map<String, String> arguments) { | ||
} | ||
} |
Oops, something went wrong.