forked from openhab/openhab-addons
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[homekit] implement StatelessProgrammableSwitch
also supports adding multiple of them in a group, by supporting ServiceIndex as an optional characteristic refs openhab#9969 Signed-off-by: Cody Cutrer <cody@cutrer.us>
- Loading branch information
Showing
11 changed files
with
428 additions
and
239 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
46 changes: 46 additions & 0 deletions
46
...a/org/openhab/io/homekit/internal/accessories/HomekitStatelessProgrammableSwitchImpl.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,46 @@ | ||
/** | ||
* 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.io.homekit.internal.accessories; | ||
|
||
import java.util.List; | ||
|
||
import org.openhab.io.homekit.internal.HomekitAccessoryUpdater; | ||
import org.openhab.io.homekit.internal.HomekitException; | ||
import org.openhab.io.homekit.internal.HomekitSettings; | ||
import org.openhab.io.homekit.internal.HomekitTaggedItem; | ||
|
||
import io.github.hapjava.characteristics.Characteristic; | ||
import io.github.hapjava.characteristics.impl.common.ProgrammableSwitchEventCharacteristic; | ||
import io.github.hapjava.services.impl.StatelessProgrammableSwitchService; | ||
|
||
/** | ||
* Implements a HomeKit Stateless Programmable Switch | ||
* | ||
* @author Cody Cutrer - Initial contribution | ||
*/ | ||
class HomekitStatelessProgrammableSwitchImpl extends AbstractHomekitAccessoryImpl { | ||
|
||
public HomekitStatelessProgrammableSwitchImpl(HomekitTaggedItem taggedItem, | ||
List<HomekitTaggedItem> mandatoryCharacteristics, List<Characteristic> mandatoryRawCharacteristics, | ||
HomekitAccessoryUpdater updater, HomekitSettings settings) { | ||
super(taggedItem, mandatoryCharacteristics, mandatoryRawCharacteristics, updater, settings); | ||
} | ||
|
||
@Override | ||
public void init() throws HomekitException { | ||
super.init(); | ||
|
||
addService(new StatelessProgrammableSwitchService( | ||
getCharacteristic(ProgrammableSwitchEventCharacteristic.class).get())); | ||
} | ||
} |