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

[anel] Initial contribution of the Anel NET-PwrCtrl binding for OH3 #10952

Merged
merged 4 commits into from
Nov 29, 2021
Merged
Changes from 2 commits
Commits
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
This CODEOWNERS file contains errors

CODEOWNERS errors

  • Unknown owner on line 9: make sure @jpg0 exists and has write access to the repository
    …enhab.automation.jsscripting/ @jpg0
  • Unknown owner on line 13: make sure @theiding exists and has write access to the repository
    …s/org.openhab.binding.adorne/ @theiding
  • Unknown owner on line 26: make sure @gerrieg exists and has write access to the repository
    …es/org.openhab.binding.astro/ @gerrieg
  • Unknown owner on line 29: make sure @maxpg exists and has write access to the repository
    …rg.openhab.binding.automower/ @maxpg
  • Unknown owner on line 47: make sure @stefan-kaestle exists and has write access to the repository
    …org.openhab.binding.boschshc/ @stefan-kaestle @coeing @GerdZanker
  • Unknown owner on line 49: make sure @flo-02-mu exists and has write access to the repository
    ….binding.broadlinkthermostat/ @flo-02-mu
  • Unknown owner on line 53: make sure @jossuar exists and has write access to the repository
    …es/org.openhab.binding.caddx/ @jossuar
  • Unknown owner on line 58: make sure @projectgus exists and has write access to the repository
    …penhab.binding.coolmasternet/ @projectgus
  • Unknown owner on line 67: make sure @MichaelOchel exists and has write access to the repository
    …openhab.binding.digitalstrom/ @MichaelOchel @msiegele
  • Unknown owner on line 67: make sure @msiegele exists and has write access to the repository
    …g.digitalstrom/ @MichaelOchel @msiegele
  • Unknown owner on line 78: make sure @vbier exists and has write access to the repository
    …inding.elerotransmitterstick/ @vbier
  • Unknown owner on line 85: make sure @dfad1469 exists and has write access to the repository
    …rg.openhab.binding.etherrain/ @dfad1469
  • Unknown owner on line 93: make sure @airboxlab exists and has write access to the repository
    …s/org.openhab.binding.foobot/ @airboxlab @Hilbrand
  • Unknown owner on line 98: make sure @gerrieg exists and has write access to the repository
    …/org.openhab.binding.gardena/ @gerrieg
  • Unknown owner on line 112: make sure @beowulfe exists and has write access to the repository
    ….openhab.binding.hdpowerview/ @beowulfe
  • Unknown owner on line 117: make sure @gerrieg exists and has write access to the repository
    …b.binding.homematic/ @FStolte @gerrieg @mdicke2s
  • Unknown owner on line 117: make sure @mdicke2s exists and has write access to the repository
    ….homematic/ @FStolte @gerrieg @mdicke2s
  • Unknown owner on line 117: make sure @FStolte exists and has write access to the repository
    …rg.openhab.binding.homematic/ @FStolte @gerrieg @mdicke2s
  • Unknown owner on line 118: make sure @Daniel-42 exists and has write access to the repository
    …g.openhab.binding.homewizard/ @Daniel-42
  • Unknown owner on line 137: make sure @hans-reiner exists and has write access to the repository
    …les/org.openhab.binding.ism8/ @hans-reiner
  • Unknown owner on line 139: make sure @vbier exists and has write access to the repository
    …/org.openhab.binding.jeelink/ @vbier
  • Unknown owner on line 143: make sure @sjka exists and has write access to the repository
    …dles/org.openhab.binding.knx/ @sjka
  • Unknown owner on line 145: make sure @volfan6415 exists and has write access to the repository
    …rg.openhab.binding.konnected/ @volfan6415
  • Unknown owner on line 151: make sure @FluBBaOfWard exists and has write access to the repository
    …org.openhab.binding.lghombot/ @FluBBaOfWard
  • Unknown owner on line 161: make sure @actong exists and has write access to the repository
    …s/org.openhab.binding.lutron/ @actong @bobadair
  • Unknown owner on line 168: make sure @lucacalcaterra exists and has write access to the repository
    …org.openhab.binding.melcloud/ @lucacalcaterra @paulianttila @thewiep
  • Unknown owner on line 174: make sure @pboos exists and has write access to the repository
    …s/org.openhab.binding.mihome/ @pboos
  • Unknown owner on line 201: make sure @mettke exists and has write access to the repository
    …binding.network/ @davidgraeff @mettke
  • Unknown owner on line 209: make sure @mkatter exists and has write access to the repository
    …les/org.openhab.binding.nuki/ @mkatter
  • Unknown owner on line 214: make sure @hansbogert exists and has write access to the repository
    …penhab.binding.omnikinverter/ @hansbogert
  • Unknown owner on line 216: make sure @sdwilsh exists and has write access to the repository
    …g.openhab.binding.onebusaway/ @sdwilsh
  • Unknown owner on line 236: make sure @FluBBaOfWard exists and has write access to the repository
    ….openhab.binding.playstation/ @FluBBaOfWard
  • Unknown owner on line 237: make sure @falkena exists and has write access to the repository
    …/org.openhab.binding.plclogo/ @falkena
  • Unknown owner on line 245: make sure @QbusKoen exists and has write access to the repository
    …les/org.openhab.binding.qbus/ @QbusKoen
  • Unknown owner on line 261: make sure @eguib exists and has write access to the repository
    …echome/ @vctender @KorbinianP @eguib
  • Unknown owner on line 261: make sure @KorbinianP exists and has write access to the repository
    ….binding.senechome/ @vctender @KorbinianP @eguib
  • Unknown owner on line 269: make sure @jmvaz exists and has write access to the repository
    …inding.silvercrestwifisocket/ @jmvaz
  • Unknown owner on line 278: make sure @johannrichard exists and has write access to the repository
    …org.openhab.binding.solarlog/ @johannrichard
  • Unknown owner on line 279: make sure @sven-carstens exists and has write access to the repository
    …rg.openhab.binding.solarwatt/ @sven-carstens
  • Unknown owner on line 280: make sure @loungeflyz exists and has write access to the repository
    ….openhab.binding.somfymylink/ @loungeflyz
  • Unknown owner on line 283: make sure @freke exists and has write access to the repository
    …rg.openhab.binding.sonyaudio/ @freke
  • Unknown owner on line 287: make sure @HerzScheisse exists and has write access to the repository
    …ing.surepetcare/ @renescherer @HerzScheisse
  • Unknown owner on line 290: make sure @twendt exists and has write access to the repository
    …es/org.openhab.binding.tacmi/ @twendt @Wolfgang1966 @marvkis
  • Unknown owner on line 291: make sure @dfrommi exists and has write access to the repository
    …les/org.openhab.binding.tado/ @dfrommi
  • Unknown owner on line 292: make sure @dolic exists and has write access to the repository
    …openhab.binding.tankerkoenig/ @dolic @JueBag
  • Unknown owner on line 293: make sure @ZzetT exists and has write access to the repository
    …org.openhab.binding.telegram/ @ZzetT
  • Unknown owner on line 305: make sure @marcusb exists and has write access to the repository
    …dles/org.openhab.binding.upb/ @marcusb
  • Unknown owner on line 324: make sure @xylo exists and has write access to the repository
    …openhab.binding.wifiled/ @rvt @xylo
  • Unknown owner on line 324: make sure @rvt exists and has write access to the repository
    …/org.openhab.binding.wifiled/ @rvt @xylo
  • Unknown owner on line 334: make sure @pathec exists and has write access to the repository
    …les/org.openhab.binding.zway/ @pathec
  • Unknown owner on line 335: make sure @beowulfe exists and has write access to the repository
    …ndles/org.openhab.io.homekit/ @beowulfe @yfre
  • Unknown owner on line 345: make sure @mkhl exists and has write access to the repository
    …rg.openhab.persistence.mapdb/ @mkhl
  • Unknown owner on line 362: make sure @hillmanr exists and has write access to the repository
    …s/org.openhab.voice.pollytts/ @hillmanr
  • Unknown owner on line 364: make sure @gerrieg exists and has write access to the repository
    ….openhab.binding.astro.tests/ @gerrieg
  • Unknown owner on line 377: make sure @mkhl exists and has write access to the repository
    …nhab.persistence.mapdb.tests/ @mkhl
Original file line number Diff line number Diff line change
@@ -22,6 +22,7 @@
/bundles/org.openhab.binding.ambientweather/ @mhilbush
/bundles/org.openhab.binding.amplipi/ @kaikreuzer
/bundles/org.openhab.binding.androiddebugbridge/ @GiviMAD
/bundles/org.openhab.binding.anel/ @paphko
/bundles/org.openhab.binding.astro/ @gerrieg
/bundles/org.openhab.binding.atlona/ @tmrobert8
/bundles/org.openhab.binding.autelis/ @digitaldan
5 changes: 5 additions & 0 deletions bom/openhab-addons/pom.xml
Original file line number Diff line number Diff line change
@@ -101,6 +101,11 @@
<artifactId>org.openhab.binding.androiddebugbridge</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.openhab.addons.bundles</groupId>
<artifactId>org.openhab.binding.anel</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.openhab.addons.bundles</groupId>
<artifactId>org.openhab.binding.astro</artifactId>
13 changes: 13 additions & 0 deletions bundles/org.openhab.binding.anel/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
231 changes: 231 additions & 0 deletions bundles/org.openhab.binding.anel/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,231 @@
# Anel NET-PwrCtrl Binding

Monitor and control Anel NET-PwrCtrl devices.

NET-PwrCtrl devices are power sockets / relays that can be configured via browser but they can also be controlled over the network, e.g. with an Android or iPhone app - and also with openHAB via this binding.
Some NET-PwrCtrl devices also have 8 I/O ports which can either be used to directly switch the sockets / relays, or they can be used as general input / output switches in openHAB.


## Supported Things
paphko marked this conversation as resolved.
Show resolved Hide resolved

There are three kinds of devices ([overview on manufacturer's homepage](https://en.anel.eu/?src=/produkte/produkte.htm)):

| [Anel NET-PwrCtrl HUT](https://en.anel.eu/?src=/produkte/hut_2/hut_2.htm) <br/> <sub>( _advanced-firmware_ )</sub> | [Anel NET-PwrCtrl IO](https://en.anel.eu/?src=/produkte/io/io.htm) <br/> <sub>( _advanced-firmware_ )</sub> | [Anel NET-PwrCtrl HOME](https://de.anel.eu/?src=produkte/home/home.htm) <br/> <sub>( _home_ )</sub> <br/> (only German version) |
| --- | --- | --- |
| [![Anel NET-PwrCtrl HUT 2](https://de.anel.eu/image/leisten/HUT2LV-P_500.jpg)](https://de.anel.eu/?src=produkte/hut_2/hut_2.htm) | [![Anel NET-PwrCtrl IO](https://de.anel.eu/image/leisten/IO-Stecker.png)](https://de.anel.eu/?src=produkte/io/io.htm) | [![Anel NET-PwrCtrl HOME](https://de.anel.eu/image/leisten/HOME-DE-500.gif)](https://de.anel.eu/?src=produkte/home/home.htm) |

Thing type IDs:

* *home*: The smallest device, the _HOME_, is the only one with only three power sockets and only available in Germany.
* *simple-firmware*: The _PRO_ and _REDUNDANT_ have eight power sockets and a similar (simplified) firmware as the _HOME_.
* *advanced-firmware*: All others (_ADV_, _IO_, and the different _HUT_ variants) have eight power sockets / relays, eight IO ports, and an advanced firmware.

An [additional sensor](https://en.anel.eu/?src=/produkte/sensor_1/sensor_1.htm) may be used for monitoring temperature, humidity, and brightness.
The sensor can be attached to a _HUT_ device via an Ethernet cable (max length is 50m).


## Discovery

Devices can be discovered automatically if their UDP ports are configured as follows:

* 75 / 77 (default)
* 750 / 770
* 7500 / 7700
* 7750 / 7770

If a device is found for a specific port (excluding the default port), the subsequent port is also scanned, e.g. 7500/7700 &rarr; 7501/7701 &rarr; 7502/7702 &rarr; etc.

Depending on the network switch and router devices, discovery may or may not work on wireless networks.
It should work reliably though on local wired networks.


## Thing Configuration

Each Thing requires the following configuration parameters.

| Parameter | Type | Default | Required | Description |
|-----------------------|---------|-------------|----------|-------------|
| Hostname / IP address | String | net-control | yes | Hostname or IP address of the device |
| Send Port | Integer | 75 | yes | UDP port to send data to the device (in the anel web UI, it's the receive port!) |
| Receive Port | Integer | 77 | yes | UDP port to receive data from the device (in the anel web UI, it's the send port!) |
| User | String | user7 | yes | User to access the device (make sure it has rights to change relay / IO states!) |
| Password | String | anel | yes | Password of the given user |

For multiple devices, please use exclusive UDP ports for each device.
Ports above 1024 are recommended because they are outside the range of system ports.

Possible entries in your thing file could be (thing types _home_, _simple-firmware_, and _advanced-firmware_ are explained above in _Supported Things_):

```
anel:home:mydevice1 [hostname="192.168.0.101", udpSendPort=7500, udpReceivePort=7700, user="user7", password="anel"]
anel:simple-firmware:mydevice2 [hostname="192.168.0.102", udpSendPort=7501, udpReceivePort=7701, user="user7", password="anel"]
anel:advanced-firmware:mydevice3 [hostname="192.168.0.103", udpSendPort=7502, udpReceivePort=7702, user="user7", password="anel"]
anel:advanced-firmware:mydevice4 [hostname="192.168.0.104", udpSendPort=7503, udpReceivePort=7703, user="user7", password="anel"]
```


## Channels

Depending on the thing type, the following channels are available.

| Channel ID | Item Type | Supported Things | Read Only | Description |
|--------------------|--------------------|-------------------|-----------|-------------|
| prop#name | String | all | yes | Name of the device |
| prop#temperature | Number:Temperature | simple / advanced | yes | Temperature of the integrated sensor |
| sensor#temperature | Number:Temperature | advanced | yes | Temperature of the optional external sensor |
| sensor#humidity | Number | advanced | yes | Humidity of the optional external sensor |
| sensor#brightness | Number | advanced | yes | Brightness of the optional external sensor |
| r1#name | String | all | yes | Name of relay / socket 1 |
| r2#name | String | all | yes | Name of relay / socket 2 |
| r3#name | String | all | yes | Name of relay / socket 3 |
| r4#name | String | simple / advanced | yes | Name of relay / socket 4 |
| r5#name | String | simple / advanced | yes | Name of relay / socket 5 |
| r6#name | String | simple / advanced | yes | Name of relay / socket 6 |
| r7#name | String | simple / advanced | yes | Name of relay / socket 7 |
| r8#name | String | simple / advanced | yes | Name of relay / socket 8 |
| r1#state | Switch | all | no * | State of relay / socket 1 |
| r2#state | Switch | all | no * | State of relay / socket 2 |
| r3#state | Switch | all | no * | State of relay / socket 3 |
| r4#state | Switch | simple / advanced | no * | State of relay / socket 4 |
| r5#state | Switch | simple / advanced | no * | State of relay / socket 5 |
| r6#state | Switch | simple / advanced | no * | State of relay / socket 6 |
| r7#state | Switch | simple / advanced | no * | State of relay / socket 7 |
| r8#state | Switch | simple / advanced | no * | State of relay / socket 8 |
| r1#locked | Switch | all | yes | Whether or not relay / socket 1 is locked |
| r2#locked | Switch | all | yes | Whether or not relay / socket 2 is locked |
| r3#locked | Switch | all | yes | Whether or not relay / socket 3 is locked |
| r4#locked | Switch | simple / advanced | yes | Whether or not relay / socket 4 is locked |
| r5#locked | Switch | simple / advanced | yes | Whether or not relay / socket 5 is locked |
| r6#locked | Switch | simple / advanced | yes | Whether or not relay / socket 6 is locked |
| r7#locked | Switch | simple / advanced | yes | Whether or not relay / socket 7 is locked |
| r8#locked | Switch | simple / advanced | yes | Whether or not relay / socket 8 is locked |
| io1#name | String | advanced | yes | Name of IO port 1 |
| io2#name | String | advanced | yes | Name of IO port 2 |
| io3#name | String | advanced | yes | Name of IO port 3 |
| io4#name | String | advanced | yes | Name of IO port 4 |
| io5#name | String | advanced | yes | Name of IO port 5 |
| io6#name | String | advanced | yes | Name of IO port 6 |
| io7#name | String | advanced | yes | Name of IO port 7 |
| io8#name | String | advanced | yes | Name of IO port 8 |
| io1#state | Switch | advanced | no ** | State of IO port 1 |
| io2#state | Switch | advanced | no ** | State of IO port 2 |
| io3#state | Switch | advanced | no ** | State of IO port 3 |
| io4#state | Switch | advanced | no ** | State of IO port 4 |
| io5#state | Switch | advanced | no ** | State of IO port 5 |
| io6#state | Switch | advanced | no ** | State of IO port 6 |
| io7#state | Switch | advanced | no ** | State of IO port 7 |
| io8#state | Switch | advanced | no ** | State of IO port 8 |
| io1#mode | Switch | advanced | yes | Mode of port 1: _ON_ = input, _OFF_ = output |
| io2#mode | Switch | advanced | yes | Mode of port 2: _ON_ = input, _OFF_ = output |
| io3#mode | Switch | advanced | yes | Mode of port 3: _ON_ = input, _OFF_ = output |
| io4#mode | Switch | advanced | yes | Mode of port 4: _ON_ = input, _OFF_ = output |
| io5#mode | Switch | advanced | yes | Mode of port 5: _ON_ = input, _OFF_ = output |
| io6#mode | Switch | advanced | yes | Mode of port 6: _ON_ = input, _OFF_ = output |
| io7#mode | Switch | advanced | yes | Mode of port 7: _ON_ = input, _OFF_ = output |
| io8#mode | Switch | advanced | yes | Mode of port 8: _ON_ = input, _OFF_ = output |

\* Relay / socket state is read-only if it is locked; otherwise it is changeable.<br/>
\** IO port state is read-only if its mode is _input_, it is changeable if its mode is _output_.


## Full Example

`.things` file:

```
Thing anel:advanced-firmware:anel1 "Anel1" [hostname="192.168.0.100", udpSendPort=7500, udpReceivePort=7700, user="user7", password="anel"]
```

`.items` file:

```
// device properties
String anel1name "Anel1 Name" {channel="anel:advanced-firmware:anel1:prop#name"}
Number:Temperature anel1temperature "Anel1 Temperature" {channel="anel:advanced-firmware:anel1:prop#temperature"}
// external sensor properties
Number:Temperature anel1sensorTemperature "Anel1 Sensor Temperature" {channel="anel:advanced-firmware:anel1:sensor#temperature"}
Number anel1sensorHumidity "Anel1 Sensor Humidity" {channel="anel:advanced-firmware:anel1:sensor#humidity"}
Number anel1sensorBrightness "Anel1 Sensor Brightness" {channel="anel:advanced-firmware:anel1:sensor#brightness"}
// relay names and states
String anel1relay1name "Anel1 Relay1 name" {channel="anel:advanced-firmware:anel1:r1#name"}
Switch anel1relay1locked "Anel1 Relay1 locked" {channel="anel:advanced-firmware:anel1:r1#locked"}
Switch anel1relay1state "Anel1 Relay1" {channel="anel:advanced-firmware:anel1:r1#state"}
Switch anel1relay2state "Anel1 Relay2" {channel="anel:advanced-firmware:anel1:r2#state"}
Switch anel1relay3state "Anel1 Relay3" {channel="anel:advanced-firmware:anel1:r3#state"}
Switch anel1relay4state "Anel1 Relay4" {channel="anel:advanced-firmware:anel1:r4#state"}
Switch anel1relay5state "Light Bedroom" {channel="anel:advanced-firmware:anel1:r5#state"}
Switch anel1relay6state "Doorbell" {channel="anel:advanced-firmware:anel1:r6#state"}
Switch anel1relay7state "Socket TV" {channel="anel:advanced-firmware:anel1:r7#state"}
Switch anel1relay8state "Socket Terrace" {channel="anel:advanced-firmware:anel1:r8#state"}
// IO port names and states
String anel1io1name "Anel1 IO1 name" {channel="anel:advanced-firmware:anel1:io1#name"}
Switch anel1io1mode "Anel1 IO1 mode" {channel="anel:advanced-firmware:anel1:io1#mode"}
Switch anel1io1state "Anel1 IO1" {channel="anel:advanced-firmware:anel1:io1#state"}
Switch anel1io2state "Anel1 IO2" {channel="anel:advanced-firmware:anel1:io2#state"}
Switch anel1io3state "Anel1 IO3" {channel="anel:advanced-firmware:anel1:io3#state"}
Switch anel1io4state "Anel1 IO4" {channel="anel:advanced-firmware:anel1:io4#state"}
Switch anel1io5state "Switch Bedroom" {channel="anel:advanced-firmware:anel1:io5#state"}
Switch anel1io6state "Doorbell" {channel="anel:advanced-firmware:anel1:io6#state"}
Switch anel1io7state "Switch Office" {channel="anel:advanced-firmware:anel1:io7#state"}
Switch anel1io8state "Reed Contact Door" {channel="anel:advanced-firmware:anel1:io8#state"}
```

`.sitemap` file:

```
sitemap anel label="Anel NET-PwrCtrl" {
Frame label="Device and Sensor" {
Text item=anel1name label="Anel1 Name"
Text item=anel1temperature label="Anel1 Temperature [%.1f °C]"
Text item=anel1sensorTemperature label="Anel1 Sensor Temperature [%.1f °C]"
Text item=anel1sensorHumidity label="Anel1 Sensor Humidity [%.1f]"
Text item=anel1sensorBrightness label="Anel1 Sensor Brightness [%.1f]"
}
Frame label="Relays" {
Text item=anel1relay1name label="Relay 1 name" labelcolor=[anel1relay1locked==ON="green",anel1relay1locked==OFF="maroon"]
Switch item=anel1relay1state
Switch item=anel1relay2state
Switch item=anel1relay3state
Switch item=anel1relay4state
Switch item=anel1relay5state
Switch item=anel1relay6state
Switch item=anel1relay7state
Switch item=anel1relay8state
}
Frame label="IO Ports" {
Text item=anel1io1name label="IO 1 name" labelcolor=[anel1io1mode==OFF="green",anel1io1mode==ON="maroon"]
Switch item=anel1io1state
Switch item=anel1io2state
Switch item=anel1io3state
Switch item=anel1io4state
Switch item=anel1io5state
Switch item=anel1io6state
Switch item=anel1io7state
Switch item=anel1io8state
}
}
```

The relay / IO port names are rarely useful because you probably set similar (static) labels for the state items.<br/>
The locked state / IO mode is also rarely relevant in practice, because it typically doesn't change.

`.rules` file:

```
rule "doorbell only at daytime"
when Item anel1io6state changed then
if (now.getHoursOfDay >= 6 && now.getHoursOfDay <= 22) {
anel1relay6state.sendCommand(if (anel1io6state.state != ON) ON else OFF)
}
someNotificationItem.sendCommand("Someone just rang the doorbell")
end
```


## Reference Documentation

The UDP protocol of Anel devices is explained [here](https://forum.anel.eu/viewtopic.php?f=16&t=207).

17 changes: 17 additions & 0 deletions bundles/org.openhab.binding.anel/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
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.2.0-SNAPSHOT</version>
</parent>

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

<name>openHAB Add-ons :: Bundles :: Anel 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.anel-${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-anel" description="Anel Binding" version="${project.version}">
<feature>openhab-runtime-base</feature>
<bundle start-level="80">mvn:org.openhab.addons.bundles/org.openhab.binding.anel/${project.version}</bundle>
</feature>
</features>
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
/**
* Copyright (c) 2010-2021 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.anel.internal;

import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;

/**
* The {@link AnelConfiguration} class contains fields mapping thing configuration parameters.
*
* @author Patrick Koenemann - Initial contribution
*/
@NonNullByDefault
public class AnelConfiguration {

public @Nullable String hostname;
public @Nullable String user;
public @Nullable String password;
/** Port to send data from openhab to device. */
public int udpSendPort = IAnelConstants.DEFAULT_SEND_PORT;
/** Openhab receives messages via this port from device. */
public int udpReceivePort = IAnelConstants.DEFAULT_RECEIVE_PORT;

public AnelConfiguration() {
}

public AnelConfiguration(@Nullable String hostname, @Nullable String user, @Nullable String password, int sendPort,
int receivePort) {
this.hostname = hostname;
this.user = user;
this.password = password;
this.udpSendPort = sendPort;
this.udpReceivePort = receivePort;
}

@Override
public String toString() {
final StringBuilder builder = new StringBuilder();
builder.append(getClass().getSimpleName());
builder.append("[hostname=");
builder.append(hostname);
builder.append(",user=");
builder.append(user);
builder.append(",password=");
builder.append(mask(password));
builder.append(",udpSendPort=");
builder.append(udpSendPort);
builder.append(",udpReceivePort=");
builder.append(udpReceivePort);
builder.append("]");
return builder.toString();
}

private @Nullable String mask(@Nullable String string) {
return string == null ? null : string.replaceAll(".", "X");
}
}
Loading