int sendCommand = (OnOffType.OFF.compareTo((OnOffType) command));
logger.debug("The command being sent to zone {} for channel:{} is {}", zone, channelUID.getAsString(),
sendCommand);
- sendActuatorCommand(Integer.toString(sendCommand), zone, channelUID);
+ sendActuatorCommand(sendCommand, zone, channelUID);
}
} else if (command instanceof RefreshType) {
// check to see if handler has been initialized before attempting to get state of pin, else wait one minute
// check if the itemType has been defined for the zone received
// check the itemType of the Zone, if Contact, send the State if Temp send Temp, etc.
if (channelType.contains(CHANNEL_SWITCH) || channelType.contains(CHANNEL_ACTUATOR)) {
- OnOffType onOffType = event.getState().equalsIgnoreCase(getOnState(channel)) ? OnOffType.ON
- : OnOffType.OFF;
- updateState(channelId, onOffType);
+ Integer state = event.getState();
+ logger.debug("The event state is: {}", state);
+ if (state != null) {
+ OnOffType onOffType = state == getOnState(channel) ? OnOffType.ON : OnOffType.OFF;
+ updateState(channelId, onOffType);
+ }
} else if (channelType.contains(CHANNEL_HUMIDITY)) {
// if the state is of type number then this means it is the humidity channel of the dht22
updateState(channelId, new QuantityType<>(Double.parseDouble(event.getHumi()), Units.PERCENT));
* @param scommand the string command, either 0 or 1 to send to the actutor pin on the Konnected module
* @param zone the zone to send the command to on the Konnected Module
*/
- private void sendActuatorCommand(String scommand, String zone, ChannelUID channelId) {
+ private void sendActuatorCommand(Integer scommand, String zone, ChannelUID channelId) {
try {
Channel channel = getThing().getChannel(channelId.getId());
if (!(channel == null)) {
// check to see if this is an On Command type, if so add the momentary, pause, times to the payload if
// they exist on the configuration.
- if (scommand.equals(getOnState(channel))) {
+ if (scommand == getOnState(channel)) {
if (configuration.get(CHANNEL_ACTUATOR_TIMES) == null) {
logger.debug(
"The times configuration was not set for channelID: {}, not adding it to the payload.",
}
}
- private String getOnState(Channel channel) {
- String config = (String) channel.getConfiguration().get(CHANNEL_ONVALUE);
- if (config == null) {
- return "1";
- } else {
- return config;
- }
+ private int getOnState(Channel channel) {
+ return ((Number) channel.getConfiguration().get(CHANNEL_ONVALUE)).intValue();
}
}
<option value="alarm_out">Alarm/Out</option>
</options>
</parameter>
- <parameter name="onvalue" type="text">
+ <parameter name="onvalue" type="integer">
<label>On Value</label>
<description>The value that will be treated by the binding as the on value. For sensors that activate with a high
value leave at the default of 1 and sensors that activate with a low value set to 0.</description>
<option value="alarm_out">Alarm/Out</option>
</options>
</parameter>
- <parameter name="onvalue" type="text">
+ <parameter name="onvalue" type="integer">
<label>On Value</label>
<description>The value that will be treated by the binding as an on command. For actuators that activate with a high
command set to 1 and actuators that activate with a low value set to 0.</description>
<option value="12">12</option>
</options>
</parameter>
- <parameter name="onvalue" type="text">
+ <parameter name="onvalue" type="integer">
<label>On Value</label>
<description>The value that will be treated by the binding as the on value. For sensors that activate with a high
value, leave at the default of 1 and sensors that activate with a low value set to 0.</description>
<option value="alarm2_out2">Alarm2/Out2</option>
</options>
</parameter>
- <parameter name="onvalue" type="text">
+ <parameter name="onvalue" type="integer">
<label>On Value</label>
<description>The value that will be treated by the binding as an on command. For actuators that activate with a high
command set to 1 and actuators that activate with a low value set to 0.</description>