-
-
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.
Introducing new version of the Freebox binding.
As this version introduces many many modifications, it is presented as a new binding, targetted to repleace the current Freebox Binding in the future. Signed-off-by: clinique <gael@lhopital.org>
- Loading branch information
Showing
112 changed files
with
7,269 additions
and
0 deletions.
There are no files selected for viewing
Validating CODEOWNERS rules …
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
This content is produced and maintained by the openHAB project. | ||
|
||
* Project home: https://www.openhab.org | ||
|
||
== Declared Project Licenses | ||
|
||
This program and the accompanying materials are made available under the terms | ||
of the Eclipse Public License 2.0 which is available at | ||
https://www.eclipse.org/legal/epl-2.0/. | ||
|
||
== Source Code | ||
|
||
https://github.com/openhab/openhab-addons |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?xml version="1.0" encoding="UTF-8" standalone="no"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
|
||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<parent> | ||
<groupId>org.openhab.addons.bundles</groupId> | ||
<artifactId>org.openhab.addons.reactor.bundles</artifactId> | ||
<version>3.0.0-SNAPSHOT</version> | ||
</parent> | ||
|
||
<artifactId>org.openhab.binding.freeboxos</artifactId> | ||
|
||
<name>openHAB Add-ons :: Bundles :: FreeboxOS Binding</name> | ||
|
||
</project> |
10 changes: 10 additions & 0 deletions
10
bundles/org.openhab.binding.freeboxos/src/main/feature/feature.xml
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,10 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<features name="org.openhab.binding.freeboxos-${project.version}" xmlns="http://karaf.apache.org/xmlns/features/v1.4.0"> | ||
<repository>mvn:org.openhab.core.features.karaf/org.openhab.core.features.karaf.openhab-core/${ohc.version}/xml/features</repository> | ||
|
||
<feature name="openhab-binding-freeboxos" description="Freebox OS Binding" version="${project.version}"> | ||
<feature>openhab-runtime-base</feature> | ||
<feature>openhab-transport-mdns</feature> | ||
<bundle start-level="80">mvn:org.openhab.addons.bundles/org.openhab.binding.freeboxos/${project.version}</bundle> | ||
</feature> | ||
</features> |
122 changes: 122 additions & 0 deletions
122
...boxos/src/main/java/org/openhab/binding/freeboxos/internal/FreeboxOsBindingConstants.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,122 @@ | ||
/** | ||
* Copyright (c) 2010-2020 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.freeboxos.internal; | ||
|
||
import java.util.Collections; | ||
import java.util.Set; | ||
import java.util.stream.Collectors; | ||
import java.util.stream.Stream; | ||
|
||
import org.eclipse.jdt.annotation.NonNullByDefault; | ||
import org.openhab.core.thing.ThingTypeUID; | ||
|
||
/** | ||
* The {@link FreeboxBinding} class defines common constants, which are | ||
* used across the whole binding. | ||
* | ||
* @author Gaël L'hopital - Initial contribution | ||
*/ | ||
@NonNullByDefault | ||
public class FreeboxOsBindingConstants { | ||
|
||
public static final String BINDING_ID = "freeboxos"; | ||
|
||
// List of all Bridge Type UIDs | ||
public static final ThingTypeUID BRIDGE_TYPE_API = new ThingTypeUID(BINDING_ID, "api"); | ||
|
||
// List of all Thing Type UIDs | ||
public static final ThingTypeUID THING_TYPE_REVOLUTION = new ThingTypeUID(BINDING_ID, "revolution"); | ||
public static final ThingTypeUID THING_TYPE_DELTA = new ThingTypeUID(BINDING_ID, "delta"); | ||
public static final ThingTypeUID THING_TYPE_LANDLINE = new ThingTypeUID(BINDING_ID, "landline"); | ||
public static final ThingTypeUID THING_TYPE_HOST = new ThingTypeUID(BINDING_ID, "host"); | ||
public static final ThingTypeUID THING_TYPE_WIFI_HOST = new ThingTypeUID(BINDING_ID, "wifihost"); | ||
public static final ThingTypeUID THING_TYPE_PLAYER = new ThingTypeUID(BINDING_ID, "player"); | ||
public static final ThingTypeUID THING_TYPE_VM = new ThingTypeUID(BINDING_ID, "vm"); | ||
public static final ThingTypeUID THING_TYPE_REPEATER = new ThingTypeUID(BINDING_ID, "repeater"); | ||
|
||
// All supported Thing types | ||
public static final Set<ThingTypeUID> BRIDGE_TYPE_UID = Collections.singleton(BRIDGE_TYPE_API); | ||
public static final Set<ThingTypeUID> THINGS_TYPES_UIDS = Set.of(THING_TYPE_LANDLINE, THING_TYPE_HOST, | ||
THING_TYPE_VM, THING_TYPE_PLAYER, THING_TYPE_DELTA, THING_TYPE_REVOLUTION, THING_TYPE_REPEATER, | ||
THING_TYPE_WIFI_HOST); | ||
|
||
protected static final Set<ThingTypeUID> SUPPORTED_THING_TYPES_UIDS = Stream | ||
.concat(BRIDGE_TYPE_UID.stream(), THINGS_TYPES_UIDS.stream()).collect(Collectors.toSet()); | ||
|
||
// List of things properties | ||
public static final String PROPERTY_SENSORS = "sensors"; | ||
|
||
// List of all Group Channel ids | ||
public static final String CONNECTION_STATUS = "connection-status"; | ||
public static final String SYS_INFO = "sysinfo"; | ||
public static final String ACTIONS = "actions"; | ||
public static final String SAMBA = "samba"; | ||
public static final String PLAYER_ACTIONS = "player-actions"; | ||
public static final String CONNECTIVITY = "connectivity"; | ||
public static final String STATE = "state"; | ||
public static final String DISPLAY = "display"; | ||
public static final String VM_STATUS = "vmstatus"; | ||
public static final String WIFI = "wifi"; | ||
public static final String REPEATER_MISC = "repeater-misc"; | ||
public static final String PHONE_MISC = "phone-misc"; | ||
|
||
// List of all Channel ids | ||
public static final String RSSI = "rssi"; | ||
public static final String SSID = "ssid"; | ||
public static final String WIFI_QUALITY = "wifi-quality"; | ||
public static final String WIFI_HOST = "wifi-host"; | ||
public static final String UPTIME = "uptime"; | ||
public static final String BOX_EVENT = "box-event"; | ||
public static final String PHONE_EVENT = "phone-event"; | ||
public static final String LCD_BRIGHTNESS = "lcd-brightness"; | ||
public static final String LCD_ORIENTATION = "lcd-orientation"; | ||
public static final String LCD_FORCED = "lcd-forced"; | ||
public static final String WIFI_STATUS = "wifi-status"; | ||
public static final String IP_ADDRESS = "ip-address"; | ||
public static final String LINE_STATUS = "line-status"; | ||
public static final String PLAYER_STATUS = "player-status"; | ||
public static final String RATE_UP = "rate-up"; | ||
public static final String RATE_DOWN = "rate-down"; | ||
public static final String BYTES_UP = "bytes-up"; | ||
public static final String BYTES_DOWN = "bytes-down"; | ||
public static final String BW_UP = "bandwidth-up"; | ||
public static final String BW_DOWN = "bandwidth-down"; | ||
public static final String PCT_BW_UP = "bandwidth-usage-up"; | ||
public static final String PCT_BW_DOWN = "bandwidth-usage-down"; | ||
public static final String ONHOOK = "onhook"; | ||
public static final String RINGING = "ringing"; | ||
public static final String CALL_INFO = "call-info"; | ||
public static final String CALL_DURATION = "call-duration"; | ||
public static final String CALL_TIMESTAMP = "call-timestamp"; | ||
public static final String CALL_NAME = "call-name"; | ||
public static final String FTP_STATUS = "ftp-status"; | ||
public static final String SAMBA_FILE_STATUS = "fileshare-status"; | ||
public static final String SAMBA_PRINTER_STATUS = "printershare-status"; | ||
public static final String REACHABLE = "reachable"; | ||
public static final String LAST_SEEN = "last-seen"; | ||
public static final String ALTERNATE_RING = "lcd-forced"; | ||
public static final String DECT_ACTIVE = "dect-active"; | ||
|
||
// Freebox player channels | ||
public static final String AIRMEDIA_STATUS = "airmedia-status"; | ||
public static final String UPNPAV_STATUS = "upnpav-status"; | ||
public static final String KEY_CODE = "key-code"; | ||
|
||
// Virtual machine channels | ||
public static final String STATUS = "status"; | ||
|
||
// Repeater channels | ||
public static final String LED = "led"; | ||
public static final String HOST_COUNT = "host-count"; | ||
public static final String RPT_TIMESTAMP = "start-timestamp"; | ||
} |
96 changes: 96 additions & 0 deletions
96
...eeboxos/src/main/java/org/openhab/binding/freeboxos/internal/FreeboxOsHandlerFactory.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,96 @@ | ||
/** | ||
* Copyright (c) 2010-2020 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.freeboxos.internal; | ||
|
||
import static org.openhab.binding.freeboxos.internal.FreeboxOsBindingConstants.*; | ||
|
||
import java.time.ZoneId; | ||
|
||
import org.eclipse.jdt.annotation.NonNullByDefault; | ||
import org.eclipse.jdt.annotation.Nullable; | ||
import org.openhab.binding.freeboxos.internal.handler.ApiHandler; | ||
import org.openhab.binding.freeboxos.internal.handler.HostHandler; | ||
import org.openhab.binding.freeboxos.internal.handler.LandlineHandler; | ||
import org.openhab.binding.freeboxos.internal.handler.PlayerHandler; | ||
import org.openhab.binding.freeboxos.internal.handler.RepeaterHandler; | ||
import org.openhab.binding.freeboxos.internal.handler.RevolutionHandler; | ||
import org.openhab.binding.freeboxos.internal.handler.ServerHandler; | ||
import org.openhab.binding.freeboxos.internal.handler.VmHandler; | ||
import org.openhab.binding.freeboxos.internal.handler.WifiHostHandler; | ||
import org.openhab.core.audio.AudioHTTPServer; | ||
import org.openhab.core.i18n.TimeZoneProvider; | ||
import org.openhab.core.net.NetworkAddressService; | ||
import org.openhab.core.thing.Bridge; | ||
import org.openhab.core.thing.Thing; | ||
import org.openhab.core.thing.ThingTypeUID; | ||
import org.openhab.core.thing.binding.BaseThingHandlerFactory; | ||
import org.openhab.core.thing.binding.ThingHandler; | ||
import org.openhab.core.thing.binding.ThingHandlerFactory; | ||
import org.osgi.service.component.ComponentContext; | ||
import org.osgi.service.component.annotations.Activate; | ||
import org.osgi.service.component.annotations.Component; | ||
import org.osgi.service.component.annotations.Reference; | ||
|
||
/** | ||
* The {@link FreeboxOsHandlerFactory} is responsible for creating things and thing | ||
* handlers. | ||
* | ||
* @author Gaël L'hopital - Initial contribution | ||
*/ | ||
@NonNullByDefault | ||
@Component(service = ThingHandlerFactory.class, configurationPid = "binding.freeboxos") | ||
public class FreeboxOsHandlerFactory extends BaseThingHandlerFactory { | ||
private final AudioHTTPServer audioHTTPServer; | ||
private final NetworkAddressService networkAddressService; | ||
private final ZoneId zoneId; | ||
|
||
@Activate | ||
public FreeboxOsHandlerFactory(final @Reference AudioHTTPServer audioHTTPServer, | ||
final @Reference NetworkAddressService networkAddressService, | ||
final @Reference TimeZoneProvider timeZoneProvider, ComponentContext componentContext) { | ||
super.activate(componentContext); | ||
this.audioHTTPServer = audioHTTPServer; | ||
this.networkAddressService = networkAddressService; | ||
this.zoneId = timeZoneProvider.getTimeZone(); | ||
} | ||
|
||
@Override | ||
public boolean supportsThingType(ThingTypeUID thingTypeUID) { | ||
return SUPPORTED_THING_TYPES_UIDS.contains(thingTypeUID); | ||
} | ||
|
||
@Override | ||
protected @Nullable ThingHandler createHandler(Thing thing) { | ||
ThingTypeUID thingTypeUID = thing.getThingTypeUID(); | ||
if (thingTypeUID.equals(BRIDGE_TYPE_API)) { | ||
return new ApiHandler((Bridge) thing); | ||
} else if (thingTypeUID.equals(THING_TYPE_REVOLUTION)) { | ||
return new RevolutionHandler(thing, zoneId); | ||
} else if (thingTypeUID.equals(THING_TYPE_DELTA)) { | ||
return new ServerHandler(thing, zoneId); | ||
} else if (thingTypeUID.equals(THING_TYPE_PLAYER)) { | ||
return new PlayerHandler(thing, zoneId, audioHTTPServer, networkAddressService, bundleContext); | ||
} else if (thingTypeUID.equals(THING_TYPE_HOST)) { | ||
return new HostHandler(thing, zoneId); | ||
} else if (thingTypeUID.equals(THING_TYPE_WIFI_HOST)) { | ||
return new WifiHostHandler(thing, zoneId); | ||
} else if (thingTypeUID.equals(THING_TYPE_LANDLINE)) { | ||
return new LandlineHandler(thing, zoneId); | ||
} else if (thingTypeUID.equals(THING_TYPE_VM)) { | ||
return new VmHandler(thing, zoneId); | ||
} else if (thingTypeUID.equals(THING_TYPE_REPEATER)) { | ||
return new RepeaterHandler(thing, zoneId); | ||
} | ||
return null; | ||
} | ||
} |
59 changes: 59 additions & 0 deletions
59
...ng.freeboxos/src/main/java/org/openhab/binding/freeboxos/internal/action/HostActions.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,59 @@ | ||
/** | ||
* Copyright (c) 2010-2020 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.freeboxos.internal.action; | ||
|
||
import org.eclipse.jdt.annotation.NonNullByDefault; | ||
import org.eclipse.jdt.annotation.Nullable; | ||
import org.openhab.binding.freeboxos.internal.handler.HostHandler; | ||
import org.openhab.core.automation.annotation.RuleAction; | ||
import org.openhab.core.thing.binding.ThingActions; | ||
import org.openhab.core.thing.binding.ThingActionsScope; | ||
import org.openhab.core.thing.binding.ThingHandler; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
/** | ||
* The {HostActions} class is responsible to call corresponding | ||
* actions on a given lan host | ||
* | ||
* @author Gaël L'hopital - Initial contribution | ||
*/ | ||
@ThingActionsScope(name = "freeboxos") | ||
@NonNullByDefault | ||
public class HostActions implements ThingActions { | ||
private final Logger logger = LoggerFactory.getLogger(HostActions.class); | ||
private @Nullable HostHandler handler; | ||
|
||
@Override | ||
public void setThingHandler(@Nullable ThingHandler handler) { | ||
if (handler instanceof HostHandler) { | ||
this.handler = (HostHandler) handler; | ||
} | ||
} | ||
|
||
@Override | ||
public @Nullable ThingHandler getThingHandler() { | ||
return this.handler; | ||
} | ||
|
||
@RuleAction(label = "wol host", description = "Awakes a lan host") | ||
public void wol() { | ||
logger.debug("Host WOL called"); | ||
HostHandler hostHandler = this.handler; | ||
if (hostHandler != null) { | ||
hostHandler.wol(); | ||
} else { | ||
logger.warn("LanHost Action service ThingHandler is null!"); | ||
} | ||
} | ||
} |
Oops, something went wrong.