Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[tapocontrol] Add Smart Switches S210 and S220 #17927

Merged
merged 98 commits into from
Dec 25, 2024
Merged
Changes from 1 commit
Commits
Show all changes
98 commits
Select commit Hold shift + click to select a range
ce07972
Tapo Smart Switches S210 and S220 added
mkmannmanny Dec 19, 2024
f920f74
Correct version of binding in POM
mkmannmanny Dec 19, 2024
bd0a0f6
Clean Format errors
mkmannmanny Dec 19, 2024
b139ac9
Logger in TapoSmartSwitchHandler wrong
mkmannmanny Dec 19, 2024
5a6f1b9
Simplify DateTimeType handling for aha Waste Collection
jlaur Dec 10, 2024
fdd4799
Simplify DateTimeType handling for Air Quality
jlaur Dec 10, 2024
1c5940f
Simplify DateTimeType handling for Automower
jlaur Nov 9, 2024
495c168
Simplify DateTimeType handling for AVM FRITZ!
jlaur Dec 10, 2024
1872165
Simplify DateTimeType handling for aWATTar
jlaur Nov 11, 2024
50bb6ca
Simplify DateTimeType handling for BigAssFan
jlaur Nov 30, 2024
3efbe50
Simplify DateTimeType handling for Bosch Indego
jlaur Nov 27, 2024
cd52c03
Simplify DateTimeType handling for Bosch Smart Home
jlaur Nov 28, 2024
72f396a
Simplify DateTimeType handling for Broadlink
jlaur Nov 16, 2024
93ae3f4
Simplify DateTimeType handling for DBQuery
jlaur Dec 9, 2024
77ee6cb
Simplify DateTimeType handling for deCONZ
jlaur Nov 9, 2024
85f5675
Simplify DateTimeType handling for Deutsche Bahn
jlaur Dec 10, 2024
771a8c2
Simplify DateTimeType handling for Digiplex/EVO
jlaur Dec 9, 2024
714e269
Simplify DateTimeType handling for Doorbird
jlaur Dec 9, 2024
51ba4cd
Simplify DateTimeType handling for DWD Pollenflug
jlaur Dec 10, 2024
6e2b757
Simplify DateTimeType handling for DWD Unwetter
jlaur Nov 14, 2024
5502390
Simplify DateTimeType handling for Ecobee
jlaur Nov 27, 2024
dc3f3ba
Simplify DateTimeType handling for Ecovacs
jlaur Nov 10, 2024
a389d7e
Simplify DateTimeType handling for Enphase
jlaur Dec 9, 2024
4f20223
Simplify DateTimeType handling for EVCC
jlaur Nov 19, 2024
e3e1606
Simplify DateTimeType handling for Exec
jlaur Nov 25, 2024
98db641
Simplify DateTimeType handling for Feed
jlaur Dec 10, 2024
488133d
Simplify DateTimeType handling for Fine Offset Weather Station
jlaur Nov 17, 2024
46297bf
Simplify DateTimeType handling for Flume
jlaur Nov 9, 2024
84a37b9
Simplify DateTimeType handling for FMI Weather
jlaur Nov 25, 2024
ba76d38
Simplify DateTimeType handling for Foobot
jlaur Dec 10, 2024
766eaee
Simplify DateTimeType handling for FreeboxOS
jlaur Nov 25, 2024
dde77fd
Simplify DateTimeType handling for Freecurrency
jlaur Dec 17, 2024
b8ff957
Simplify DateTimeType handling for Gardena
jlaur Dec 10, 2024
7090c7f
Simplify DateTimeType handling for Groupe PSA
jlaur Nov 9, 2024
05719ed
Simplify DateTimeType handling for Helios easyControls
jlaur Nov 17, 2024
992b951
Simplify DateTimeType handling for Philips Hue
jlaur Nov 27, 2024
2662545
Simplify DateTimeType handling for Hydrawise
jlaur Nov 17, 2024
85eb3dc
Simplify DateTimeType handling for IHC
jlaur Nov 9, 2024
741c8bb
Simplify DateTimeType handling for Insteon
jlaur Nov 15, 2024
17330fb
Simplify DateTimeType handling for JuiceNet
jlaur Nov 9, 2024
6775932
Simplify DateTimeType handling for KM200
jlaur Nov 17, 2024
65b99e1
Simplify DateTimeType handling for LaMetric
jlaur Nov 17, 2024
7a1f6c6
Simplify DateTimeType handling for Lutron
jlaur Nov 17, 2024
7261f56
Simplify DateTimeType handling for LuxtronikHeatpump
jlaur Nov 28, 2024
ea53ec3
Simplify DateTimeType handling for Meater
jlaur Nov 25, 2024
4d20f1d
Simplify DateTimeType handling for Mercedes Me
jlaur Nov 19, 2024
5922edb
Simplify DateTimeType handling for Met Office DataHub
jlaur Nov 25, 2024
ec9809d
Simplify DateTimeType handling for Meteo France
jlaur Dec 16, 2024
e75f387
Simplify DateTimeType handling for Mi IO
jlaur Nov 9, 2024
43f6580
Simplify DateTimeType handling for Millheat
jlaur Nov 15, 2024
ea3356c
Simplify DateTimeType handling for MQTT
jlaur Nov 19, 2024
c409e34
Simplify DateTimeType handling for Ruuvi Gateway MQTT
jlaur Nov 24, 2024
20c3103
Simplify DateTimeType handling for Network
jlaur Nov 9, 2024
502f8a7
Simplify DateTimeType handling for Nest
jlaur Nov 16, 2024
bbc8bb3
Simplify DateTimeType handling for OJElectronics
jlaur Nov 17, 2024
f9ed34a
Simplify DateTimeType handling for OneBusAway
jlaur Nov 28, 2024
2efa8d4
Simplify DateTimeType handling for OpenUV
jlaur Nov 18, 2024
d619f47
Simplify DateTimeType handling for OpenWeatherMap
jlaur Nov 26, 2024
f6119cb
Simplify DateTimeType handling for PLCLogo
jlaur Nov 18, 2024
0e2ec68
Simplify DateTimeType handling for SAICiSMART
jlaur Nov 9, 2024
5164913
Simplify DateTimeType handling for Satel Integra Alarm System
jlaur Nov 18, 2024
ea3d04a
Simplify DateTimeType handling for Shelly
jlaur Nov 15, 2024
46bb39d
Simplify DateTimeType handling for Siemens HVAC
jlaur Nov 10, 2024
72f3ab4
Simplify DateTimeType handling for Solax
jlaur Nov 24, 2024
2b06e56
Simplify DateTimeType handling for Philips Somneo
jlaur Nov 19, 2024
a2be9b7
Simplify DateTimeType handling for TA C.M.I.
jlaur Nov 18, 2024
eccd927
Simplify DateTimeType handling for Tado
jlaur Nov 9, 2024
0927c9f
Simplify DateTimeType handling for Teleinfo
jlaur Nov 18, 2024
a9c0a27
Simplify DateTimeType handling for Tellstick
jlaur Nov 27, 2024
74277f8
Simplify DateTimeType handling for UniFi
jlaur Nov 26, 2024
1adcc5f
Simplify DateTimeType handling for Vallox MV
jlaur Nov 9, 2024
31217dc
Simplify DateTimeType handling for VeSync
jlaur Nov 25, 2024
c4cba6b
Simplify DateTimeType handling for Video Disk Recorder
jlaur Nov 10, 2024
ebd2d0d
Simplify DateTimeType handling for VisualCrossing
jlaur Dec 10, 2024
4d5f147
Simplify DateTimeType handling for VolvoOnCall
jlaur Nov 26, 2024
f65ccf3
Simplify DateTimeType handling for WeatherUnderground
jlaur Dec 16, 2024
d0f023d
Simplify DateTimeType handling for WeMo
jlaur Nov 9, 2024
2b818ca
Simplify DateTimeType handling for WiZ
jlaur Dec 17, 2024
d2ad72a
Simplify DateTimeType handling for Wolf Smartset
jlaur Dec 9, 2024
05456e9
Simplify DateTimeType handling for XmlTv
jlaur Dec 17, 2024
d616d5b
Simplify DateTimeType handling for ZoneMinder
jlaur Nov 27, 2024
01372a6
Simplify DateTimeType handling for Amazon DynamoDB
jlaur Nov 9, 2024
e698e64
Simplify DateTimeType handling for InfluxDB
jlaur Nov 9, 2024
b5a8023
Simplify DateTimeType handling for Java Persistence API
jlaur Nov 18, 2024
e3d0575
Simplify DateTimeType handling for JDBC
jlaur Nov 14, 2024
c8cbd03
Simplify DateTimeType handling for MongoDB
jlaur Nov 19, 2024
6cbefb4
[roku] Check for ECP Limited Mode (#17925)
mlobstein Dec 19, 2024
ef269dc
[insteon] Use shared jetty http client (#17922)
jsetton Dec 19, 2024
5498d75
Use switch pattern matching
jlaur Dec 16, 2024
2cb66e0
Update readme with smart switches
mkmannmanny Dec 20, 2024
49b9025
Merge branch 'openhab:main' into main
mkmannmanny Dec 20, 2024
2ba047a
Merge remote-tracking branch 'origin/main' into main
mkmannmanny Dec 21, 2024
0d1cb0b
Merge remote-tracking branch 'origin/main' into main
mkmannmanny Dec 24, 2024
4a69ea0
Update bundles/org.openhab.binding.tapocontrol/src/main/java/org/open…
mkmannmanny Dec 25, 2024
86a8af6
Update bundles/org.openhab.binding.tapocontrol/README.md
mkmannmanny Dec 25, 2024
2bd3485
Merge branch 'openhab:main' into main
mkmannmanny Dec 25, 2024
81bfd4b
Merge remote-tracking branch 'origin/main' into main
mkmannmanny Dec 25, 2024
1583814
Resolve rewiew comments from Isiepel
mkmannmanny Dec 25, 2024
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
Prev Previous commit
Next Next commit
Simplify DateTimeType handling for WeMo
Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
jlaur authored and mkmannmanny committed Dec 20, 2024
commit d0f023d637e2aaaf3302aa3860b890e0396e24d1
Original file line number Diff line number Diff line change
@@ -15,8 +15,6 @@
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.time.Instant;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.util.HashMap;
import java.util.Map;

@@ -116,12 +114,10 @@ private State getDateTime(String value) {
return UnDefType.UNDEF;
}

State lastChangedAtState = new DateTimeType(
ZonedDateTime.ofInstant(Instant.ofEpochSecond(lastChangedAt), ZoneId.systemDefault()));
if (lastChangedAt == 0) {
return UnDefType.UNDEF;
}
return lastChangedAtState;
return new DateTimeType(Instant.ofEpochSecond(lastChangedAt));
}

private State getNumber(String value) {
Original file line number Diff line number Diff line change
@@ -17,9 +17,7 @@

import java.io.StringReader;
import java.time.Instant;
import java.time.ZonedDateTime;
import java.util.Set;
import java.util.TimeZone;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;

@@ -345,8 +343,7 @@ protected void updateWemoState() {
getThing().getUID());
return null;
}
ZonedDateTime zoned = ZonedDateTime.ofInstant(Instant.ofEpochSecond(value), TimeZone.getDefault().toZoneId());
State dateTimeState = new DateTimeType(zoned);
State dateTimeState = new DateTimeType(Instant.ofEpochSecond(value));
logger.trace("New attribute brewed '{}' received", dateTimeState);
return dateTimeState;
}
Original file line number Diff line number Diff line change
@@ -16,12 +16,10 @@
import static org.openhab.binding.wemo.internal.WemoUtil.*;

import java.time.Instant;
import java.time.ZonedDateTime;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import java.util.TimeZone;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;

@@ -502,8 +500,7 @@ protected void updateWemoState() {
getThing().getUID());
return null;
}
ZonedDateTime zoned = ZonedDateTime.ofInstant(Instant.ofEpochSecond(value), TimeZone.getDefault().toZoneId());
return new DateTimeType(zoned);
return new DateTimeType(Instant.ofEpochSecond(value));
}

public void setBinaryState(String action, String argument, String value) {
Original file line number Diff line number Diff line change
@@ -15,7 +15,6 @@
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNull;

import java.time.ZoneId;
import java.util.Map;

import org.eclipse.jdt.annotation.NonNullByDefault;
@@ -47,7 +46,7 @@ public void parseUpnpInsightParams() {
"1|1645800647|109676|80323|1196960|1209600|44|41400|30288361|483361410|8000");
Map<String, State> result = parser.parse();
assertEquals(OnOffType.ON, result.get(WemoBindingConstants.CHANNEL_STATE));
assertEquals(DateTimeType.valueOf("2022-02-25T15:50:47.000+0100").toZone(ZoneId.systemDefault()),
assertEquals(DateTimeType.valueOf("2022-02-25T15:50:47.000+0100"),
result.get(WemoBindingConstants.CHANNEL_LAST_CHANGED_AT));
assertEquals(new DecimalType(109_676), result.get(WemoBindingConstants.CHANNEL_LAST_ON_FOR));
assertEquals(new DecimalType(80_323), result.get(WemoBindingConstants.CHANNEL_ON_TODAY));
@@ -69,7 +68,7 @@ public void parseHttpInsightParams() {
InsightParser parser = new InsightParser("8|1645967627|0|0|0|1209600|13|0|0|0.000000|8000");
Map<String, State> result = parser.parse();
assertEquals(OnOffType.ON, result.get(WemoBindingConstants.CHANNEL_STATE));
assertEquals(DateTimeType.valueOf("2022-02-27T14:13:47.000+0100").toZone(ZoneId.systemDefault()),
assertEquals(DateTimeType.valueOf("2022-02-27T14:13:47.000+0100"),
result.get(WemoBindingConstants.CHANNEL_LAST_CHANGED_AT));
assertEquals(new DecimalType(0), result.get(WemoBindingConstants.CHANNEL_LAST_ON_FOR));
assertEquals(new DecimalType(0), result.get(WemoBindingConstants.CHANNEL_ON_TODAY));
@@ -92,7 +91,7 @@ public void parseUpnpBinaryState() {
"1|1645800647|109676|80323|1196960|1209600|44|41400|30288361|483361410");
Map<String, State> result = parser.parse();
assertEquals(OnOffType.ON, result.get(WemoBindingConstants.CHANNEL_STATE));
assertEquals(DateTimeType.valueOf("2022-02-25T15:50:47.000+0100").toZone(ZoneId.systemDefault()),
assertEquals(DateTimeType.valueOf("2022-02-25T15:50:47.000+0100"),
result.get(WemoBindingConstants.CHANNEL_LAST_CHANGED_AT));
assertEquals(new DecimalType(109_676), result.get(WemoBindingConstants.CHANNEL_LAST_ON_FOR));
assertEquals(new DecimalType(80_323), result.get(WemoBindingConstants.CHANNEL_ON_TODAY));