Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[freeathome] Initial contribution #13703

Merged
merged 178 commits into from
Apr 20, 2024
Merged
Show file tree
Hide file tree
Changes from 173 commits
Commits
Show all changes
178 commits
Select commit Hold shift + click to select a range
6dcb05a
[hydrawise] Handle API auth changes (#16221)
digitaldan Jan 7, 2024
7c38629
Signed-off-by: Andras Uhrin <[email protected]>
andrasU Nov 30, 2021
5e26994
Update pom.xml
andrasU Nov 30, 2021
8f0c9e9
Review fixes
andrasU Feb 5, 2022
a87c553
Refactoring to dynamic channel creation
andrasU Nov 12, 2022
c2ef02b
Delete configuration class
andrasU Nov 12, 2022
b5a4cfa
Added general localisation
andrasU Nov 19, 2022
9866253
Fixes for localisation files
andrasU Nov 19, 2022
402b0f5
Patches for compilation
andrasU Nov 20, 2022
5e2989b
Revert "Patches for compilation"
andrasU Nov 21, 2022
f195293
Revert "Fixes for localisation files"
andrasU Nov 21, 2022
bcfbec2
Fixes for localisation
andrasU Nov 22, 2022
9683fe7
Initial contribution
andrasU Nov 22, 2022
d046ec9
Static code analysis fix
andrasU Nov 23, 2022
48e0fa3
Review fixes
andrasU Dec 3, 2022
242a843
Remove unused files
andrasU Dec 3, 2022
5801952
Removed unused files and bug fixing
andrasU Dec 4, 2022
2f0f1a1
Optimization state conversion
andrasU Dec 5, 2022
51cfedf
Upgrade commons-net to 3.9.0 (#13869)
wborn Dec 8, 2022
c62da92
Merge to 4.0.0 development
andrasU Dec 23, 2022
2dd9e5a
Update bundles/org.openhab.binding.freeathomesystem/pom.xml
andrasU Dec 23, 2022
b7773da
Revert "Update bundles/org.openhab.binding.freeathomesystem/pom.xml "
andrasU Dec 23, 2022
3423d6e
Migration due to #11833
andrasU Dec 23, 2022
6a841d8
Activating sensor handler and minor changes from trace to debug logger
andrasU Dec 23, 2022
97f37ce
Changes for a stable websocket communication
andrasU Dec 29, 2022
cf5b443
Update license headers to 2023
andrasU Jan 6, 2023
83d0c44
Fixed restart feature of websocket
andrasU Jan 12, 2023
505735c
Update to addon.xml
andrasU Feb 1, 2023
f95b87f
Bugfix addon.xml
andrasU Feb 1, 2023
da7e196
Updates - new virtual devices and flex components
andrasU Feb 11, 2023
1cd0b31
Review fixes
andrasU Jun 25, 2023
37a8f43
Revert "Review fixes"
andrasU Jun 25, 2023
15bd4d6
Review fixes
andrasU Jul 9, 2023
41f3f71
Review fixes
andrasU Jul 9, 2023
57aa834
Review fixes
andrasU Jul 30, 2023
0026924
Review fixes and initial ThingHandlerService implementation
andrasU Jul 31, 2023
66f610b
Review fixes
andrasU Aug 13, 2023
2d7e27a
Review fixes
andrasU Aug 13, 2023
0b55081
Review fixes
andrasU Aug 13, 2023
423a19a
Improvements and Review fixes
andrasU Dec 17, 2023
ffb101f
Improvements according review finding
andrasU Dec 22, 2023
a4179cd
Take over suggestion
andrasU Dec 28, 2023
417f541
Take over suggestion
andrasU Dec 28, 2023
ce64ebc
Take over suggestion
andrasU Dec 28, 2023
9845cdd
Take over suggestion
andrasU Dec 28, 2023
bad226b
Take over suggestion
andrasU Dec 28, 2023
666fc38
Apply suggestions from code review
andrasU Dec 28, 2023
a492dc4
Update bundles/org.openhab.binding.freeathomesystem/src/main/java/org…
andrasU Dec 28, 2023
4e71950
Update bundles/org.openhab.binding.freeathomesystem/src/main/java/org…
andrasU Dec 28, 2023
5755db8
Apply suggestions from code review
andrasU Dec 28, 2023
8aa75ca
Apply suggestions from code review
andrasU Dec 28, 2023
d27a10a
Apply suggestions from code review
andrasU Dec 28, 2023
efc338a
Apply suggestions from code review
andrasU Dec 28, 2023
20245ad
Apply batch change from code review
andrasU Dec 28, 2023
65dc9e8
Apply batch change from code review
andrasU Dec 29, 2023
1cff350
Apply change from code review
andrasU Dec 29, 2023
ae312bf
Apply suggestions from code review
andrasU Dec 30, 2023
800b954
Apply change from code review
andrasU Jan 1, 2024
6e412de
Remove suppress warning
andrasU Jan 1, 2024
b908e60
Apply change from code review
andrasU Jan 1, 2024
837e60b
License text update to 2024
andrasU Jan 6, 2024
62cf6f3
Fix Pull-Request History
andrasU Jan 7, 2024
4606567
[pilight] Various minor code improvements (#16227)
stefanroellin Jan 8, 2024
e5e5d35
[mqtt] recognize -NaN as UNDEF as well (#16245)
ccutrer Jan 8, 2024
6e204b1
[tellstick] Add support for suggestion finder (#16228)
andrewfg Jan 8, 2024
015f29a
[roku] Improve TV discovery model name and add timeout (#16210)
mlobstein Jan 8, 2024
20038ab
Use diamond operator and remove redundant type arguments (#16249)
wborn Jan 9, 2024
dfa4249
Use localized labels for discovery results (#16250)
jlaur Jan 9, 2024
bfe5b08
New translations miele.properties (Danish) (#16253)
openhab-bot Jan 10, 2024
44b2065
[network] Cleanup code (#16235)
wborn Jan 11, 2024
e01390a
Add TrueHD71 (#16261)
morph166955 Jan 12, 2024
e708f4a
Fix removal of discovery results (#16232)
jlaur Jan 12, 2024
81faf85
[androidtv] Fixes Bugs and Prepares for PhilipsTV (#16191)
morph166955 Jan 12, 2024
4647b5e
New translations sonos.properties (Italian) (#16265)
openhab-bot Jan 12, 2024
5c3ef75
Fix exception handling for InfluxDB 1.x (#16234)
jlaur Jan 13, 2024
ee6620b
Apply suggestions from code review
andrasU Jan 21, 2024
577f275
Apply review suggestions
andrasU Jan 21, 2024
67cad60
Resolve conflicts
andrasU Jan 21, 2024
8347be9
Refactor java.util.Date usages to java.time.Instant (#16239)
jlaur Jan 13, 2024
9294fe8
Remove obsoleted advanced channel hourly-prices (#16190)
jlaur Jan 13, 2024
3248cd1
New Crowdin updates (#16272)
openhab-bot Jan 13, 2024
531ed73
Resolve runbundles for Jollyday upgrade (#16267)
wborn Jan 14, 2024
0d7cf80
[androidtv] Resolves discovery issues (#16264)
morph166955 Jan 14, 2024
dc911ef
[dmx] Improve exception handling in refresh job (#16281)
J-N-K Jan 14, 2024
ed1dac8
Small fix when retying token (#16280)
digitaldan Jan 14, 2024
1e283a6
[luxtronik] Add channel for fixed heating return temperature (#16218)
Taxifahrer Jan 14, 2024
3a5a60c
[mqtt.generic] Expose more advanced rollshutter config options (#16051)
ccutrer Jan 14, 2024
1ecf6a0
[yamahareceiver] Fix ChannelTypeProvider (#16278)
J-N-K Jan 14, 2024
8871f91
[http] Improve binding (#16282)
J-N-K Jan 14, 2024
fb197a9
[MAP] Minor corrections in README (#16286)
jimtng Jan 15, 2024
c4ca34f
[tibber] Add time series support for Tibber prices (#16275)
soenkekueper Jan 15, 2024
bc12e25
Adjust command handling (#16159)
EvilPingu Jan 15, 2024
7fa84ac
New translations mqtt.properties (Italian) (#16287)
openhab-bot Jan 15, 2024
8e13c6f
Adds additional default apps to appdb (#16290)
morph166955 Jan 15, 2024
a768e95
Update tariff filter for NOE Net (#16283)
jlaur Jan 15, 2024
4a22488
[boschshc] Cache mDNS-based bridge discovery results (#16211)
david-pace Jan 15, 2024
df324d9
[network] Add configuration parameter for using iOS wake-up (#16259)
lsiepel Jan 15, 2024
d0945ea
[freecurrency] Initial contribution (#16194)
J-N-K Jan 15, 2024
373d859
New translations freecurrency.properties (Italian) (#16295)
openhab-bot Jan 16, 2024
75c48ac
New translations freecurrency.properties (Danish) (#16296)
openhab-bot Jan 16, 2024
216d52f
[vizio] Prevent thing status from bouncing offline (#16291)
mlobstein Jan 17, 2024
2adb2c8
[influxdb] Add compatibility with InfluxDB Cloud Serverless (#16151)
PLeusmann Jan 17, 2024
c9ad291
[doorbird] Add support for version 2 encryption scheme (#16297)
mhilbush Jan 17, 2024
4521264
[http] Fix refresh time check and calculation (#16288)
J-N-K Jan 17, 2024
a65028d
Fix stack overflow when an unknown CoAP Id is detected; Fix innerTemp…
markus7017 Jan 18, 2024
4e5305b
Readme updates for Nanoleaf and Govee (#16292)
stefan-hoehn Jan 18, 2024
54770c6
[boschshc] Support for Universal Switch I + II (#16274)
david-pace Jan 18, 2024
f912174
make blu gw script more rebust on startup (#16304)
markus7017 Jan 19, 2024
af0237e
[yamahamusiccast] Add discovery information (#16231)
florian-h05 Jan 19, 2024
2ee23e5
[shelly] improved logging on WebSocket connection problems (#16303)
markus7017 Jan 19, 2024
60da9a0
[growatt] Binding for Growatt solar inverters (#15120)
andrewfg Jan 20, 2024
9f444af
reconnect without loosing commands on broken idle connection (#16299)
christianwicke Jan 20, 2024
49ecedd
Remove unused method
andrasU Jan 21, 2024
c9856a7
[knx] DPT 1 to support Switch and Contact (#16238)
holgerfriedrich Jan 21, 2024
1414c47
Update third party licenses (#16311)
jlaur Jan 22, 2024
e5cb83b
[mqtt.homeassistant] Update config abbreviations (#16246)
ccutrer Jan 22, 2024
86ec96a
[mqtt.homeassistant] Trigger HA devices to update discovery informati…
ccutrer Jan 22, 2024
bca6631
[knx] Allow receiving DPT 235.001 (#16094)
holgerfriedrich Jan 22, 2024
5451007
Update README.md (#16309)
roednix Jan 22, 2024
c6d5edf
Apply suggestions from code review
andrasU Jan 25, 2024
f60200c
Update tariff filter for Ikast El Net (#16317)
jlaur Jan 23, 2024
ea65e44
New translations mqtt.properties (Italian) (#16320)
openhab-bot Jan 24, 2024
28ce6e7
[openwebnet] fixed 2 dotted links in README (#16326)
mvalla Jan 26, 2024
85b17e1
Remove sentence no longer valid (#16327)
olivierkeke Jan 26, 2024
438b6dc
[ipcamera] Add white LED controls for Dahua and also Email and Push f…
Skinah Jan 26, 2024
4a40a48
[knx] Add support for RGBW represented by HSBType (#16078)
holgerfriedrich Jan 26, 2024
a5ee4c0
Apply suggestions from code review
andrasU Jan 26, 2024
1826b81
Changes based on review comments
andrasU Jan 27, 2024
2acce9a
Merge branch 'openhab:main' into freeathomesystemupdate
andrasU Jan 27, 2024
d1159cc
Merge branch 'openhab:main' into freeathomesystemupdate
andrasU Jan 28, 2024
2cbfe45
Merge branch 'openhab:main' into freeathomesystemupdate
andrasU Feb 2, 2024
c5dba38
Changes based on review comments
andrasU Feb 2, 2024
5001368
Changes based on review comments
andrasU Feb 3, 2024
394950c
Merge branch 'openhab:main' into freeathomesystemupdate
andrasU Feb 4, 2024
f058905
Merge branch 'openhab:main' into freeathomesystemupdate
andrasU Feb 4, 2024
c6c6e3e
Change constants to enum
andrasU Feb 4, 2024
79e865c
Merge branch 'openhab:main' into freeathomesystemupdate
andrasU Feb 5, 2024
3998df4
Merge branch 'openhab:main' into freeathomesystemupdate
andrasU Feb 11, 2024
ee434bd
Apply suggestions from code review
andrasU Feb 11, 2024
b599955
Apply suggestions from code review
andrasU Feb 11, 2024
c3462bb
Apply suggestions from code review
andrasU Feb 11, 2024
c7a3ab7
Merge branch 'openhab:main' into freeathomesystemupdate
andrasU Feb 13, 2024
4bbd057
Add localisation support
andrasU Feb 13, 2024
8b1eae6
Merge branch 'openhab:main' into freeathomesystemupdate
andrasU Feb 19, 2024
ca2362b
Restructure httpClient management
andrasU Feb 19, 2024
1f19aed
Apply suggestions from code review
andrasU Feb 20, 2024
03d6ed4
Update based on review comments
andrasU Feb 20, 2024
31e7542
Update based on review comments
andrasU Feb 20, 2024
2a69235
Apply suggestions from code review
andrasU Feb 21, 2024
d45c0f7
Merge branch 'openhab:main' into freeathomesystemupdate
andrasU Feb 21, 2024
a4e5596
Update based on review comments
andrasU Feb 21, 2024
20125b3
Update based on review comments
andrasU Feb 21, 2024
b60cc3a
Static map creation simplified
andrasU Feb 21, 2024
7f968fd
Apply suggestions from code review
andrasU Feb 21, 2024
f238899
SAT warrning removal
andrasU Feb 21, 2024
10c8967
Merge branch 'openhab:main' into freeathomesystemupdate
andrasU Mar 3, 2024
b993c80
Apply suggestions from code review
andrasU Mar 3, 2024
12d9e42
Apply suggestions from code review
andrasU Mar 3, 2024
350e9b0
Merge branch 'openhab:main' into freeathomesystemupdate
andrasU Mar 3, 2024
b9951dc
Apply suggestions from code review
andrasU Mar 3, 2024
8e9938f
Merge branch 'openhab:main' into freeathomesystemupdate
andrasU Mar 8, 2024
a6e58e0
Unused logger entry is removed
andrasU Mar 8, 2024
34f66dc
Apply fixes based on review comments
andrasU Mar 10, 2024
ff06841
Apply suggestions from code review
andrasU Mar 16, 2024
95d1836
Merge branch 'openhab:main' into freeathomesystemupdate
andrasU Mar 16, 2024
425fab5
Merge branch 'openhab:main' into freeathomesystemupdate
andrasU Mar 17, 2024
a99fb8c
Apply review changes
andrasU Mar 17, 2024
d222b60
Touch files to re-trigger the build
andrasU Mar 17, 2024
ce27067
Merge branch 'openhab:main' into freeathomesystemupdate
andrasU Mar 19, 2024
fb8453a
Apply suggestions from code review
andrasU Apr 7, 2024
761ab19
Merge branch 'openhab:main' into freeathomesystemupdate
andrasU Apr 7, 2024
ee753c7
Apply suggestions from code review
andrasU Apr 9, 2024
e64e193
Apply suggestions from code review
andrasU Apr 9, 2024
7239d8b
Merge branch 'openhab:main' into freeathomesystemupdate
andrasU Apr 20, 2024
7ebab0b
Minor changes in examples
andrasU Apr 20, 2024
942a41f
Apply suggestions from code review
andrasU Apr 20, 2024
2204f32
Merge branch 'openhab:main' into freeathomesystemupdate
andrasU Apr 20, 2024
1fa972a
Apply suggestions from code review
andrasU Apr 20, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@
/bundles/org.openhab.binding.folderwatcher/ @goopilot
/bundles/org.openhab.binding.folding/ @fa2k
/bundles/org.openhab.binding.foobot/ @airboxlab @Hilbrand
/bundles/org.openhab.binding.freeathomesystem/ @andrasU
/bundles/org.openhab.binding.freebox/ @lolodomo
/bundles/org.openhab.binding.freeboxos/ @clinique
/bundles/org.openhab.binding.freecurrency/ @J-N-K
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 @@ -561,6 +561,11 @@
<artifactId>org.openhab.binding.foobot</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.openhab.addons.bundles</groupId>
<artifactId>org.openhab.binding.freeathomesystem</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.openhab.addons.bundles</groupId>
<artifactId>org.openhab.binding.freebox</artifactId>
Expand Down
13 changes: 13 additions & 0 deletions bundles/org.openhab.binding.freeathomesystem/NOTICE
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
147 changes: 147 additions & 0 deletions bundles/org.openhab.binding.freeathomesystem/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
# ABB/Busch-free@home Smart Home binding

openHAB ABB/Busch-free@home binding based on the offical free@home local API.

# Description

This binding allows you to connect your free@home Smart Home system from ABB / Busch-Jaeger to openHAB and to control and observe most of the components.
It requires a System Access Point with version 2.6.1 or higher.

# Supported Devices

**Network Gateway / System Access Point**

- ABB / Busch-Jaeger System Access Point 2.0

**Sensors and Actuators**

- Switch Actuator Sensor with single and multiple channels (wired and wireless)
- Dimming Actuator Sensor with single and multiple channels (wired, wireless and flex)
- Motion detection with and without actuator (wired, wireless and flex)
- Switch Actuator 4-channel
- Dimming Actuator 4- and 6-channel
- Door opener actuator
- Door ring sensor
- Hue devices (untested)

**Blinds and Windows**

- Shutter Actuator with single and multiple channels (wired and wireless)
- Blind Actuator with single and multiple channels (wired and wireless)
- Attic window actuator
- Awning actuator

**Room Temperature Control**

- Room temperature controller master without fan
- Room temperature controller master with fan
- Room temperature controller slave

**Other devices** (e.g. movement detector, ring sensor and door opener)

- IP-touch panel (function: door opener, door ring sensor)
- Virtual devices (e.g. virtual switch, RTC and detectors)

**Information about virtual devices**
Virtual device in the free@home smart-home system needs continuous keep-alive signal otherwise the free@home device is marked as unresponsive.
This keep-alive signal must be provided by a user script or set the TTL value of the virtual device to "-1" during the creation of the virtual device.

# Tested SysAP Versions

| Version | Supported |
|---------|-----------|
| 2.6.1 | yes |
| 2.6.3 | yes |
| 3.1.1 | yes |

# Setup / Installation

## Prerequisites

To make use of this Binding first the local free@home API has to be activated.
The API is disabled by default.

1. Open the free@home next app
1. Browse to "Settings ⇨ free@home settings ⇨ local API and activate the checkbox

## Setup and Discovery

The free@home bridge shall be added manually.
jlaur marked this conversation as resolved.
Show resolved Hide resolved
Once it is added as a Thing with correct credentials, the scan of free@home devices will be possible.

## free@home components as openHAB Things

The ABB/Busch free@home system is calling its smart home components as free@home devices.
The free@home system devices can have one or multiple channels depending the device's features.
During the scanning process the openHAB binding will detect only the devices IDs.
The device features will be detected at the point in time, when a openHAB Thing is created.
At the of the creation the free@home binding will automatically create the relevant channels without any further configuration.
If a free@home system device has multiple smart-home channels (e.g. 4x DIN/rail Actuator), the newly created Thing will get all relevant channels to operate all actuators existing inside the free@home device.

## Sensors and Actuators of free@home Devices as Things in openHAB

The free@home system supports sensors and actuators.
The connection of sensors and actuators are done on the free@home system dashboard.
If a Thing channel is a free@home device sensor channel, this channel is read only.

## Bridge Configuration

There are several settings for a bridge:

| Parameter | Description |
|--------------------------|-----------------------------------------|
| **ipAddress** (required) | Network address of the free@home SysAP |
| **username** (required) | Valid user name for the free@home SysAP |
| **password** (required) | Password of the user |

## Examples for .things

Things are all discovered automatically and visible on the openHAB UI after pushing the scan button

In order to manually configure a Thing:

```java
Bridge freeathomesystem:bridge:mysysap [ ipAddress="...", username="...", password="..." ]
{
Thing free-at-home-device ABB700997F0A
}
```

The only parameter needed to create a Thing is the free@home device ID, which you can find as sticker on the device.
The creation of the openHAB channels to operate the free@home device is happening automatically based on the device features detected online.

## Examples for .items

Sample for the free@home thermostat device

```java
Number Livingroom_MeasuredTemperature "Measured Temperature" <temperature> (Livingroom) ["Measurement", "Temperature"] { channel="freeathomesystem:thermostat:0836e63805:ABB700CF0FB0_0:thermostatMeasuredTemperature" }
jlaur marked this conversation as resolved.
Show resolved Hide resolved
Number LivingRoom_Thermostat_SetpointTemperature "Setpoint Temperature" <temperature> (Livingroom) ["Setpoint", "Temperature"] { channel="freeathomesystem:thermostat:0836e63805:ABB700CF0FB0_0:thermostatSetpointTemperature" }
Switch LivingRoom_Thermostat_ThermostatActivationOnOff "Thermostat Activation" <switch> (Livingroom) { channel="freeathomesystem:thermostat:0836e63805:ABB700CF0FB0_0:thermostatOnoffSwitch" }
Switch LivingRoom_Thermostat_MainEcoOnOff "Thermostat Eco Activation" <switch> (Livingroom) { channel="freeathomesystem:thermostat:0836e63805:ABB700CF0FB0_0:thermostatEcoSwitch" }
Number LivingRoom_ThermostatHeatingActive "Thermostat Heating Active" <temperature> (Livingroom) ["Status"] { channel="freeathomesystem:thermostat:0836e63805:ABB700CF0FB0_0:thermostatHeatingActive" }
Number LivingRoom_ThermostatHeatingDemand "Thermostat Heating Demand" <temperature> (Livingroom) ["Status"] { channel="freeathomesystem:thermostat:0836e63805:ABB700CF0FB0_0:thermostatHeatingDemand" }
```

Sample for the free@home sensor/actuator 1/1

```java
Switch SwitchMoodlight_Livingroom "Moodlight Livingroom" <switch> (Livingroom) ["Light"] { channel="freeathomesystem:actuator:0836e63805:ABB700D85E0A_0:switchChannel }
```
andrasU marked this conversation as resolved.
Show resolved Hide resolved

andrasU marked this conversation as resolved.
Show resolved Hide resolved
Sample for the free@home sensor/actuator 2/2

```java
Switch Switch_Livingroom_Double_1 "Moodlight Livingroom" <switch> (Livingroom) ["Light"] { channel="freeathomesystem:actuator:0836e63805:ABB700887F0A_0:switchChannel }
Switch Switch_Livingroom_Double_2 "Moodlight Livingroom" <switch> (Livingroom) ["Light"] { channel="freeathomesystem:actuator:0836e63805:ABB700887F0A_1:switchChannel }
```

# Communities

[openHAB community of this binding](https://community.openhab.org/t/abb-busch-jager-free-home-official-rest-api/141698/71)

[Busch-Jaeger Community](https://community.busch-jaeger.de/)

[free@home user group Facebook DE](https://www.facebook.com/groups/738242583015188)

[free@home user group Facebook EN](https://www.facebook.com/groups/452502972031360)
17 changes: 17 additions & 0 deletions bundles/org.openhab.binding.freeathomesystem/pom.xml
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 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.2.0-SNAPSHOT</version>
</parent>

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

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

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<features name="org.openhab.binding.freeathomesystem-${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-freeathomesystem" description="FreeAtHomeSystem Binding" version="${project.version}">
<feature>openhab-runtime-base</feature>
<bundle start-level="80">mvn:org.openhab.addons.bundles/org.openhab.binding.freeathomesystem/${project.version}</bundle>
</feature>
</features>
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/**
* 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.freeathomesystem.internal;

import java.util.Set;

import org.eclipse.jdt.annotation.NonNullByDefault;
import org.openhab.core.thing.ThingTypeUID;

/**
* The {@link FreeAtHomeSystemBindingConstants} class defines common constants, which are
* used across the whole binding.
*
* @author Andras Uhrin - Initial contribution
*/
@NonNullByDefault
public class FreeAtHomeSystemBindingConstants {

public static final String CONFIG_DESCRIPTION_URI_THING_PREFIX = "thing-type";

public static final String BINDING_ID = "freeathomesystem";

// List of all Thing Type UIDs
public static final String BRIDGE_TYPE_ID = "gateway";
public static final String DEVICE_TYPE_ID = "device";

// List of all Thing Type UIDs
public static final ThingTypeUID BRIDGE_TYPE_UID = new ThingTypeUID(BINDING_ID, BRIDGE_TYPE_ID);
public static final ThingTypeUID DEVICE_TYPE_UID = new ThingTypeUID(BINDING_ID, DEVICE_TYPE_ID);

public static final Set<ThingTypeUID> SUPPORTED_THING_TYPES_UIDS = Set.of(BRIDGE_TYPE_UID, DEVICE_TYPE_UID);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
/**
* 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.freeathomesystem.internal;

import java.time.Instant;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;

import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
import org.openhab.binding.freeathomesystem.internal.datamodel.FreeAtHomeDeviceDescription;
import org.openhab.binding.freeathomesystem.internal.handler.FreeAtHomeBridgeHandler;
import org.openhab.binding.freeathomesystem.internal.util.FreeAtHomeHttpCommunicationException;
import org.openhab.core.config.discovery.AbstractThingHandlerDiscoveryService;
import org.openhab.core.config.discovery.DiscoveryResult;
import org.openhab.core.config.discovery.DiscoveryResultBuilder;
import org.openhab.core.thing.ThingTypeUID;
import org.openhab.core.thing.ThingUID;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
* The {@link FreeAtHomeSystemDiscoveryService} is responsible for performing discovery of things
*
* @author Andras Uhrin - Initial contribution
*/
@NonNullByDefault
public class FreeAtHomeSystemDiscoveryService extends AbstractThingHandlerDiscoveryService<FreeAtHomeBridgeHandler> {

private final Logger logger = LoggerFactory.getLogger(FreeAtHomeSystemDiscoveryService.class);
private @Nullable ScheduledFuture<?> backgroundDiscoveryJob = null;

private static final long BACKGROUND_DISCOVERY_DELAY = 1L;
private boolean isScanTerminated;

Runnable runnable = new Runnable() {
@Override
public void run() {
ThingUID bridgeUID = thingHandler.getThing().getUID();

List<String> deviceList;

try {
deviceList = thingHandler.getDeviceDeviceList();

for (int i = 0; (i < deviceList.size()) && !isScanTerminated; i++) {
FreeAtHomeDeviceDescription device = thingHandler.getFreeatHomeDeviceDescription(deviceList.get(i));

ThingUID uid = new ThingUID(FreeAtHomeSystemBindingConstants.DEVICE_TYPE_UID, bridgeUID,
device.deviceId);
Map<String, Object> properties = new HashMap<>(1);
properties.put("deviceId", device.deviceId);
properties.put("interface", device.interfaceType);

String deviceLabel = device.deviceLabel;

DiscoveryResult discoveryResult = DiscoveryResultBuilder.create(uid).withLabel(deviceLabel)
andrasU marked this conversation as resolved.
Show resolved Hide resolved
.withRepresentationProperty("deviceId").withBridge(bridgeUID).withProperties(properties)
.build();

thingDiscovered(discoveryResult);

logger.debug("Thing discovered - DeviceId: {} - Device label: {}", device.getDeviceId(),
device.getDeviceLabel());
}

stopScan();
} catch (FreeAtHomeHttpCommunicationException e) {
logger.debug("Communication error in device discovery with the bridge: {}",
thingHandler.getThing().getLabel());
} catch (RuntimeException e) {
logger.debug("Scanning interrupted");
}
}
};

public FreeAtHomeSystemDiscoveryService(int timeout) {
super(FreeAtHomeBridgeHandler.class, FreeAtHomeSystemBindingConstants.SUPPORTED_THING_TYPES_UIDS, timeout,
false);
}

public FreeAtHomeSystemDiscoveryService() {
this(90);
}

@Override
public Set<ThingTypeUID> getSupportedThingTypes() {
return Set.of(FreeAtHomeSystemBindingConstants.BRIDGE_TYPE_UID);
}

@Override
protected void startScan() {
if (backgroundDiscoveryJob == null) {
this.removeOlderResults(Instant.now().toEpochMilli());

isScanTerminated = false;
backgroundDiscoveryJob = scheduler.schedule(runnable, BACKGROUND_DISCOVERY_DELAY, TimeUnit.SECONDS);
}
}

@Override
protected synchronized void stopScan() {
super.stopScan();

isScanTerminated = true;

ScheduledFuture<?> localDiscoveryJob = backgroundDiscoveryJob;

if (localDiscoveryJob != null) {
localDiscoveryJob.cancel(true);
}

backgroundDiscoveryJob = null;

removeOlderResults(Instant.now().toEpochMilli());
}

@Override
public void deactivate() {
removeOlderResults(Instant.now().toEpochMilli());
}
}
Loading