« Back to Product

Documentation

Shutter Control (legacy)

Warning

This is a deprecated version. From version 5.0 onwards it is recommended to use the new Shutter Control version.

To make the IP-Symcon shutter module hardware-independent, the module needs a script that takes care of passing the functions to the hardware.

Anyone with the following hardware can easily copy and use the script. Other hardware is easy to add. (More on that below the script).

Warning

Scripts executed by the shutter control include these System variables

  • Eaton Xcomfort Shutter
  • 1-Wire Shutter
  • Homematic (Thanks to hengesb )
  • LCN (Thanks to philipp )
  • FS20MS

This script normally only needs to exist once in IP-Symcon and can be accessed by any number of instances. Nothing needs to be edited.

Calibrate Shutters

In the second step, the times it takes for the shutter to move to the individual positions are measured. This calibration must be carried out twice. For up and down. To start, the corresponding button is pressed, whereupon the shutter should start moving. The button must be pressed again when the position labelled on it is reached.

Warning

After each teach-in, the values must be transferred with the “Set” button.

Tips & Tricks

Warning

When moving to 0% and 100%, five seconds are added to the driving time to reach a defined position.

Warning

If the runtime of the shutter is above the PHP script limit (180sec), it must be increased in php.ini. (see PHP)

Information for LCN users

With the script, the shutter module can be used universally to control the shutter/blind via the outputs as well as via the relays.

If the shutter module is to control a shutter/blind that is connected to the two outputs of a UPP/SH/HU, then the instance of output 1 of the module must be selected under “Instance1″ and the instance of output 2 of the module for “instance2″. This configuration then corresponds to the standard direction, as it is activated from the LCN-Pro by moving up or down. If the port is reversed, it is only necessary to change the assignment of output 1 and output 2 to the settings “Instance1″ and “Instance2″.

When operating with relays, the first relay of the two must always be specified for “Instance1". The first relay is the one that switches the power ON/OFF. “Instance2″ is always the relay that controls the direction.
If the direction of travel is to be rotated, this must be changed manually in the script. In the “case block for LCN” of the shutter script, there is a corresponding comment in both places.
If differently wired shutters/blinds on the relays are used, two shutter scripts must therefore be used for the respective configurations.

Shutter Script

//Variables provided by ShutterControl Module
    //IPS_LogMessage("InstanceID", $_IPS['INSTANCE']); /* InstanceID */
    //IPS_LogMessage("Direction", $_IPS['DIRECTION']); /* {0..2} Stop, Up, Down */
    //IPS_LogMessage("Duration", $_IPS['DURATION']); /* ms */

    if($_IPS['SENDER'] != "ShutterControl") {
        die("This script can only be started by the ShutterControl Module");
    }

    define("SC_DIRECTION_STOP", 0);
    define("SC_DIRECTION_UP", 1);
    define("SC_DIRECTION_DOWN", 2);

    $instance = IPS_GetInstance($_IPS['INSTANCE']);
    switch($instance['ModuleInfo']['ModuleID']) {

        //Siemens Device S7/LOGO
        case "{932076B1-B18E-4AB6-AB6D-275ED30B62DB}":
            switch($_IPS['DIRECTION']) {
                case SC_DIRECTION_STOP:
                    S7_WriteBit($_IPS['INSTANCE'], false);
                    S7_WriteBit($_IPS['INSTANCE2'], false);
                    break;

                case SC_DIRECTION_UP:
                    S7_WriteBit($_IPS['INSTANCE'], true);
                    if($_IPS['DURATION'] > 0) {
                        IPS_Sleep($_IPS['DURATION']);
                        S7_WriteBit($_IPS['INSTANCE'], false);
                    }
                    break;

                case SC_DIRECTION_DOWN:
                    S7_WriteBit($_IPS['INSTANCE2'], true);
                    if($_IPS['DURATION'] > 0) {
                        IPS_Sleep($_IPS['DURATION']);
                        S7_WriteBit($_IPS['INSTANCE2'], false);
                    }
                    break;
            }
        break;

        //FS20
        case "{48FCFDC1-11A5-4309-BB0B-A0DB8042A969}":
            $running = CreateVariableByName($_IPS['INSTANCE'], "Moving", 0);
            $value = GetValue(IPS_GetObjectIDByIdent("StatusVariable", $_IPS['INSTANCE']));
            switch($_IPS['DIRECTION']) {
                case SC_DIRECTION_STOP:
                    if(GetValue($running)) {
                        FS20_SwitchMode($_IPS['INSTANCE'], $value);
                        SetValue($running, false);
                    }
                    break;

                case SC_DIRECTION_UP:
                    if(!GetValue($running)) {
                        FS20_SwitchMode($_IPS['INSTANCE'], true);
                        SetValue($running, true);
                    }
                    if($_IPS['DURATION'] > 0) {
                        IPS_Sleep($_IPS['DURATION']);
                        FS20_SwitchMode($_IPS['INSTANCE'], true);
                        SetValue($running, false);
                    }
                    break;

                case SC_DIRECTION_DOWN:
                    if(!GetValue($running)) {
                        FS20_SwitchMode($_IPS['INSTANCE'], false);
                        SetValue($running, true);
                    }
                    if($_IPS['DURATION'] > 0) {
                        IPS_Sleep($_IPS['DURATION']);
                        FS20_SwitchMode($_IPS['INSTANCE'], false);
                        SetValue($running, false);
                    }
                    break;
            }
            break;

        //EnOcean
        case "{1463CAE7-C7D5-4623-8539-DD7ADA6E92A9}":
            switch($_IPS['DIRECTION']) {
                case SC_DIRECTION_STOP:
                    ENO_ShutterStop($_IPS['INSTANCE']);
                    break;

                case SC_DIRECTION_UP:
                    ENO_ShutterMoveUp($_IPS['INSTANCE']);
                    if($_IPS['DURATION'] > 0) {
                        IPS_Sleep($_IPS['DURATION']);
                        ENO_ShutterStop($_IPS['INSTANCE']);
                    }
                    break;

                case SC_DIRECTION_DOWN:
                    ENO_ShutterMoveDown($_IPS['INSTANCE']);
                    if($_IPS['DURATION'] > 0) {
                        IPS_Sleep($_IPS['DURATION']);
                        ENO_ShutterStop($_IPS['INSTANCE']);
                    }
                    break;
            }
            break;

        //digitalStrom
        case "{3DDA1E2B-B807-4680-AB6D-E7E8FBD6093A}":
            switch($_IPS['DIRECTION']) {
                case SC_DIRECTION_STOP:
                    DS_ShutterStop($_IPS['INSTANCE']);
                    break;

                case SC_DIRECTION_UP:
                    DS_ShutterMoveUp($_IPS['INSTANCE']);
                    if($_IPS['DURATION'] > 0) {
                        IPS_Sleep($_IPS['DURATION']);
                        DS_ShutterStop($_IPS['INSTANCE']);
                    }
                    break;

                case SC_DIRECTION_DOWN:
                    DS_ShutterMoveDown($_IPS['INSTANCE']);
                    if($_IPS['DURATION'] > 0) {
                        IPS_Sleep($_IPS['DURATION']);
                        DS_ShutterStop($_IPS['INSTANCE']);
                    }
                    break;
            }
            break;

        //xComfort
        case "{1B7B5B7D-CAA9-4AB5-B9D8-EC805EC955AD}":
            switch($_IPS['DIRECTION']) {
                case SC_DIRECTION_STOP:
                    MXC_ShutterStop($_IPS['INSTANCE']);
                    break;

                case SC_DIRECTION_UP:
                    MXC_ShutterMoveUp($_IPS['INSTANCE']);
                    if($_IPS['DURATION'] > 0) {
                        IPS_Sleep($_IPS['DURATION']);
                        MXC_ShutterStop($_IPS['INSTANCE']);
                    }
                    break;

                case SC_DIRECTION_DOWN:
                    MXC_ShutterMoveDown($_IPS['INSTANCE']);
                    if($_IPS['DURATION'] > 0) {
                        IPS_Sleep($_IPS['DURATION']);
                        MXC_ShutterStop($_IPS['INSTANCE']);
                    }
                    break;
            }
            break;

        //LCN Unit
        case "{2D871359-14D8-493F-9B01-26432E3A710F}":
            $type=IPS_GetProperty($_IPS['INSTANCE'],'Unit');
            switch($type) {
                //Outputs
                case 0:
                    switch($_IPS['DIRECTION'])
                    {
                        case SC_DIRECTION_STOP:
                            LCN_SetIntensity($_IPS['INSTANCE'],0,0);
                            LCN_SetIntensity($_IPS['INSTANCE2'],0,0);
                            break;

                        case SC_DIRECTION_UP:
                            LCN_SetIntensity($_IPS['INSTANCE'],100,4);
                            if($_IPS['DURATION'] > 0) {
                            IPS_Sleep($_IPS['DURATION']);
                            LCN_SetIntensity($_IPS['INSTANCE'],0,0);
                            }
                            break;

                        case SC_DIRECTION_DOWN:
                            LCN_SetIntensity($_IPS['INSTANCE2'],100,4);
                            if($_IPS['DURATION'] > 0) {
                            IPS_Sleep($_IPS['DURATION']);
                            LCN_SetIntensity($_IPS['INSTANCE2'],0,0);
                            }
                            break;
                    }
                    break;

                //Relay
                case 2:
                    switch($_IPS['DIRECTION']) {
                        case SC_DIRECTION_STOP:
                            LCN_SwitchRelay($_IPS['INSTANCE'],false);
                            break;

                        case SC_DIRECTION_UP:
                            LCN_SwitchRelay($_IPS['INSTANCE2'],false); //To change relay direction, please set it to true
                            LCN_SwitchRelay($_IPS['INSTANCE'],true);
                            if($_IPS['DURATION'] > 0) {
                                IPS_Sleep($_IPS['DURATION']);
                                LCN_SwitchRelay($_IPS['INSTANCE'],false);
                            }
                            break;

                        case SC_DIRECTION_DOWN:
                            LCN_SwitchRelay($_IPS['INSTANCE2'],true);//To change relay direction, please set false
                            LCN_SwitchRelay($_IPS['INSTANCE'],true);
                            if($_IPS['DURATION'] > 0) {
                                IPS_Sleep($_IPS['DURATION']);
                                LCN_SwitchRelay($_IPS['INSTANCE'],false);
                            }
                            break;
                    }
                    break;
            }
            break;

        //LCN Shutter
        case "{C81E019F-6341-4748-8644-1C29D99B813E}":
            switch($_IPS['DIRECTION']) {
                case SC_DIRECTION_STOP:
                    LCN_ShutterStop($_IPS['INSTANCE']);
                    break;

                case SC_DIRECTION_UP:
                    LCN_ShutterMoveUp($_IPS['INSTANCE']);
                    if($_IPS['DURATION'] > 0) {
                        IPS_Sleep($_IPS['DURATION']);
                        LCN_ShutterStop($_IPS['INSTANCE']);
                    }
                    break;

                case SC_DIRECTION_DOWN:
                    LCN_ShutterMoveDown($_IPS['INSTANCE']);
                    if($_IPS['DURATION'] > 0) {
                        IPS_Sleep($_IPS['DURATION']);
                        LCN_ShutterStop($_IPS['INSTANCE']);
                    }
                    break;
            }
            break;

        //1-Wire Shutter Modul (e-service Online)
        case "{BD0F2622-F67C-4248-9A04-316DF13914C3}":
            switch($_IPS['DIRECTION']) {
                case SC_DIRECTION_STOP:
                    OW_SetPin($_IPS['INSTANCE'], 0, true);
                    OW_SetPin($_IPS['INSTANCE'], 1, true);
                    IPS_Sleep(100);
                    OW_SetPin($_IPS['INSTANCE'], 0, false);
                    OW_SetPin($_IPS['INSTANCE'], 1, false);
                    break;

                case SC_DIRECTION_UP:
                    OW_SetPin($_IPS['INSTANCE'], 0, true);
                    IPS_Sleep(100);
                    OW_SetPin($_IPS['INSTANCE'], 0, false);
                    if($_IPS['DURATION'] > 0) {
                        IPS_Sleep($_IPS['DURATION']);
                        OW_SetPin($_IPS['INSTANCE'], 0, true);
                        OW_SetPin($_IPS['INSTANCE'], 1, true);
                        IPS_Sleep(100);
                        OW_SetPin($_IPS['INSTANCE'], 0, false);
                        OW_SetPin($_IPS['INSTANCE'], 1, false);
                    }
                    break;

                case SC_DIRECTION_DOWN:
                    OW_SetPin($_IPS['INSTANCE'], 1, true);
                    IPS_Sleep(100);
                    OW_SetPin($_IPS['INSTANCE'], 1, false);
                    if($_IPS['DURATION'] > 0) {
                        IPS_Sleep($_IPS['DURATION']);
                        OW_SetPin($_IPS['INSTANCE'], 0, true);
                        OW_SetPin($_IPS['INSTANCE'], 1, true);
                        IPS_Sleep(100);
                        OW_SetPin($_IPS['INSTANCE'], 0, false);
                        OW_SetPin($_IPS['INSTANCE'], 1, false);
                    }
                    break;
            }
          break;

        //1-Wire Shutter (1-wire.de)
        case "{6A75828A-25CD-4CF3-83EA-DAAB914030A7}":
            switch($_IPS['DIRECTION']) {
                case SC_DIRECTION_STOP:
                    OneWireShutter($_IPS['INSTANCE'], 0, $_IPS['DURATION']);
                    break;

                case SC_DIRECTION_UP:
                    if($_IPS['DURATION'] == 0) {
                        $_IPS['DURATION'] = 120000;
                    }
                    OneWireShutter($_IPS['INSTANCE'], 0, $_IPS['DURATION']);
                    break;

                case SC_DIRECTION_DOWN:
                    if($_IPS['DURATION'] == 0) {
                        $_IPS['DURATION'] = 120000;
                    }
                    OneWireShutter($_IPS['INSTANCE'], 1, $_IPS['DURATION']);
                    break;
            }
            break;

        //Homematic Shutter
        case "{EE4A81C6-5C90-4DB7-AD2F-F6BBD521412E}":
            switch($_IPS['DIRECTION']) {
                case SC_DIRECTION_STOP:
                    HM_WriteValueBoolean($_IPS['INSTANCE'], "STOP", true);
                    break;

                case SC_DIRECTION_UP:
                    HM_WriteValueFloat($_IPS['INSTANCE'], "LEVEL", 1.0);
                    if($_IPS['DURATION'] > 0) {
                        IPS_Sleep($_IPS['DURATION']);
                        HM_WriteValueBoolean($_IPS['INSTANCE'], "STOP", true);
                    }
                    break;

                case SC_DIRECTION_DOWN:
                    HM_WriteValueFloat($_IPS['INSTANCE'], "LEVEL", 0.0);
                    if($_IPS['DURATION'] > 0) {
                        IPS_Sleep($_IPS['DURATION']);
                        HM_WriteValueBoolean($_IPS['INSTANCE'], "STOP", true);
                    }
                    break;
            }
            break;

        //DMXOUT
        case "{E19C2E41-7347-4A3B-B7D9-A9A88E0D133E}":
            switch($_IPS['DIRECTION']) {
                case SC_DIRECTION_STOP:
                    DMX_SetValue($_IPS['INSTANCE'],1,0); //Relay Up 
                    DMX_SetValue($_IPS['INSTANCE2'],1,0); //Relay Down
                    break;

                case SC_DIRECTION_UP:
                    DMX_SetValue($_IPS['INSTANCE2'],1,0); //Relay Down
                    DMX_SetValue($_IPS['INSTANCE'],1,255); //Relay Up
                    if($_IPS['DURATION'] > 0) {
                        IPS_Sleep($_IPS['DURATION']);
                        DMX_SetValue($_IPS['INSTANCE'],1,0); //Relay Up
                    }
                    break;

                case SC_DIRECTION_DOWN:
                    DMX_SetValue($_IPS['INSTANCE'],1,0); //Relay Up
                    DMX_SetValue($_IPS['INSTANCE2'],1,255); //Relay Down
                    if($_IPS['DURATION'] > 0) {
                        IPS_Sleep($_IPS['DURATION']);
                        DMX_SetValue($_IPS['INSTANCE2'],1,0); //Relay Down
                    }
                break;
            }
        break;

        default:
            die("No Handler for Module ".$instance['ModuleInfo']['ModuleName']." found");
    }

    function OneWireShutter($ins, $dir, $sec) {
        @OW_SetStrobe($ins, True);
        $res = ($dir * 128) + ($sec / 1000);
        @OW_SetPort((integer)$ins, (integer)$res);
    }

    function CreateVariableByName($id, $name, $type) {
        $vid = @IPS_GetVariableIDByName($name, $id);
        if($vid===false) {
            $vid = IPS_CreateVariable($type);
            IPS_SetParent($vid, $id);
            IPS_SetName($vid, $name);
            IPS_SetInfo($vid, "This Variable was created by Script");
        }
        return $vid;
    }

Information to extend the script

Three parameters are always transferred when a call is made.

  • The InstanceID of the “Transmit Device” set in the shutter control instance
  • The direction in which to move.
  • The time for which should be moved. (This value is 0 for STOP and for the TEST buttons in the properties page)

The GUIDs for the respective module must be inserted in the “case statements”. All IP-Symcon functions can be used. No output may be generated (echo), otherwise this is considered an error and will be displayed in the message log and the status of the “position” variable will not be updated.

Any questions?