-
-
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.
[lutron] Implement button press notifications for Picos from LEAP (#1…
…6550) * [lutron] implement button press notifications for Picos from LEAP * reverse equality check for null safety Signed-off-by: Cody Cutrer <cody@cutrer.us>
- Loading branch information
Showing
9 changed files
with
178 additions
and
1 deletion.
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
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
30 changes: 30 additions & 0 deletions
30
...tron/src/main/java/org/openhab/binding/lutron/internal/protocol/leap/dto/ButtonEvent.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,30 @@ | ||
/** | ||
* Copyright (c) 2010-2024 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.lutron.internal.protocol.leap.dto; | ||
|
||
import org.openhab.binding.lutron.internal.protocol.leap.AbstractMessageBody; | ||
|
||
import com.google.gson.annotations.SerializedName; | ||
|
||
/** | ||
* LEAP ButtonEvent Object | ||
* | ||
* @author Cody Cutrer - Initial contribution | ||
*/ | ||
public class ButtonEvent extends AbstractMessageBody { | ||
@SerializedName("EventType") | ||
public String eventType; // Press, Release | ||
|
||
public ButtonEvent() { | ||
} | ||
} |
44 changes: 44 additions & 0 deletions
44
...ron/src/main/java/org/openhab/binding/lutron/internal/protocol/leap/dto/ButtonStatus.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,44 @@ | ||
/** | ||
* Copyright (c) 2010-2024 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.lutron.internal.protocol.leap.dto; | ||
|
||
import java.util.regex.Pattern; | ||
|
||
import org.openhab.binding.lutron.internal.protocol.leap.AbstractMessageBody; | ||
|
||
import com.google.gson.annotations.SerializedName; | ||
|
||
/** | ||
* LEAP ButtonStatus Object | ||
* | ||
* @author Cody Cutrer - Initial contribution | ||
*/ | ||
public class ButtonStatus extends AbstractMessageBody { | ||
public static final Pattern BUTTON_HREF_PATTERN = Pattern.compile("/button/([0-9]+)"); | ||
|
||
@SerializedName("ButtonEvent") | ||
public ButtonEvent buttonEvent; | ||
@SerializedName("Button") | ||
public Href button = new Href(); | ||
|
||
public ButtonStatus() { | ||
} | ||
|
||
public int getButton() { | ||
if (button != null) { | ||
return hrefNumber(BUTTON_HREF_PATTERN, button.href); | ||
} else { | ||
return 0; | ||
} | ||
} | ||
} |