Skip to content

Commit

Permalink
[Freeboxos] New binding alternative to Freebox binding (openhab#12342)
Browse files Browse the repository at this point in the history
* SAT warnings handling

Signed-off-by: clinique <[email protected]>

* Correcting potential NPE

Signed-off-by: clinique <[email protected]>

* Correcting a NPE on error

Signed-off-by: clinique <[email protected]>

* Active player request falls to incorrect API version

Signed-off-by: clinique <[email protected]>

* Reintroducing missing capability to send keys to player.
Solving an NPE

Signed-off-by: clinique <[email protected]>

* Handling DUTY CYCLE more gracefully

Signed-off-by: clinique <[email protected]>

* Enhancing DUTY CYCLE

Signed-off-by: clinique <[email protected]>

* Moving to SNAPSHOT 3.4

Signed-off-by: clinique <[email protected]>

* Adress inconsistencies in binding name

Signed-off-by: clinique <[email protected]>

* Discover Freebox Delta Home equipments(basic_shutter)

* Clean previous test code

* Fix "Unexpected command"

* Fix thing comm error

* README for basic shutter

* Fix MR discusions and solve maven check errors and warnings

* Fix MR discusions

* Fix README.md

* Enhancing logging to indentify source of erratic warn

Signed-off-by: clinique <[email protected]>

* Deny polling a device data when its API is needed and it is OFFLINE

Signed-off-by: clinique <[email protected]>

* Taking openhab#11833 in accound

Signed-off-by: clinique <[email protected]>

* Switching to Snapshot 4.0.0
Correcting apiDomain was not used as expected
Code cleansing.

Signed-off-by: clinique <[email protected]>

* Implementing SHUTTER Home Node

Signed-off-by: clinique <[email protected]>

* Saving work before instroduction of ArrayListDeserializer

Signed-off-by: clinique <[email protected]>

* Enhanced deserialization to simplify code

Signed-off-by: clinique <[email protected]>

* Switching to Java 17 records

Signed-off-by: clinique <[email protected]>

* Switching to addons.xml, headers updated

Signed-off-by: clinique <[email protected]>

* Correcting two errors.

Signed-off-by: clinique <[email protected]>

* Enhance usage of global variables

Signed-off-by: clinique <[email protected]>

* Some code enhancement for base classes

Signed-off-by: clinique <[email protected]>

* solving SAT issues

Signed-off-by: clinique <[email protected]>

* Adding IliadBox compatibility

Signed-off-by: clinique <[email protected]>

* Commiting work

Signed-off-by: clinique <[email protected]>

* Saving work

Signed-off-by: clinique <[email protected]>

* Rebooting Home Node part

Signed-off-by: clinique <[email protected]>

* Spotless apply

Signed-off-by: clinique <[email protected]>

* Adding i18n

Signed-off-by: clinique <[email protected]>

* Decreasing websocket logging level

Signed-off-by: clinique <[email protected]>

* SAT warnings handling

Signed-off-by: clinique <[email protected]>

* Correcting potential NPE

Signed-off-by: clinique <[email protected]>

* Correcting a NPE on error

Signed-off-by: clinique <[email protected]>

* Active player request falls to incorrect API version

Signed-off-by: clinique <[email protected]>

* Reintroducing missing capability to send keys to player.
Solving an NPE

Signed-off-by: clinique <[email protected]>

* Handling DUTY CYCLE more gracefully

Signed-off-by: clinique <[email protected]>

* Enhancing DUTY CYCLE

Signed-off-by: clinique <[email protected]>

* Moving to SNAPSHOT 3.4

Signed-off-by: clinique <[email protected]>

* Adress inconsistencies in binding name

Signed-off-by: clinique <[email protected]>

* Discover Freebox Delta Home equipments(basic_shutter)

* Clean previous test code

* Fix "Unexpected command"

* Fix thing comm error

* README for basic shutter

* Fix MR discusions and solve maven check errors and warnings

* Fix MR discusions

* Fix README.md

* Enhancing logging to indentify source of erratic warn

Signed-off-by: clinique <[email protected]>

* Deny polling a device data when its API is needed and it is OFFLINE

Signed-off-by: clinique <[email protected]>

* Taking openhab#11833 in accound

Signed-off-by: clinique <[email protected]>

* Switching to Snapshot 4.0.0
Correcting apiDomain was not used as expected
Code cleansing.

Signed-off-by: clinique <[email protected]>

* Implementing SHUTTER Home Node

Signed-off-by: clinique <[email protected]>

* Saving work before instroduction of ArrayListDeserializer

Signed-off-by: clinique <[email protected]>

* Enhanced deserialization to simplify code

Signed-off-by: clinique <[email protected]>

* Switching to Java 17 records

Signed-off-by: clinique <[email protected]>

* Switching to addons.xml, headers updated

Signed-off-by: clinique <[email protected]>

* Correcting two errors.

Signed-off-by: clinique <[email protected]>

* Enhance usage of global variables

Signed-off-by: clinique <[email protected]>

* Some code enhancement for base classes

Signed-off-by: clinique <[email protected]>

* solving SAT issues

Signed-off-by: clinique <[email protected]>

* Adding IliadBox compatibility

Signed-off-by: clinique <[email protected]>

* Commiting work

Signed-off-by: clinique <[email protected]>

* Saving work

Signed-off-by: clinique <[email protected]>

* Rebooting Home Node part

Signed-off-by: clinique <[email protected]>

* Spotless apply

Signed-off-by: clinique <[email protected]>

* Enhancing SAT report

Signed-off-by: clinique <[email protected]>

* I think that mvn spotless:apply has a problem with records - trying once again

Signed-off-by: clinique <[email protected]>

* Avoid requesting detailed information for a shutdown repeater.

Signed-off-by: clinique <[email protected]>

* Switched fan speed to RPM unit

Signed-off-by: clinique <[email protected]>

* Correcting SAT

Signed-off-by: clinique <[email protected]>

* Correcting SAT

Signed-off-by: clinique <[email protected]>

* Divergence between eclipse and mvn spotless:apply

Signed-off-by: clinique <[email protected]>

* YASAT

Signed-off-by: clinique <[email protected]>

* Corrections following fwolter code review

Signed-off-by: clinique <[email protected]>

* Pleasing SAT

Signed-off-by: clinique <[email protected]>

* Second fwolter code review

Signed-off-by: clinique <[email protected]>

* Porting modifications introduced in PR openhab#15121

Signed-off-by: clinique <[email protected]>

* Removing redundant null checks.

Signed-off-by: clinique <[email protected]>

* Rebased.

Signed-off-by: clinique <[email protected]>

* Trying to remove the last sleep.

Signed-off-by: clinique <[email protected]>

* Reporting modifications of PR openhab#15121

Signed-off-by: clinique <[email protected]>

* Reverting to working and cleaner granting process

Signed-off-by: clinique <[email protected]>

* Removing last Thread:Sleep

Signed-off-by: clinique <[email protected]>

* spotless:apply

Signed-off-by: clinique <[email protected]>

---------

Signed-off-by: clinique <[email protected]>
Co-authored-by: ben.12 <[email protected]>
Signed-off-by: Matt Myers <[email protected]>
  • Loading branch information
2 people authored and matchews committed Aug 9, 2023
1 parent e49fd6d commit 9523164
Show file tree
Hide file tree
Showing 118 changed files with 9,648 additions and 0 deletions.
1 change: 1 addition & 0 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@
/bundles/org.openhab.binding.folding/ @fa2k
/bundles/org.openhab.binding.foobot/ @airboxlab @Hilbrand
/bundles/org.openhab.binding.freebox/ @lolodomo
/bundles/org.openhab.binding.freeboxos/ @clinique
/bundles/org.openhab.binding.fronius/ @trokohl
/bundles/org.openhab.binding.fsinternetradio/ @paphko
/bundles/org.openhab.binding.ftpupload/ @paulianttila
Expand Down
5 changes: 5 additions & 0 deletions bom/openhab-addons/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -551,6 +551,11 @@
<artifactId>org.openhab.binding.freebox</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.openhab.addons.bundles</groupId>
<artifactId>org.openhab.binding.freeboxos</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.openhab.addons.bundles</groupId>
<artifactId>org.openhab.binding.fronius</artifactId>
Expand Down
20 changes: 20 additions & 0 deletions bundles/org.openhab.binding.freeboxos/NOTICE
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
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

== Third-party Content

IPAddress: Java library for handling IP addresses and subnets, both IPv4 and IPv6
* License: Apache License 2.0
* Project: https://github.com/seancfoley/IPAddress
* Source: https://github.com/seancfoley/IPAddress
210 changes: 210 additions & 0 deletions bundles/org.openhab.binding.freeboxos/README.md

Large diffs are not rendered by default.

30 changes: 30 additions & 0 deletions bundles/org.openhab.binding.freeboxos/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?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 https://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>4.0.0-SNAPSHOT</version>
</parent>

<artifactId>org.openhab.binding.freeboxos</artifactId>

<name>openHAB Add-ons :: Bundles :: FreeboxOS Binding</name>

<dependencies>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.10.1</version>
</dependency>
<dependency>
<groupId>com.github.seancfoley</groupId>
<artifactId>ipaddress</artifactId>
<version>5.4.0</version>
</dependency>
</dependencies>

</project>
10 changes: 10 additions & 0 deletions bundles/org.openhab.binding.freeboxos/src/main/feature/feature.xml
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>
Original file line number Diff line number Diff line change
@@ -0,0 +1,176 @@
/**
* 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.freeboxos.internal;

import java.util.Set;
import java.util.stream.Collectors;
import java.util.stream.Stream;

import org.eclipse.jdt.annotation.NonNullByDefault;
import org.openhab.binding.freeboxos.internal.api.rest.HomeManager.Category;
import org.openhab.core.library.types.OnOffType;
import org.openhab.core.library.types.OpenClosedType;
import org.openhab.core.library.types.UpDownType;
import org.openhab.core.thing.ThingTypeUID;
import org.openhab.core.types.Command;

/**
* The {@link FreeboxBinding} class defines common constants, which are used across the 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");

// Thing Types ID strings
private static final String THING_DECT = "dect";
private static final String THING_FXS = "fxs";
private static final String THING_REVOLUTION = "revolution";
private static final String THING_DELTA = "delta";
private static final String THING_WIFI_HOST = "wifihost";
private static final String THING_ACTIVE_PLAYER = "active-player";

public static final String THING_FREEPLUG = "freeplug";
public static final String THING_VM = "vm";
public static final String THING_CALL = "call";
public static final String THING_HOST = "host";
public static final String THING_PLAYER = "player";
public static final String THING_REPEATER = "repeater";

// List of all Thing Type UIDs
public static final ThingTypeUID THING_TYPE_REVOLUTION = new ThingTypeUID(BINDING_ID, THING_REVOLUTION);
public static final ThingTypeUID THING_TYPE_DELTA = new ThingTypeUID(BINDING_ID, THING_DELTA);
public static final ThingTypeUID THING_TYPE_FXS = new ThingTypeUID(BINDING_ID, THING_FXS);
public static final ThingTypeUID THING_TYPE_DECT = new ThingTypeUID(BINDING_ID, THING_DECT);
public static final ThingTypeUID THING_TYPE_CALL = new ThingTypeUID(BINDING_ID, THING_CALL);
public static final ThingTypeUID THING_TYPE_FREEPLUG = new ThingTypeUID(BINDING_ID, THING_FREEPLUG);
public static final ThingTypeUID THING_TYPE_HOST = new ThingTypeUID(BINDING_ID, THING_HOST);
public static final ThingTypeUID THING_TYPE_WIFI_HOST = new ThingTypeUID(BINDING_ID, THING_WIFI_HOST);
public static final ThingTypeUID THING_TYPE_PLAYER = new ThingTypeUID(BINDING_ID, THING_PLAYER);
public static final ThingTypeUID THING_TYPE_ACTIVE_PLAYER = new ThingTypeUID(BINDING_ID, THING_ACTIVE_PLAYER);
public static final ThingTypeUID THING_TYPE_VM = new ThingTypeUID(BINDING_ID, THING_VM);
public static final ThingTypeUID THING_TYPE_REPEATER = new ThingTypeUID(BINDING_ID, THING_REPEATER);

// All supported Thing types
public static final Set<ThingTypeUID> BRIDGE_TYPE_UIDS = Set.of(BRIDGE_TYPE_API);
public static final Set<ThingTypeUID> THINGS_TYPES_UIDS = Set.of(THING_TYPE_FXS, THING_TYPE_DECT, THING_TYPE_CALL,
THING_TYPE_HOST, THING_TYPE_VM, THING_TYPE_PLAYER, THING_TYPE_ACTIVE_PLAYER, THING_TYPE_DELTA,
THING_TYPE_REVOLUTION, THING_TYPE_REPEATER, THING_TYPE_WIFI_HOST, THING_TYPE_FREEPLUG);
public static final Set<ThingTypeUID> HOME_TYPES_UIDS = Set.of(Category.BASIC_SHUTTER.getThingTypeUID(),
Category.SHUTTER.getThingTypeUID(), Category.KFB.getThingTypeUID(), Category.CAMERA.getThingTypeUID(),
Category.ALARM.getThingTypeUID());

protected static final Set<ThingTypeUID> SUPPORTED_THING_TYPES_UIDS = Stream
.of(BRIDGE_TYPE_UIDS, THINGS_TYPES_UIDS, HOME_TYPES_UIDS).flatMap(Set::stream).collect(Collectors.toSet());

// Thing properties
// public static final String LAST_CALL_TIMESTAMP = "lastCallTimestamp";
public static final String ROLE = "role";
public static final String NET_ID = "netId";
public static final String ETHERNET_SPEED = "ethernetSpeed";
public static final String LOCAL = "local";
public static final String FULL_DUPLEX = "fullDuplex";

// List of all Group Channel ids
public static final String GROUP_SENSORS = "sensors";
public static final String GROUP_FANS = "fans";
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 FILE_SHARING = "file-sharing";
public static final String CONNECTIVITY = "connectivity";
public static final String DISPLAY = "display";
public static final String VM_STATUS = "vmstatus";
public static final String GROUP_WIFI = "wifi";
public static final String REPEATER_MISC = "repeater-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 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 IPV6_ADDRESS = "ipv6-address";
public static final String LINE_STATUS = "line-status";
public static final String LINE_TYPE = "line-type";
public static final String LINE_MEDIA = "line-media";
public static final String PLAYER_STATUS = "player-status";
public static final String PACKAGE = "package";
public static final String RATE = "rate";
public static final String BYTES_UP = "bytes-up";
public static final String BYTES_DOWN = "bytes-down";
public static final String BW = "bandwidth";
public static final String PCT_BW = "bandwidth-usage";
public static final String ONHOOK = "onhook";
public static final String RINGING = "ringing";
public static final String HARDWARE_STATUS = "hardware-status";
public static final String TELEPHONY_SERVICE = "telephony-service";
public static final String GAIN_RX = "gain-rx";
public static final String GAIN_TX = "gain-tx";
public static final String FTP_STATUS = "ftp-status";
public static final String SAMBA_FILE_STATUS = "samba-file-status";
public static final String SAMBA_PRINTER_STATUS = "samba-printer-status";
public static final String AFP_FILE_STATUS = "afp-file-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";
public static final String UPNPAV_STATUS = "upnpav-status";

// Call channels for groups Accepted, Missed and Outgoing
public static final String NUMBER = "number";
public static final String DURATION = "duration";
public static final String TIMESTAMP = "timestamp";
public static final String NAME = "name";

// Freebox player channels
public static final String AIRMEDIA_STATUS = "airmedia-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";

// Home channels
public static final String KEYFOB_ENABLE = "enable";
public static final String NODE_BATTERY = "battery";
public static final String SHUTTER_POSITION = "position-set";
public static final String SHUTTER_STOP = "stop";
public static final String BASIC_SHUTTER_STATE = "state";
public static final String BASIC_SHUTTER_UP = "up";
public static final String BASIC_SHUTTER_DOWN = "down";
// public static final String BASIC_SHUTTER_CMD = "basic-shutter";
public static final String ALARM_PIN = "pin";
public static final String ALARM_SOUND = "sound";
public static final String ALARM_VOLUME = "volume";
public static final String ALARM_TIMEOUT1 = "timeout1";
public static final String ALARM_TIMEOUT2 = "timeout2";
public static final String ALARM_TIMEOUT3 = "timeout3";

public static final Set<Command> TRUE_COMMANDS = Set.of(OnOffType.ON, UpDownType.UP, OpenClosedType.OPEN);
public static final Set<Class<?>> ON_OFF_CLASSES = Set.of(OnOffType.class, UpDownType.class, OpenClosedType.class);
}
Loading

0 comments on commit 9523164

Please sign in to comment.