[wemo] Prevent excessive currentPower channel updates (#12461)

* Introduce algorithm for preventing excessive currentPower updates
* Increase calculation accuracy
* Rename currentPowerAccurate to currentPowerRaw
* Remove duplicated line
* Use interface when declaring double ended queue
* Reformat README to one sentence per line
* Rename constants for consistency and readability

Fixes #12460

Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
This commit is contained in:
Jacob Laursen
2022-04-02 12:46:26 +02:00
committed by GitHub
parent 115f5ab534
commit 1239dda691
20 changed files with 602 additions and 182 deletions

View File

@@ -89,7 +89,7 @@ public class WemoInsightHandlerTest {
public void assertThatChannelLASTONFORIsUpdatedOnReceivedValue() {
insightParams.lastOnFor = TIME_PARAM;
State expectedStateType = new DecimalType(TIME_PARAM);
String expectedChannel = CHANNEL_LASTONFOR;
String expectedChannel = CHANNEL_LAST_ON_FOR;
testOnValueReceived(expectedChannel, expectedStateType, insightParams.toString());
}
@@ -98,7 +98,7 @@ public class WemoInsightHandlerTest {
public void assertThatChannelONTODAYIsUpdatedOnReceivedValue() {
insightParams.onToday = TIME_PARAM;
State expectedStateType = new DecimalType(TIME_PARAM);
String expectedChannel = CHANNEL_ONTODAY;
String expectedChannel = CHANNEL_ON_TODAY;
testOnValueReceived(expectedChannel, expectedStateType, insightParams.toString());
}
@@ -107,7 +107,7 @@ public class WemoInsightHandlerTest {
public void assertThatChannelONTOTALIsUpdatedOnReceivedValue() {
insightParams.onTotal = TIME_PARAM;
State expectedStateType = new DecimalType(TIME_PARAM);
String expectedChannel = CHANNEL_ONTOTAL;
String expectedChannel = CHANNEL_ON_TOTAL;
testOnValueReceived(expectedChannel, expectedStateType, insightParams.toString());
}
@@ -125,7 +125,7 @@ public class WemoInsightHandlerTest {
public void assertThatChannelAVERAGEPOWERIsUpdatedOnReceivedValue() {
insightParams.avgPower = POWER_PARAM;
State expectedStateType = new QuantityType<>(POWER_PARAM, Units.WATT);
String expectedChannel = CHANNEL_AVERAGEPOWER;
String expectedChannel = CHANNEL_AVERAGE_POWER;
testOnValueReceived(expectedChannel, expectedStateType, insightParams.toString());
}