这是indexloc提供的服务,不要输入任何密码
Skip to content
This repository was archived by the owner on May 17, 2021. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,11 @@ public boolean processMessage(Message message) {
case POWER_INFORMATION_RESPONSE:

one = ((PowerInformationResponseMessage)message).getOneSecond();
if(pulseToWatt(one) > 10000) {
// the Circle reporting this information is in a kind of error state.
// we just skip these values
return true;
}
postUpdate(MAC,PlugwiseCommandType.CURRENTPOWER,pulseToWatt(one));

DateTimeFormatter fmt = DateTimeFormat.forPattern("yyyy-MM-dd'T'HH:mm:ss");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,21 @@ public void updated(Dictionary config) throws ConfigurationException {
"the given configKey '" + configKey + "' is unknown");
}
}

if (stick != null) {

String configKey = matcher.group(2);
String value = (String) config.get(key);

if ("interval".equals(configKey)) {
stick.setInterval(Integer.valueOf(value));
logger.info("Plugwise set the interval to send ZigBee PDUs to {} ms",value);
}
else {
throw new ConfigurationException(configKey,
"the given configKey '" + configKey + "' is unknown");
}
}
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ public class Stick extends PlugwiseDevice implements SerialPortEventListener{
private boolean initialised = false;
protected List<PlugwiseDevice> plugwiseDeviceCache = Collections.synchronizedList(new ArrayList<PlugwiseDevice>());
private PlugwiseBinding binding;
private int interval = 150 ;

public Stick(String port, PlugwiseBinding binding) {
super("", PlugwiseDevice.DeviceType.Stick, "stick");
Expand Down Expand Up @@ -152,6 +153,10 @@ protected PlugwiseDevice getDeviceByName(String name) {
public String getPort() {
return port;
}

public void setInterval(int interval) {
this.interval = interval;
}

public boolean isInitialised() {
return initialised;
Expand Down Expand Up @@ -655,6 +660,11 @@ public void execute(JobExecutionContext context)
Message message = theStick.sendQueue.poll();
while(message != null) {
sendMessage(message);
try {
Thread.sleep(theStick.interval);
} catch (InterruptedException e) {
logger.debug("An exception occurred while putting the Plugwise SendJob thread to sleep : {}",e.getMessage());
}
message = theStick.sendQueue.poll();
}
}
Expand Down
2 changes: 2 additions & 0 deletions distribution/openhabhome/configurations/openhab_default.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,8 @@ ntp:hostname=ptbtime1.ptb.de
#
# "stick" is reserved plug wise id
#plugwise:stick.port=
# interval in ms to wait between messages sent on the ZigBee network
#plugwise:stick.interval=150

# "circleplus" is reserved plug wise id
#plugwise:circleplus.mac=
Expand Down