-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[hue] Add channels for time of last sensor update (API v2) (#15552)
* Add channels for last motion/temperature sensor update (API v2) * Add channel for last light level sensor update (API v2) * Add channel for last rotary steps update (API v2) * Add channel for last button update (API v2) Resolves #15546 Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
- Loading branch information
Showing
31 changed files
with
1,463 additions
and
682 deletions.
There are no files selected for viewing
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
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
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
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
53 changes: 53 additions & 0 deletions
53
...ab.binding.hue/src/main/java/org/openhab/binding/hue/internal/dto/clip2/ButtonReport.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,53 @@ | ||
/** | ||
* Copyright (c) 2010-2023 Contributors to the openHAB project | ||
* | ||
* See the NOTICE file(s) distributed with this work for additional | ||
* information. | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Eclipse Public License 2.0 which is available at | ||
* http://www.eclipse.org/legal/epl-2.0 | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
*/ | ||
package org.openhab.binding.hue.internal.dto.clip2; | ||
|
||
import java.time.Instant; | ||
|
||
import org.eclipse.jdt.annotation.NonNullByDefault; | ||
import org.eclipse.jdt.annotation.Nullable; | ||
import org.openhab.binding.hue.internal.dto.clip2.enums.ButtonEventType; | ||
|
||
/** | ||
* DTO for CLIP 2 button report. | ||
* | ||
* @author Jacob Laursen - Initial contribution | ||
*/ | ||
@NonNullByDefault | ||
public class ButtonReport { | ||
private @NonNullByDefault({}) Instant updated; | ||
private @Nullable String event; | ||
|
||
/** | ||
* @return last time the value of this property is updated. | ||
*/ | ||
public Instant getLastChanged() { | ||
return updated; | ||
} | ||
|
||
/** | ||
* @return event which can be sent by a button control (null if none or invalid). | ||
*/ | ||
public @Nullable ButtonEventType getLastEvent() { | ||
String event = this.event; | ||
if (event == null) { | ||
return null; | ||
} | ||
|
||
try { | ||
return ButtonEventType.valueOf(event.toUpperCase()); | ||
} catch (IllegalArgumentException e) { | ||
return null; | ||
} | ||
} | ||
} |
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
48 changes: 48 additions & 0 deletions
48
...inding.hue/src/main/java/org/openhab/binding/hue/internal/dto/clip2/LightLevelReport.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,48 @@ | ||
/** | ||
* Copyright (c) 2010-2023 Contributors to the openHAB project | ||
* | ||
* See the NOTICE file(s) distributed with this work for additional | ||
* information. | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Eclipse Public License 2.0 which is available at | ||
* http://www.eclipse.org/legal/epl-2.0 | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
*/ | ||
package org.openhab.binding.hue.internal.dto.clip2; | ||
|
||
import java.time.Instant; | ||
|
||
import org.eclipse.jdt.annotation.NonNullByDefault; | ||
|
||
import com.google.gson.annotations.SerializedName; | ||
|
||
/** | ||
* DTO for CLIP 2 light level sensor report. | ||
* | ||
* @author Jacob Laursen - Initial contribution | ||
*/ | ||
@NonNullByDefault | ||
public class LightLevelReport { | ||
private @NonNullByDefault({}) Instant changed; | ||
private @SerializedName("light_level") int lightLevel; | ||
|
||
/** | ||
* @return last time the value of this property is changed. | ||
*/ | ||
public Instant getLastChanged() { | ||
return changed; | ||
} | ||
|
||
/** | ||
* Light level in 10000*log10(lux) +1 measured by sensor. | ||
* Logarithmic scale used because the human eye adjusts to light levels and small changes at low lux levels | ||
* are more noticeable than at high lux levels. This allows use of linear scale configuration sliders. | ||
* | ||
* @return light level in 10000*log10(lux) +1 measured by sensor | ||
*/ | ||
public int getLightLevel() { | ||
return lightLevel; | ||
} | ||
} |
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
42 changes: 42 additions & 0 deletions
42
...ab.binding.hue/src/main/java/org/openhab/binding/hue/internal/dto/clip2/MotionReport.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,42 @@ | ||
/** | ||
* Copyright (c) 2010-2023 Contributors to the openHAB project | ||
* | ||
* See the NOTICE file(s) distributed with this work for additional | ||
* information. | ||
* | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Eclipse Public License 2.0 which is available at | ||
* http://www.eclipse.org/legal/epl-2.0 | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
*/ | ||
package org.openhab.binding.hue.internal.dto.clip2; | ||
|
||
import java.time.Instant; | ||
|
||
import org.eclipse.jdt.annotation.NonNullByDefault; | ||
|
||
/** | ||
* DTO for CLIP 2 motion sensor report. | ||
* | ||
* @author Jacob Laursen - Initial contribution | ||
*/ | ||
@NonNullByDefault | ||
public class MotionReport { | ||
private @NonNullByDefault({}) Instant changed; | ||
private boolean motion; | ||
|
||
/** | ||
* @return last time the value of this property is changed. | ||
*/ | ||
public Instant getLastChanged() { | ||
return changed; | ||
} | ||
|
||
/** | ||
* @return true if motion is detected | ||
*/ | ||
public boolean isMotion() { | ||
return motion; | ||
} | ||
} |
Oops, something went wrong.