Examples IPX800 V4 with X-8R, X-4VR, X-THL Extension

Example IPX-800 V4 with X-8R, X-4VR and X-THL extension

If any users are interested, I can post examples with extensions:

  • X400-CT
  • X-4FP

Prerequis:

Add-on:

Hardware: GCE Electronics

  • IPX-800 V4
  • X-8R
  • X-4VR ou X-4VR V2
  • X-THL

Setup Relay IPX 800 V4 and X-8R Extension

  • HTTP binding is used to send commands to the IPX800 and retrieve state every 5 minutes
  • webhook binding is used to trigger a rule that retrieves relay state, triggered by a push from the IPX800 when relay state changes.

IPX.things :

Thing http:url:IPXxdevice "IPX xdevice" [ baseURL="http://IP:PORT/api/xdevices.json?key=apikey&", commandMethod="POST", refresh=300, delay=0, contentType="text/plain" ] {
    Channels:
        Type switch : IPXRelay1 "IPXRelay1" [ onValue="SetR=01", offValue="ClearR=01", commandExtension="%2$s", stateExtension="Get=R", stateTransformation="MAP:BinaryToSwitch.map" , "JSONPATH:$.R1" ]
        Type switch : IPXRelay2 "IPXRelay2" [ onValue="SetR=02", offValue="ClearR=02", commandExtension="%2$s", stateExtension="Get=R", stateTransformation="MAP:BinaryToSwitch.map" , "JSONPATH:$.R2" ]
        Type switch : IPXRelay3 "IPXRelay3" [ onValue="SetR=03", offValue="ClearR=03", commandExtension="%2$s", stateExtension="Get=R", stateTransformation="MAP:BinaryToSwitch.map" , "JSONPATH:$.R3" ]
        Type switch : IPXRelay4 "IPXRelay4" [ onValue="SetR=04", offValue="ClearR=04", commandExtension="%2$s", stateExtension="Get=R", stateTransformation="MAP:BinaryToSwitch.map" , "JSONPATH:$.R4" ]
        Type switch : IPXRelay5 "IPXRelay5" [ onValue="SetR=05", offValue="ClearR=05", commandExtension="%2$s", stateExtension="Get=R", stateTransformation="MAP:BinaryToSwitch.map" , "JSONPATH:$.R5" ]
        Type switch : IPXRelay6 "IPXRelay6" [ onValue="SetR=06", offValue="ClearR=06", commandExtension="%2$s", stateExtension="Get=R", stateTransformation="MAP:BinaryToSwitch.map" , "JSONPATH:$.R6" ]
        Type switch : IPXRelay7 "IPXRelay7" [ onValue="SetR=07", offValue="ClearR=07", commandExtension="%2$s", stateExtension="Get=R", stateTransformation="MAP:BinaryToSwitch.map" , "JSONPATH:$.R7" ]
        Type switch : IPXRelay8 "IPXRelay8" [ onValue="SetR=08", offValue="ClearR=08", commandExtension="%2$s", stateExtension="Get=R", stateTransformation="MAP:BinaryToSwitch.map" , "JSONPATH:$.R8" ]
        Type switch : X8Relay1 "X8Relay1" [ onValue="SetR=09", offValue="ClearR=09", commandExtension="%2$s", stateExtension="Get=R", stateTransformation="MAP:BinaryToSwitch.map" , "JSONPATH:$.R9" ]
        Type switch : X8Relay2 "X8Relay2" [ onValue="SetR=10", offValue="ClearR=10", commandExtension="%2$s", stateExtension="Get=R", stateTransformation="MAP:BinaryToSwitch.map" , "JSONPATH:$.R10" ]
        Type switch : X8Relay3 "X8Relay3" [ onValue="SetR=11", offValue="ClearR=11", commandExtension="%2$s", stateExtension="Get=R", stateTransformation="MAP:BinaryToSwitch.map" , "JSONPATH:$.R11" ]
        Type switch : X8Relay4 "X8Relay4" [ onValue="SetR=12", offValue="ClearR=12", commandExtension="%2$s", stateExtension="Get=R", stateTransformation="MAP:BinaryToSwitch.map" , "JSONPATH:$.R12" ]
        Type switch : X8Relay5 "X8Relay5" [ onValue="SetR=13", offValue="ClearR=13", commandExtension="%2$s", stateExtension="Get=R", stateTransformation="MAP:BinaryToSwitch.map" , "JSONPATH:$.R13" ]
        Type switch : X8Relay6 "X8Relay6" [ onValue="SetR=14", offValue="ClearR=14", commandExtension="%2$s", stateExtension="Get=R", stateTransformation="MAP:BinaryToSwitch.map" , "JSONPATH:$.R14" ]
        Type switch : X8Relay7 "X8Relay7" [ onValue="SetR=15", offValue="ClearR=15", commandExtension="%2$s", stateExtension="Get=R", stateTransformation="MAP:BinaryToSwitch.map" , "JSONPATH:$.R15" ]
        Type switch : X8Relay8 "X8Relay8" [ onValue="SetR=16", offValue="ClearR=16", commandExtension="%2$s", stateExtension="Get=R", stateTransformation="MAP:BinaryToSwitch.map" , "JSONPATH:$.R16" ]
}

IPX.js :
to put in openHAB-conf\automation\js

rules.JSRule({
  name: "MAJ etats Relay IPX",
  triggers: [triggers.ChannelEventTrigger('webhook:Webhook:IPX800:IPXTrigger')],
  execute: (event) => {
    var json = (actions.HTTP.sendHttpGetRequest('http://IP:PORT/api/xdevices.json?key=apikey&Get=R', 3000));
    items.getItem('IPXRelay1').postUpdate(actions.Transformation.transform('MAP', 'BinaryToSwitch.map', actions.Transformation.transform('JSONPATH', '$.R1', json)));
    items.getItem('IPXRelay2').postUpdate(actions.Transformation.transform('MAP', 'BinaryToSwitch.map', actions.Transformation.transform('JSONPATH', '$.R2', json)));
    items.getItem('IPXRelay3').postUpdate(actions.Transformation.transform('MAP', 'BinaryToSwitch.map', actions.Transformation.transform('JSONPATH', '$.R3', json)));
    items.getItem('IPXRelay4').postUpdate(actions.Transformation.transform('MAP', 'BinaryToSwitch.map', actions.Transformation.transform('JSONPATH', '$.R4', json)));
    items.getItem('IPXRelay5').postUpdate(actions.Transformation.transform('MAP', 'BinaryToSwitch.map', actions.Transformation.transform('JSONPATH', '$.R5', json)));
    items.getItem('IPXRelay6').postUpdate(actions.Transformation.transform('MAP', 'BinaryToSwitch.map', actions.Transformation.transform('JSONPATH', '$.R6', json)));
    items.getItem('IPXRelay7').postUpdate(actions.Transformation.transform('MAP', 'BinaryToSwitch.map', actions.Transformation.transform('JSONPATH', '$.R7', json)));
    items.getItem('IPXRelay8').postUpdate(actions.Transformation.transform('MAP', 'BinaryToSwitch.map', actions.Transformation.transform('JSONPATH', '$.R8', json)));
    items.getItem('X8Relay1').postUpdate(actions.Transformation.transform('MAP', 'BinaryToSwitch.map', actions.Transformation.transform('JSONPATH', '$.R9', json)));
    items.getItem('X8Relay2').postUpdate(actions.Transformation.transform('MAP', 'BinaryToSwitch.map', actions.Transformation.transform('JSONPATH', '$.R10', json)));
    items.getItem('X8Relay3').postUpdate(actions.Transformation.transform('MAP', 'BinaryToSwitch.map', actions.Transformation.transform('JSONPATH', '$.R11', json)));
    items.getItem('X8Relay4').postUpdate(actions.Transformation.transform('MAP', 'BinaryToSwitch.map', actions.Transformation.transform('JSONPATH', '$.R12', json)));
    items.getItem('X8Relay5').postUpdate(actions.Transformation.transform('MAP', 'BinaryToSwitch.map', actions.Transformation.transform('JSONPATH', '$.R13', json)));
    items.getItem('X8Relay6').postUpdate(actions.Transformation.transform('MAP', 'BinaryToSwitch.map', actions.Transformation.transform('JSONPATH', '$.R14', json)));
    items.getItem('X8Relay7').postUpdate(actions.Transformation.transform('MAP', 'BinaryToSwitch.map', actions.Transformation.transform('JSONPATH', '$.R15', json)));
    items.getItem('X8Relay8').postUpdate(actions.Transformation.transform('MAP', 'BinaryToSwitch.map', actions.Transformation.transform('JSONPATH', '$.R16', json)));
  },
  tags: ["IPX"],
  id: "EtatIPXRelay"
});

BinaryToSwitch.map :
to put in openHAB-conf\transform

0=OFF
1=ON

Enter your IP, PORT and apikey in the URL http://IP:PORT/api/xdevices.json?key=apikey&

IPX800 state JSON Command
Relay 1 R1 R=01
Relay 2 R2 R=02
Relay 3 R3 R=03
Relay 4 R4 R=04
Relay 5 R5 R=05
Relay 6 R6 R=06
Relay 7 R7 R=07
Relay 8 R8 R=08
X-8R (1) state JSON Command
Relay 1 R9 R=09
Relay 2 R10 R=10
Relay 3 R11 R=11
Relay 4 R12 R=12
Relay 5 R13 R=13
Relay 6 R14 R=14
Relay 7 R15 R=15
Relay 8 R16 R=16

Etc…

IPX.items :

Group            IPX800                                                                                   ["Location"]

Group            IPX_Relay       "IPX 800 Relay"    <iconify:icomoon-free:switch>    (IPX800)           ["Equipment"]            {widgetOrder="01"}
Switch           IPXRelay1       "IPX Relay 1"      <iconify:icomoon-free:switch>    (IPX_Relay)       ["Switch","Power"]       {channel="http:url:IPXxdevice:IPXRelay1", widgetOrder="01"}
Switch           IPXRelay2       "IPX Relay 2"      <iconify:icomoon-free:switch>    (IPX_Relay)       ["Switch","Power"]       {channel="http:url:IPXxdevice:IPXRelay2", widgetOrder="02"}
Switch           IPXRelay3       "IPX Relay 3"      <iconify:icomoon-free:switch>    (IPX_Relay)       ["Switch","Power"]       {channel="http:url:IPXxdevice:IPXRelay3", widgetOrder="03"}
Switch           IPXRelay4       "IPX Relay 4"      <iconify:icomoon-free:switch>    (IPX_Relay)       ["Switch","Power"]       {channel="http:url:IPXxdevice:IPXRelay4", widgetOrder="04"}
Switch           IPXRelay5       "IPX Relay 5"      <iconify:icomoon-free:switch>    (IPX_Relay)       ["Switch","Power"]       {channel="http:url:IPXxdevice:IPXRelay5", widgetOrder="05"}
Switch           IPXRelay6       "IPX Relay 6"      <iconify:icomoon-free:switch>    (IPX_Relay)       ["Switch","Power"]       {channel="http:url:IPXxdevice:IPXRelay6", widgetOrder="06"}
Switch           IPXRelay7       "IPX Relay 7"      <iconify:icomoon-free:switch>    (IPX_Relay)       ["Switch","Power"]       {channel="http:url:IPXxdevice:IPXRelay7", widgetOrder="07"}
Switch           IPXRelay8       "IPX Relay 8"      <iconify:icomoon-free:switch>    (IPX_Relay)       ["Switch","Power"]       {channel="http:url:IPXxdevice:IPXRelay8", widgetOrder="08"}

Group            X8R_Relay       "X8R Relay"        <iconify:icomoon-free:switch>    (IPX800)           ["Equipment"]            {widgetOrder="02"}
Switch           X8Relay1        "X8R Relay 1"      <iconify:icomoon-free:switch>    (X8R_Relay)       ["Switch","Power"]       {channel="http:url:IPXxdevice:X8Relay1", widgetOrder="01"}
Switch           X8Relay2        "X8R Relay 2"      <iconify:icomoon-free:switch>    (X8R_Relay)       ["Switch","Power"]       {channel="http:url:IPXxdevice:X8Relay2", widgetOrder="02"}
Switch           X8Relay3        "X8R Relay 3"      <iconify:icomoon-free:switch>    (X8R_Relay)       ["Switch","Power"]       {channel="http:url:IPXxdevice:X8Relay3", widgetOrder="03"}
Switch           X8Relay4        "X8R Relay 4"      <iconify:icomoon-free:switch>    (X8R_Relay)       ["Switch","Power"]       {channel="http:url:IPXxdevice:X8Relay4", widgetOrder="04"}
Switch           X8Relay5        "X8R Relay 5"      <iconify:icomoon-free:switch>    (X8R_Relay)       ["Switch","Power"]       {channel="http:url:IPXxdevice:X8Relay5", widgetOrder="05"}
Switch           X8Relay6        "X8R Relay 6"      <iconify:icomoon-free:switch>    (X8R_Relay)       ["Switch","Power"]       {channel="http:url:IPXxdevice:X8Relay6", widgetOrder="06"}
Switch           X8Relay7        "X8R Relay 7"      <iconify:icomoon-free:switch>    (X8R_Relay)       ["Switch","Power"]       {channel="http:url:IPXxdevice:X8Relay7", widgetOrder="07"}
Switch           X8Relay8        "X8R Relay 8"      <iconify:icomoon-free:switch>    (X8R_Relay)       ["Switch","Power"]       {channel="http:url:IPXxdevice:X8Relay8", widgetOrder="08"}

Thing webhook yaml :

UID: webhook:Webhook:IPX800
label: Webhook trigger IPX800
thingTypeUID: webhook:Webhook
configuration:
  expression: resp.status=200
channels:
  - id: lastCall
    channelTypeUID: webhook:lastCall-channel
    label: Last request
    description: Timestamp of the last request to the webhook.
    configuration: {}
  - id: IPXTrigger
    channelTypeUID: webhook:trigger-channel
    label: IPXTrigger
    description: ""
    configuration:
      expression: req.parameters.Item[0];

Setup Push IPX800 :

In Périphérique/Push create a new Push configuration

SERVEUR : IP openHAB
PORT : Port openHAB
URL ON : /webhook/IPX800?Item=0
URL OFF : /webhook/IPX800?Item=0

In Scenario create a new Scene with EVENEMENT “ON EVENT”, ACTION “ON” and RESULTAT "PUSH



ipx800_openHab

Setup Roller Shutter X-4VR extension

  • HTTP binding is used to send commands to the IPX800 and retrieve state every 10 seconds

IPX.things :

Thing http:url:IPXx4VR "IPX X-4VR" [ baseURL="http://IP:PORT/api/xdevices.json?key=apikey&", commandMethod="POST", refresh=10, delay=0, contentType="text/plain" ] {
    Channels:
        Type rollershutter : X4VRVr1 "Rollershutter 1" [ upValue="SetVR01=0", downValue="SetVR01=100", stopValue="SetVR01=101", moveValue="SetVR01=%2$s", commandExtension="%2$s", stateExtension="Get=VR0", stateTransformation="JSONPATH:$.VR1-1" ]
        Type rollershutter : X4VRVr2 "Rollershutter 2" [ upValue="SetVR02=0", downValue="SetVR02=100", stopValue="SetVR02=101", moveValue="SetVR02=%2$s", commandExtension="%2$s", stateExtension="Get=VR0", stateTransformation="JSONPATH:$.VR1-2" ]
        Type rollershutter : X4VRVr3 "Rollershutter 3" [ upValue="SetVR03=0", downValue="SetVR03=100", stopValue="SetVR03=101", moveValue="SetVR03=%2$s", commandExtension="%2$s", stateExtension="Get=VR0", stateTransformation="JSONPATH:$.VR1-3" ]
        Type rollershutter : X4VRVr4 "Rollershutter 4" [ upValue="SetVR04=0", downValue="SetVR04=100", stopValue="SetVR04=101", moveValue="SetVR04=%2$s", commandExtension="%2$s", stateExtension="Get=VR0", stateTransformation="JSONPATH:$.VR1-4" ]
        Type rollershutter : X4VRVr5 "Rollershutter 5" [ upValue="SetVR05=0", downValue="SetVR05=100", stopValue="SetVR05=101", moveValue="SetVR05=%2$s", commandExtension="%2$s", stateExtension="Get=VR0", stateTransformation="JSONPATH:$.VR2-1" ]
        Type rollershutter : X4VRVr6 "Rollershutter 6" [ upValue="SetVR06=0", downValue="SetVR06=100", stopValue="SetVR06=101", moveValue="SetVR06=%2$s", commandExtension="%2$s", stateExtension="Get=VR0", stateTransformation="JSONPATH:$.VR2-2" ]
        Type rollershutter : X4VRVr7 "Rollershutter 7" [ upValue="SetVR07=0", downValue="SetVR07=100", stopValue="SetVR07=101", moveValue="SetVR07=%2$s", commandExtension="%2$s", stateExtension="Get=VR0", stateTransformation="JSONPATH:$.VR2-3" ]
        Type rollershutter : X4VRVr8 "Rollershutter 8" [ upValue="SetVR08=0", downValue="SetVR08=100", stopValue="SetVR08=101", moveValue="SetVR08=%2$s", commandExtension="%2$s", stateExtension="Get=VR0", stateTransformation="JSONPATH:$.VR2-4" ]
}

Enter your IP, PORT and apikey in the URL http://IP:PORT/api/xdevices.json?key=apikey&

X-4VR (1) state JSON Command
Roller Shutter 1 VR1-1 VR01
Roller Shutter 2 VR1-2 VR02
Roller Shutter 3 VR1-3 VR03
Roller Shutter 4 VR1-4 VR04
X-4VR (2) state JSON Command
Roller Shutter 1 VR2-1 VR05
Roller Shutter 2 VR2-2 VR06
Roller Shutter 3 VR2-3 VR07
Roller Shutter 4 VR2-4 VR08

Etc…

IPX.items :

Group            X4VR_1_Rollershutter    "X-4VR 1"            <iconify:mdi:window-shutter>     (IPX800)           ["Equipment"]
Rollershutter    X4VRVr1          "Rollershutter 1"          <iconify:mdi:window-shutter>     (X4VR_1_Rollershutter)    ["Control","Opening"]    {channel="http:url:IPXx4VR:X4VRVr1", widgetOrder="01"}
Rollershutter    X4VRVr2          "Rollershutter 2"          <iconify:mdi:window-shutter>     (X4VR_1_Rollershutter)    ["Control","Opening"]    {channel="http:url:IPXx4VR:X4VRVr2", widgetOrder="02"}
Rollershutter    X4VRVr3          "Rollershutter 3"          <iconify:mdi:window-shutter>     (X4VR_1_Rollershutter)    ["Control","Opening"]    {channel="http:url:IPXx4VR:X4VRVr3", widgetOrder="03"}
Rollershutter    X4VRVr4          "Rollershutter 4"          <iconify:mdi:window-shutter>     (X4VR_1_Rollershutter)    ["Control","Opening"]    {channel="http:url:IPXx4VR:X4VRVr4", widgetOrder="04"}

Group            X4VR_2_Rollershutter    "X-4VR 2"            <iconify:mdi:window-shutter>     (IPX800)           ["Equipment"]
Rollershutter    X4VRVr5          "Rollershutter 5"          <iconify:mdi:window-shutter>     (X4VR_2_Rollershutter)    ["Control","Opening"]    {channel="http:url:IPXx4VR:X4VRVr5", widgetOrder="01"}
Rollershutter    X4VRVr6          "Rollershutter 6"          <iconify:mdi:window-shutter>     (X4VR_2_Rollershutter)    ["Control","Opening"]    {channel="http:url:IPXx4VR:X4VRVr6", widgetOrder="02"}
Rollershutter    X4VRVr7          "Rollershutter 7"          <iconify:mdi:window-shutter>     (X4VR_2_Rollershutter)    ["Control","Opening"]    {channel="http:url:IPXx4VR:X4VRVr7", widgetOrder="03"}
Rollershutter    X4VRVr8          "Rollershutter 8"          <iconify:mdi:window-shutter>     (X4VR_2_Rollershutter)    ["Control","Opening"]    {channel="http:url:IPXx4VR:X4VRVr8", widgetOrder="04"}

Setup X-THL extension

  • HTTP binding is used to retrieve state every minutes

IPX.things :

Thing http:url:IPXxTHL "IPX X-THL" [ baseURL="http://IP:PORT/api/xdevices.json?key=apikey&", commandMethod="POST", refresh=60, delay=0, contentType="text/plain" ] {
    Channels:
        Type number : THL1_Temperature "Temperature 1" [ unit="°C", stateExtension="Get=all", stateTransformation="JSONPATH:$.THL1-TEMP" ]
        Type number : THL1_Humidity "Humidity 1" [ unit="%", stateExtension="Get=all", stateTransformation="JSONPATH:$.THL1-HUM" ]
        Type number : THL1_Illuminance "Illuminance 1" [ unit="lx", stateExtension="Get=all", stateTransformation="JSONPATH:$.THL1-LUM" ]
}

Enter your IP, PORT and apikey in the URL http://IP:PORT/api/xdevices.json?key=apikey&

IPX.items :

Group                   IPXxTHL_1           "IPX X-THL 1"            <iconify:cbi:motionsensor>    (Palier_Rdc)               ["Sensor"]
Number:Temperature      THL1_Temperature    "Temperature X-THL 1"    <f7:thermometer>              (IPXxTHL_1,Persistence)    ["Measurement", "Temperature"]    {channel="http:url:IPXxTHL:THL1_Temperature", unit="°C" , stateDescription=""[pattern="%.1f %unit%"], widgetOrder="1"}
Number:Dimensionless    THL1_Humidity       "Humidity X-THL 1"       <f7:drop>                     (IPXxTHL_1,Persistence)    ["Measurement", "Humidity"]       {channel="http:url:IPXxTHL:THL1_Humidity", unit="%" , stateDescription=""[pattern="%.0f %unit%"], widgetOrder="2"}
Number:Illuminance      THL1_Illuminance    "Illuminance X-THL 1"    <f7:light_max>                (IPXxTHL_1,Persistence)    ["Measurement", "Light"]          {channel="http:url:IPXxTHL:THL1_Illuminance", unit="lx" , stateDescription=""[pattern="%.0f %unit%"], widgetOrder="3"}
2 Likes

update things relais file
correction of an error, a transformation was missing

sorry