Anel NET-PwrCtrl Binding

Monitor and control Anel NET-PwrCtrl devices.

Anel NET-PwrCtrl HUTAnel NET-PwrCtrl IOAnel NET-PwrCtrl HOME
Anel NET-PwrCtrl HUTAnel NET-PwrCtrl PROAnel NET-PwrCtrl HOME

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. The NET-PwrCtrl HUT and NET-PwrCtrl IO also have 8 I/O pins which can either be used to directly switch the sockets, or they can be used as general input switches in openHAB. Here is a video demonstrating a switch and a dimmer (voice is German), explanation of the setup is given in the diagram below:

Anel example

Anel demo setup

Note that the binding is still untested for other devices than the NET-PwrCtrl HUT, because I do not own any of the others. I suppose the binding works well with the NET-PwrCtrl IO because it has the same features, but it may not yet work for the others!

Binding Configuration

The binding can be configured in the file services/anel.cfg. In the table below, <name> must be an identifier that is also used for the item bindings.

KeyDefaultRequiredDescription
<name>.hostnet-controlrecommendedIP or network address
<name>.udpReceivePort77NoUDP receive port
<name>.udpSendPort75NoUDP send port
<name>.useruser7NoUser name
<name>.passwordanelNoPassword
refresh60000NoGlobal refresh interval in milliseconds
cachePeriod0NoCache the state for cachePeriod minutes so only changes are posted (optional, defaults to 0 = disabled). Example: if period is 60, once per hour all states are posted to the event bus; changes are always and immediately posted to the event bus.

Notes

  • At least one option must be set for an identifier for the binding to work.
  • The most obvious and important option is host, it is in fact mandatory if multiple devices are used.
  • The host name, ports, and credentials are device-specific settings that must be configured via the device's browser interface.
  • Port numbers above 1024 are recommended because ports below 1024 are typically reserved and their access restricted on some devices/networks.
  • For multiple devices, different ports must be used.

Item Configuration

There are different types of item bindings, all of them are qualified with the device's identifier used in the binding configuration:

The device's name is a string type, the device's temperature is a number:

String anelName "Anel1 network name [%s]" { anel="anel1:NAME" }
Number anelTemperature "Anel1 temperature [%s]" { anel="anel1:TEMPERATURE" }

The actual relay states are also switchable if they are not locked. Note that the locked states and the relay's names are read-only.

Switch f1 { anel="anel1:F1", autoupdate="false" }
String f1name { anel="anel1:F1NAME" }
Switch f1locked { anel="anel1:F1LOCKED" }

The I/O states are only switchable if they are configured as 'input' (point of view of the anel device), otherwise they are read-only. Again, the names are also read-only.

Switch io1 { anel="anel1:IO1" }
String io1name = { anel="anel1:IO1NAME" }
Switch io1isinput { anel="anel1:IO8ISINPUT" }

Note: all read-only properties must be configured via the device's browser interface.

General format and full list of binding items:

anel="<identifier>:<item>"
itemitem typepurposechangeable
NAMEStringdevice's nameno
TEMPERATURENumberdevice's temperatureno
F1NAMEStringname of relay 1no
F2NAMEStringname of relay 2no
F3NAMEStringname of relay 3no
F4NAMEStringname of relay 4no
F5NAMEStringname of relay 5no
F6NAMEStringname of relay 6no
F7NAMEStringname of relay 7no
F8NAMEStringname of relay 8no
F1LOCKEDSwitchwhether or not relay 1 is lockedno
F2LOCKEDSwitchwhether or not relay 2 is lockedno
F3LOCKEDSwitchwhether or not relay 3 is lockedno
F4LOCKEDSwitchwhether or not relay 4 is lockedno
F5LOCKEDSwitchwhether or not relay 5 is lockedno
F6LOCKEDSwitchwhether or not relay 6 is lockedno
F7LOCKEDSwitchwhether or not relay 7 is lockedno
F8LOCKEDSwitchwhether or not relay 8 is lockedno
F1Switchstate of relay 1only if F1LOCKED = OFF
F2Switchstate of relay 2only if F2LOCKED = OFF
F3Switchstate of relay 3only if F3LOCKED = OFF
F4Switchstate of relay 4only if F4LOCKED = OFF
F5Switchstate of relay 5only if F5LOCKED = OFF
F6Switchstate of relay 6only if F6LOCKED = OFF
F7Switchstate of relay 7only if F7LOCKED = OFF
F8Switchstate of relay 8only if F8LOCKED = OFF
IO1NAMEStringname of I/O 1no
IO2NAMEStringname of I/O 2no
IO3NAMEStringname of I/O 3no
IO4NAMEStringname of I/O 4no
IO5NAMEStringname of I/O 5no
IO6NAMEStringname of I/O 6no
IO7NAMEStringname of I/O 7no
IO8NAMEStringname of I/O 8no
IO1ISINPUTSwitchwhether I/O 1 is inputno
IO2ISINPUTSwitchwhether I/O 2 is inputno
IO3ISINPUTSwitchwhether I/O 3 is inputno
IO4ISINPUTSwitchwhether I/O 4 is inputno
IO5ISINPUTSwitchwhether I/O 5 is inputno
IO6ISINPUTSwitchwhether I/O 6 is inputno
IO7ISINPUTSwitchwhether I/O 7 is inputno
IO8ISINPUTSwitchwhether I/O 8 is inputno
IO1Switchstate of I/O 1only if IO1ISINPUT = ON
IO2Switchstate of I/O 2only if IO2ISINPUT = ON
IO3Switchstate of I/O 3only if IO3ISINPUT = ON
IO4Switchstate of I/O 4only if IO4ISINPUT = ON
IO5Switchstate of I/O 5only if IO5ISINPUT = ON
IO6Switchstate of I/O 6only if IO6ISINPUT = ON
IO7Switchstate of I/O 7only if IO7ISINPUT = ON
IO8Switchstate of I/O 8only if IO8ISINPUT = ON
SENSOR_TEMPERATURENumbersensor temperature (device firmware >= 6.1)no
SENSOR_HUMIDITYNumbersensor humidity (device firmware >= 6.1)no
SENSOR_BRIGHTNESSNumbersensor brightness (device firmware >= 6.1)no

Example Rules

Although the device's configuration can be used to directly switch a relay with an input channel, the very same can be done with this rule:

rule "regular switch on Anel1 IO1 input for relay 1"
when Item io1 changed then
    sendCommand(f1, io1.state)
end

An input channel can also be used as a push button (also demonstrated in the video):

rule "push button switch on Anel1 IO2 input for relay 2"
when Item io2 changed to ON then
    sendCommand(f2, if (f2.state != ON) ON else OFF)
end

In combination with the MiLight Binding, this rule uses I/O 3 as dimmer for MiLight bulb milight_zone1 (also demonstrated in the video).

As long as I/O 3 is pressed, the bulb dims up until its brightness reaches 100%.

var org.openhab.model.script.actions.Timer timer2

rule "switch dimmer on Anel1 IO3"
when Item io3 changed to OFF then
    sendCommand(milight_zone1, 10)
    timer2 = createTimer(now.plusMillis(333)) [|
        val int newValue = (milight_zone1.state as DecimalType).intValue + 5
        if (newValue > 100) {
            timer2 = null
        } else if (timer2 != null) {
            sendCommand(milight_zone1, newValue)
            if (io3.state == OFF)
                timer2.reschedule(now.plusMillis(333))
        }
    ]
end