• 10 dec 2017: forum version update. In case of issues use this topic.
  • 30 nov 2017: pilight moved servers. In case of issues use this topic.
Hello There, Guest! Login Register


Quigg GT-1000
#11
@wo_rasp,

I am trying to make a similar, but more generic protocol, that takes two raw strings (as one can get with pilight-debug), instead of decimal addresses. That should be possible too, I assume.
This way you wouldn't need to make a separate intermediate protocol for other switches that aren't supported yet.
 
Reply
#12
In principle you are right, but on protocols with 150 pulses and 10 variables mistakes are difficult to spot, thus I prefer an approach to use one digit to point to an array with defined pulses substituting the digit at run time.
send from tapatalk
 
Reply
#13
I agree that finding mistakes in long strings would be difficult, but the idea I had, was that once you would have found raw codes that are working well using pilight-send with the raw protocol, you could simply copy the code strings from the pilight-send -p raw command strings and paste them into the appropriate fields of the config file.

But it was just an idea and because I kept running into Segmentation faults, I have given up efforts to make such a protocol myself too.
 
Reply
#14
Hello!
My three intertechno-switches are working well for about 1,5 years without any problems. Thank you everybody for doing this great job!
Last time in december I was at Aldi I've seen a set of 4 switches of the branch Globaltronics. Because I could remember that there is an existing protocol of Globaltronics (quigg) I bought the set. But at home I was not able to really integrate the switches in pilight until now.

Short description of the devices:
The remote control is white. The product is called GT-9000, manufactured/imported by Globaltronics Hamburg. It has 10 buttons (8 buttons for channel 1 to 4, ON/OFF and additional 2 buttons for all channels ON/OFF). The sending of any code is indicated by a blue LED-light.

The white switches: selflearning devices called GT-FSI-07. It is possible to connect lamps etc. up to 3600 Watt (16A/230V) - for me a big advantage because I could control a few machines in my joinery...
Another advantage is, that it is possible to learn a switch more than one channel. So you can e.g. switch on the same lamp by pressing the channel 1 and the channel 4 button. The next lamp you can also switch on by pressing the channel 1 and the channel 3 button an so on. My old intertechno wasn't able to do this. One channel -- one switch.
The status ON is indicated by a blue LED too.
Without any connected device the switch needs about 3 Watt permanent (my old one's need about 5 Watt).
So I like this switches and I hope I can intergrate it to my pilight - system.

I've got the raw-codes of the channels 1-4 and the ALL-buttons and I'm able to control the switches using the pilight-send -p raw -c <raw-code> command.

Code:
ALL_ON
--[RESULTS]--

time:           Tue Jan  6 10:29:33 2015
hardware:       433gpio
pulse:          14
rawlen:         50
binlen:         12
pulselen:       214

Raw code:
428 1070 1070 642 428 1070 1070 642 856 642 428 1070 428 1070 428 1070 1070 642 428 1070 428 1070 428 1070 1070 642 1070 642 428 1070 1070 642 1070 642 428 1070 1070 642 428 1070 1070 642 428 1070 1070 642 428 1070 2996 7276
Binary code:
000000000000


ALL_OFF
--[RESULTS]--

time:           Tue Jan  6 10:30:06 2015
hardware:       433gpio
pulse:          14
rawlen:         50
binlen:         12
pulselen:       213

Raw code:
426 1065 1065 639 426 1065 1065 639 1065 639 426 1065 1065 639 426 1065 426 1065 852 639 1065 639 1065 639 426 1065 1065 639 426 1065 426 1065 426 1065 426 1065 1065 639 1065 639 1065 639 426 1065 1065 639 426 1065 2982 7242
Binary code:
000000000000

Channel 1 OFF
Raw code:
426 1065 1065 639 426 1065 1065 639 426 1065 426 1065 1065 639 426 1065 426 1065 426 1065 1065 639 1065 639 1065 639 1065 639 426 1065 426 1065 426 1065 426 1065 1065 639 426 1065 426 1065 426 1065 426 1065 426 1065 2982 7242

Channel 1 ON
Raw code:
426 1065 1065 639 426 1065 1065 639 426 1065 426 1065 426 1065 1065 639 1065 639 1065 639 1065 639 1065 639 1065 639 426 1065 1065 639 1065 639 1065 639 426 1065 1065 639 1065 639 426 1065 426 1065 426 1065 426 1065 2982 7242

Channel 2 OFF
Raw code:
426 1065 1065 639 426 1065 1065 639 426 1065 426 1065 1065 639 426 1065 426 1065 426 1065 1065 639 1065 639 1065 639 1065 639 426 1065 426 1065 426 1065 426 1065 1065 639 426 1065 426 1065 1065 639 426 1065 426 1065 2982 7242

Channel 2 ON
Raw code:
426 1065 1065 639 426 1065 1065 639 1065 639 1065 639 1065 639 1065 639 1065 639 1065 639 1065 639 426 1065 426 1065 1065 639 1065 639 1065 639 426 1065 1065 639 1065 639 1065 639 426 1065 1065 639 426 1065 426 1065 2982 7242

Channel 3 OFF
Raw code:
426 1065 1065 639 426 1065 1065 639 426 1065 1065 639 1065 639 1065 639 426 1065 426 1065 426 1065 1065 639 1065 426 426 1065 1065 639 426 1065 426 1065 426 1065 426 1065 1065 639 1065 639 1065 639 426 1065 426 1065 2982 7242

Channel 3 ON
Raw code:
428 1070 1070 642 428 1070 1070 642 428 1070 428 1070 428 1070 1070 642 1070 642 1070 642 1070 642 1070 642 1070 642 428 1070 1070 642 1070 642 1070 642 428 1070 1070 642 1070 642 1070 642 1070 642 428 1070 428 1070 2996 7276

Channel 4 OFF
Raw code:
410 1025 1025 615 410 1025 1025 615 410 1025 410 1025 1025 615 1025 615 1025 615 410 1025 410 1025 1025 615 1025 615 1025 615 1025 615 410 1025 410 1025 1025 615 410 1025 410 1025 410 1025 410 1025 1025 615 410 1025 3280 6970

Channel 4 ON
Raw code:
426 1065 1065 639 426 1065 1065 639 1065 639 1065 639 426 1065 1065 639 1065 639 1065 639 426 1065 426 1065 426 1065 426 1065 426 1065 1065 639 852 639 426 1065 426 1065 1065 639 426 1065 426 1065 1065 639 426 1065 2982 7242

Maybe I can interpreted the 0-bit by the sequenz of approx. 430 to 1030 impulses and 1-bit by the approx. 1020 to 620 impulses.
If that is correct I'll get the following bit table:

Bit_ ABCDEFGHIJKLMNOPQRSTUVWX
1_ON 010100011111101110110000
2_ON 010111111110011101110100
3_ON 010100011111101110111100
4_ON 010111011100000110010010
*_ON 010110001000110110101010

1OFF 010100100011110000100000
2OFF 010100100011110000100100
3OFF 010101110001101000011100
4OFF 010100111001111001000010
*OFF 010110100111010000111010

Now I think the bits A-D (because they are all the same) are the ID.
Maybe the bit P is to switch on/off .

But how do I use it from the webgui?

I tried all supported protocols but without success.
As far as I know it is not possible to send the raw-code via the webgui - I need a protocol. But I'm no programmer so I'm not able to write a protocol.

Can anybody help me, please?
Best wishes, Markus!
 
Reply
#15
@wo_rasp

In case you are interested, this is the final version of my fully working intermediate quigg_gt1000 protocol (with decimal "addresses"). I defined the pulslengths and rawlenght as constants in the program. This makes it easy to adapt it for other switches.

quigg_gt1000.c:

Code:
/*
    Copyright (C) 2015 CurlyMo & Niek

    This file is part of pilight.

    pilight is free software: you can redistribute it and/or modify it under the
    terms of the GNU General Public License as published by the Free Software
    Foundation, either version 3 of the License, or (at your option) any later
    version.

    pilight is distributed in the hope that it will be useful, but WITHOUT ANY
    WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
    A PARTICULAR PURPOSE.  See the GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with pilight. If not, see    <http://www.gnu.org/licenses/>
*/

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

#include "../../pilight.h"
#include "common.h"
#include "dso.h"
#include "log.h"
#include "protocol.h"
#include "hardware.h"
#include "binary.h"
#include "gc.h"
#include "quigg_gt1000.h"

#define PULSE_QUIGG_GT1000_SHORT 500
#define PULSE_QUIGG_GT1000_LONG 1000
#define PULSE_QUIGG_GT1000_FOOTER1 3000
#define PULSE_QUIGG_GT1000_FOOTER2 7000
#define RAWLEN_QUIGG_GT1000 50

static void quigg_gt1000CreateMessage(int id, int address_on, int address_off, int state) {
    quigg_gt1000->message = json_mkobject();
    json_append_member(quigg_gt1000->message, "id", json_mknumber(id, 0));
    json_append_member(quigg_gt1000->message, "address_on", json_mknumber(address_on, 0));
    json_append_member(quigg_gt1000->message, "address_off", json_mknumber(address_off, 0));
    if(state == 1) {
        json_append_member(quigg_gt1000->message, "state", json_mkstring("on"));
    } else {
        json_append_member(quigg_gt1000->message, "state", json_mkstring("off"));
    }
}


static void quigg_gt1000CreateLow(int s) {

        quigg_gt1000->raw[s]=PULSE_QUIGG_GT1000_SHORT;
        quigg_gt1000->raw[s+1]=PULSE_QUIGG_GT1000_LONG;
}


static void quigg_gt1000CreateHigh(int s) {

        quigg_gt1000->raw[s]=PULSE_QUIGG_GT1000_LONG;
        quigg_gt1000->raw[s+1]=PULSE_QUIGG_GT1000_SHORT;

}

static void quigg_gt1000ClearCode(void) {
    int i=0;
    for(i=0;i<=(RAWLEN_QUIGG_GT1000/2)-2;i++){
    quigg_gt1000CreateLow(i*2);
    }
}

static void quigg_gt1000CreateBody(int address) {
    int binary[RAWLEN_QUIGG_GT1000];
    int length = 0;
    int i = 0, x = 0, y = 0;
    int lead = 0;
    length = decToBin(address, binary);
    lead = (RAWLEN_QUIGG_GT1000/2) - 2 - length;

    //create leading low pulses
        if (lead > 0){
        for(i=0;i<lead;i++){
                y=2*i;
                    quigg_gt1000CreateLow(y);
                }
    }
    for(i=0;i<=length;i++){
    x=2*(i+lead);
    if(binary[i]==1) {
            quigg_gt1000CreateHigh(x);
        }
        else{
            quigg_gt1000CreateLow(x);
        }
    }
}

static void quigg_gt1000CreateFooter(void) {
    quigg_gt1000->raw[RAWLEN_QUIGG_GT1000 - 2]=PULSE_QUIGG_GT1000_FOOTER1;
    quigg_gt1000->raw[RAWLEN_QUIGG_GT1000 - 1]=PULSE_QUIGG_GT1000_FOOTER2;
}

static int quigg_gt1000CreateCode(JsonNode *code) {
    int id  = -1;
    int address_on = -1;
    int address_off = -1;
    int address = 0;
    int state = -1;
    double itmp = 0;

    if(json_find_number(code, "id", &itmp) == 0)
        id = (int)round(itmp);
    if(json_find_number(code, "address_on", &itmp) == 0)
        address_on = (int)round(itmp);
    if(json_find_number(code, "address_off", &itmp) == 0)
        address_off = (int)round(itmp);

    if(json_find_number(code, "off", &itmp) == 0)
        state=0;
    else if(json_find_number(code, "on", &itmp) == 0)
        state=1;

    if(address_on == -1 || address_off == -1 || state == -1 || id == -1) {
        logprintf(LOG_ERR, "quigg_gt1000: insufficient number of arguments");
        return EXIT_FAILURE;
    } else if(address_on > 16777215 || address_on < 0) {
        logprintf(LOG_ERR, "quigg_gt1000: invalid address_on range");
        return EXIT_FAILURE;
    } else if(address_off > 16777215 || address_off < 0) {
        logprintf(LOG_ERR, "quigg_gt1000: invalid address_off range");
        return EXIT_FAILURE;
    } else {
        
        if(state==1){
            address=address_on;
        }
        else{
            address=address_off;
        }
        quigg_gt1000CreateMessage(id, address_on, address_off, state);
        quigg_gt1000ClearCode();
        quigg_gt1000CreateBody(address);
        quigg_gt1000CreateFooter();
    }
    return EXIT_SUCCESS;
}

static void quigg_gt1000PrintHelp(void) {
    printf("\t -i --id=id\t\t\treference to physical device (not used for protocol)\n");
    printf("\t -x --address_on=address_on\tdecimal address used to switch device on\n");
    printf("\t -y --address_off=address_off\tdecimal address used to switch device off\n");
    printf("\t -t --on\t\t\tsend an on signal\n");
    printf("\t -f --off\t\t\tsend an off signal\n");
}

#ifndef MODULE
__attribute__((weak))
#endif
void quigg_gt1000Init(void) {

    protocol_register(&quigg_gt1000);
    protocol_set_id(quigg_gt1000, "quigg_gt1000");
    protocol_device_add(quigg_gt1000, "quigg_gt1000", "quigg_gt1000 Switches");
    quigg_gt1000->devtype = SWITCH;
    quigg_gt1000->hwtype = RF433;
    quigg_gt1000->rawlen = RAWLEN_QUIGG_GT1000;
    
    options_add(&quigg_gt1000->options, 'i', "id", OPTION_HAS_VALUE, DEVICES_ID, JSON_NUMBER, NULL, "^([0-9]{1}|[1][0-5])$");
    options_add(&quigg_gt1000->options, 'x', "address_on", OPTION_HAS_VALUE, DEVICES_ID, JSON_NUMBER, NULL, NULL);
    options_add(&quigg_gt1000->options, 'y', "address_off", OPTION_HAS_VALUE, DEVICES_ID, JSON_NUMBER, NULL, NULL);
    options_add(&quigg_gt1000->options, 't', "on", OPTION_NO_VALUE, DEVICES_STATE, JSON_STRING, NULL, NULL);
    options_add(&quigg_gt1000->options, 'f', "off", OPTION_NO_VALUE, DEVICES_STATE, JSON_STRING, NULL, NULL);
    options_add(&quigg_gt1000->options, 0, "gui-readonly", OPTION_HAS_VALUE, DEVICES_SETTING, JSON_NUMBER, (void *)0, "^[10]{1}$");

    quigg_gt1000->createCode=&quigg_gt1000CreateCode;
    quigg_gt1000->printHelp=&quigg_gt1000PrintHelp;
}

#ifdef MODULE
void compatibility(struct module_t *module) {
    module->name = "quigg_gt1000";
    module->version = "1.0";
    module->reqversion = "5.0";
    module->reqcommit = NULL;
}

void init(void) {
    quigg_gt1000Init();
}
#endif

quigg_gt1000.h

Code:
/*
    Copyright (C) 2015 CurlyMo & Niek

    This file is part of pilight.

    pilight is free software: you can redistribute it and/or modify it under the
    terms of the GNU General Public License as published by the Free Software
    Foundation, either version 3 of the License, or (at your option) any later
    version.

    pilight is distributed in the hope that it will be useful, but WITHOUT ANY
    WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
    A PARTICULAR PURPOSE.  See the GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with pilight. If not, see    <http://www.gnu.org/licenses/>
*/

#ifndef _PROTOCOL_QUIGG_GT1000_H_
#define _PROTOCOL_QUIGG_GT1000_H_

struct protocol_t *quigg_gt1000;
void quigg_gt1000Init(void);

#endif
[/code]
 
Reply
#16
I will merge if @wo_rasp approves.
 
Reply
#17
@markus2004
I checked your code, and I can tell you that I'm sure for 99% that your switches are compatible with the Quigg GT-FSI-08 with RC type GT-1000. Most of your codes do work with my switches. Most, but not all. So I need you to verify two codes
The first one is the code:
4_ON 010111011100000101101101
IMO this one should be (in accordance with your raw code):
4_ON 010111011100000110010010
My switch responds to this last code and not to your's. Probably a mistake in the conversion from raw to bits?

The second one is the code:
2OFF 010100111001001001000100
Your raw code for this one probably contains an error. When I convert that one to bits I get a different result, but still an unresponsive code.

So 9 out of 10 codes (assumming the corrected 4_ON is oke) do work with my switch. I.e I can program the switch to listen to the code. Therefore I assume the 2Off code is in error.
Please, do check it for me.
[added] I found the correct code for 2Off, it should be 2OFF 010101110001101000010100
Another possible Off code I found is: 2OFF 010100100011110000100100

Recently I got a set of Quigg GT-FSI-08 switches with a GT-1000 RC. And of course I also want to control these switches from within pilight. So, I did some research and my findings are more or less the same as reported by others in this thread. However there are a few differences:
1. The pulse sequence starts with a small High (approx 350μs) followed by a long Low (2350μs).
2. The first 4 bits following this start pulse can indeed interpreted as group-id, while the last 4 bits can be seen as unit-id. But looking at the different codes as reported here and elsewhere, it is clear that there are two different code schemes for coding the unit-id.
3. The middle 16 bits form a kind of rolling code in a sequence of 4. But the switches do react to any of these codes in any order.
4. IMO the middle 16 bits are more or less "random", i.e. no single or group of bits have special meanings. So these codes can not be "constructed" and therefore a complete implementation of this protocol in pilight do need a table of 640 16-bit codes (16*10*4 codes).
5. I already collected codes for this Quigg switch, but also for the compatible switches from Lidl and Brennenstuhl as found on this forum mostly. Yes I verified that the switches from Lidl and Brennenstul are code compatible with the Quigg swithes. That is: I can program and use my switches with all the codes found so far.
6. I put al the codes found in a file. But since this file will probably be updated in the future I stored it in the cloud. You can find it here And I repeat: I have tried all the codes succesfully with my switches.
7. In a few days I will publish a perl script that can be used to call pilight-send with the raw protocol to program and use the switches with any of the codes. IMO that script could be a good starting point for a pilight implementation of this protocol.
 
Reply
#18
Hello RinusW!
You're right! Sorry, I made some mistakes.
Now I've corrected the rawcode of button 2 OFF and the bitseries in my post. Both, button 2_OFF and button 4_ON
regards Markus
 
Reply
#19
So. as promised herewith my perl script to program and switch your Quigg GT-FSI-08 switches. Place this script in the pi home directory of you RaspberryPi, name it SendQuiggCode.pl and call it with:
./SendQuiggCode.pl <id> <switch> <state> [codeseq] [repeats]
Where <id> is the group-id (0..15) you want to use. Notice that not all group-id's have valid code sequences yet. You will get an appropriate error message if no codes available.
<switch> is your switch number (a,b,c,d or m). You get an error message when there is no code sequence available for the selected switch.
<state> is the wanted state (on, off) of your switch. Notice that in order to program a switch you need to select the on state.
[codeseq] optional you may specify the code sequence (1..4) that should be used. If there is no specified code sequence the sequence 1 for that group will be used and you get an appropriate message.
[repeats] optional the number of times you want to repeat this code. Notice that each repeat (for the default 1 times too) means that the code sequence is actually send 3 times by pilight. The first 2 times with a short start pulse, and the last time with a long start pulse. This is necessary for programming the switch. You could look at the last sequence as the program sequence.

This perl script is based on a script published earlier by Lary_Loose for the Lidl switches. See his contribution here

Let me know if there are unclear things, difficulties, or whatever. And if you discovered your own codes for your group-id, do publish them here.

SendQuiggCode.pl script:
Code:
#!/usr/bin/perl
## This script creates raw code sequences for Quigg GT-FSI-08 switches and compatibles.
## The script is based on a script published earlier by Lary_Loose
## see http://forum.pilight.org/Thread-Lidl-radio-outlets?page=2
##
## All codes are testen and do work with the Quigg switches. For some group-id not all 4
## codes per switch are known. But then, you only need a single code per switch action.
## A11 means unit A first ON code, A12 the second ON code, A01 the first OFF code ...
## M is the Master code, which switches all the units. The rest should be self explaining.
## If needed adjust the pilight-send path in the $exe variable.
##
## You  need to specify wanted group-id (0 .. 15), switch unit (a,b,c,d or m) and state (on,off)
## You may specify the code sequence to use (1..4) and the number of repeats. When you specify
## a group-id for which there are no codes available you get an error message. When you specify
## a code sequence that has not been specified, then code sequence 1 will be used or if not
## available another error message will be given. But the script is no foll prove, so other
## error messages and program halts will be possible.
##
## Notice that a code sequence is repeated 3 times, the first two with a short start pulse
## (350 us high, 2340 us low) and the last one with a long start pulse (3000 us high, 7300 us low)
## The first tow are needed for teh on-off switch actions, all three together are for programming a switch.


use strict;
use warnings;
$. = ' ';

if (@ARGV < 3)
{
    use File::Basename;
    printf("usage:\n %s <id> <unit> <state> [codeseq] [repeat]\n", basename($0));
    printf("  id:     [0..15]\n");
    printf("  unit:   [ A B C D M ]\n");
    printf("  state:  [ on off ]\n");
    printf("  codeseq:[1 2 3 4]\n");
    printf("  repeat: [ 0 1 2 ... ]\n");
    exit 1;
}

my $exe = '/usr/local/bin/pilight-send -p raw -c ';
my $id = $ARGV[0];
my $unit = uc($ARGV[1]);
my $istate = (uc($ARGV[2]) eq 'ON') ? 1 : 0;
my $codeseq = ($ARGV[3]) ? $ARGV[3] : (int(rand(4))+1);
my $repeat = ($ARGV[4]) ? $ARGV[4] : 0;

my %code0;
my %code1;
my %code2;
my %code3;
my %code4;
my %code5;
my %code6;
my %code7;
my %code8;
my %code9;
my %code10;
my %code11;
my %code12;
my %code13;
my %code14;
my %code15;

%code14 = (
# codes for switches RvW
    'A11', '0000101011010110', 'A12', '1011110110100001', 'A13', '1100010001100101', 'A14', '0110111101001010',
    'A01', '1110011010010010', 'A02', '1001100011111000', 'A03', '0101011101111011', 'A04', '0101011101111011',
    'B11', '0001001110000011', 'B12', '1101110000101111', 'B13', '0100000011001110', 'B14', '0011111000000000',
    'B01', '1111001000110100', 'B02', '1000100111101100', 'B03', '0010010100011001', 'B04', '0111000101011101',
    'C11', '0101011101111011', 'C12', '1010101110110111', 'C13', '1110011010010010', 'C14', '1001100011111000',
    'C01', '1011110110100001', 'C02', '1100010001100101', 'C03', '0110111101001010', 'C04', '0000101011010110',
    'D11', '0111000101011101', 'D12', '1111001000110100', 'D13', '1000100111101100', 'D14', '0010010100011001',
    'D01', '1101110000101111', 'D02', '0100000011001110', 'D03', '0011111000000000', 'D04', '0001001110000011',
    'M11', '1010101110110111', 'M12', '0101011101111011', 'M13', '1001100011111000', 'M14', '1110011010010010',
    'M01', '0000101011010110', 'M02', '0110111101001010', 'M03', '1100010001100101', 'M04', '1011110110100001'
);
%code1 = (
# codes from Oitzu for Lidl radio outlets
    'A11', '1111010110011011', 'A12', '1110100100100011', 'A13', '0001010011000100', 'A14', '0011001010100111',
    'A01', '0110000101101010', 'A02', '1100111101110001', 'A03', '0111101011100010', 'A04', '1011011000111001',
    'B11', '0001010011000100', 'B12', '0011001010100111', 'B13', '1111010110011011', 'B14', '1110100100100011',
    'B01', '0110000101101010', 'B02', '1011011000111001', 'B03', '1100111101110001', 'B04', '0111101011100010',
    'C11', '1110100100100011', 'C12', '1111010110011011', 'C13', '0001010011000100', 'C14', '0011001010100111',
    'C01', '1100111101110001', 'C02', '0110000101101010', 'C03', '0111101011100010', 'C04', '1011011000111001',
    'D11', '0111101011100010', 'D12', '0110000101101010', 'D13', '1100111101110001', 'D14', '1011011000111001',
    'D01', '0001010011000100', 'D02', '1110100100100011', 'D03', '1111010110011011', 'D04', '0011001010100111',
    'M11', '0111101011100010', 'M12', '0110000101101010', 'M13', '1011011000111001', 'M14', '1100111101110001',
    'M01', '0001010011000100', 'M02', '1110100100100011', 'M03', '1111010110011011', 'M04', '0011001010100111'
);
%code3 = (
# codes from Lary Loose for Lidl radio outlets
    'A11', '0000011001111010', 'A12', '0010100100000001', 'A13', '1011000110110110', 'A14', '1110101000110101',
    'A01', '0011001011010111', 'A02', '0111110101001011', 'A03', '1001010010000010', 'A04', '1100100000011000',
    'B11', '0001111110100000', 'B12', '0100110011001111', 'B13', '1010011110010011', 'B14', '1101000000101110',
    'B01', '0101101101011100', 'B02', '0110001101100100', 'B03', '1000010111111001', 'B04', '1111111011101101',
    'C11', '0011001011010111', 'C12', '0111110101001011', 'C13', '1001010010000010', 'C14', '1100100000011000',
    'C01', '0000011001111010', 'C02', '0010100100000001', 'C03', '1011000110110110', 'C04', '1110101000110101',
    'D11', '0101101101011100', 'D12', '0110001101100100', 'D13', '1000010111111001', 'D14', '1111111011101101',
    'D01', '0001111110100000', 'D02', '0100110011001111', 'D03', '1010011110010011', 'D04', '1101000000101110',
    'M11', '0011001011010111', 'M12', '0111110101001011', 'M13', '1001010010000010', 'M14', '1100100000011000',
    'M01', '0000011001111010', 'M02', '0010100100000001', 'M03', '1011000110110110', 'M04', '1110101000110101'
);
%code10 = (
# see https://github.com/peterand/BATsender for Lidl outlets
    'A11', '0100011000001010', 'A12', '0111011111100110', 'A13', '0110100101110001', 'A14', '1011101100100101',
    'A01', '1110000001010111', 'A02', '1111010011110010', 'A03', '1001111010011000', 'A04', '1100001010101011',
    'B11', '1101101001000000', 'B12', '0010001100010011', 'B13', '0011100001101111', 'B14', '1010110100111110',
    'B01', '0001010110001001', 'B02', '0000110010111101', 'B03', '0101000111000100', 'B04', '1000111111011100',
    'C11', '1001111010011000', 'C12', '1100001010101011', 'C13', '1110000001010111', 'C14', '1111010011110010',
    'C01', '0100011000001010', 'C02', '0111011111100110', 'C03', '0110100101110001', 'C04', '1011101100100101',
    'D11', '0000110010111101', 'D12', '0101000111000100', 'D13', '1000111111011100', 'D14', '0001010110001001',
    'D01', '0010001100010011', 'D02', '0011100001101111', 'D03', '1010110100111110', 'D04', '1101101001000000',
    'M11', '1001111010011000', 'M12', '1111010011110010', 'M13', '1110000001010111', 'M14', '1100001010101011',
    'M01', '0100011000001010', 'M02', '1011101100100101', 'M03', '0110100101110001', 'M04', '0111011111100110'
);
%code9 = (
# only 1 code per action
    'A11', '0110111011100111', 'A01', '1100000010100010', 'B11', '0110111011100111', 'B01', '1100000010100010',
    'C11', '0000001011111011', 'C01', '0001101100011010', 'D11', '0001101100011010', 'D01', '0110111011100111',
    'M11', '0111010111000001', 'M01', '0110111011100111'
);
%code15 = (
# only 1 code per action, no M code
    'A11', '0010011000110110', 'A01', '1001101100011011', 'B11', '1010100001011111', 'B01', '0101010011001100',
    'C11', '0001000001100111', 'C01', '1110010110110101', 'D11', '1100011111010100', 'D01', '0111001010010000'
);
%code5 = (
# all verified
    'A11', '0001111110111011', 'A12', '0011100111100100', 'A13', '1010011101000011', 'A14', '1111111001110111',
    'A01', '0010001111000010', 'A02', '0111000110100001', 'A03', '1000100011011010', 'A04', '1101110000011001',
    'B11', '0001111110111011', 'B12', '0011100111100100', 'B13', '1010011101000011', 'B14', '1111111001110111',
    'B01', '0010001111000010', 'B02', '0111000110100001', 'B03', '1000100011011010', 'B04', '1101110000011001',
    'C11', '0001111110111011', 'C12', '0011100111100100', 'C13', '1010011101000011', 'C14', '1111111001110111',
    'C01', '0010001111000010', 'C02', '0111000110100001', 'C03', '1000100011011010', 'C04', '1101110000011001',
    'D11', '0010001111000010', 'D12', '0111000110100001', 'D13', '1000100011011010', 'D14', '1101110000011001',
    'D01', '0001111110111011', 'D02', '0011100111100100', 'D03', '1010011101000011', 'D04', '1111111001110111',
    'M11', '0010001111000010', 'M12', '0111000110100001', 'M13', '1000100011011010', 'M14', '1101110000011001',
    'M01', '0001111110111011', 'M02', '0011100111100100', 'M03', '1010011101000011', 'M04', '1111111001110111'
);

my @codes = (\%code0, \%code1, \%code2, \%code3, \%code4, \%code5, \%code6, \%code7,
            \%code8, \%code9, \%code10, \%code11, \%code12, \%code13, \%code14, \%code15); #contains reference to

if (! %{$codes[$id]}) { # test if there is a code hash for this group-id
    printf("For group-id %d there is no code available!\n", $id);
    exit(1);
}

my %unitselo = (
#select unitcode for selected headers ("old" switches)
    'A', '0000', 'B', '0100', 'C', '1100', 'D', '0010', 'M', '1010'
);

my %unitseln = (
#select unitcode for latest switches
    'A', '1100', 'B', '0101', 'C', '1110', 'D', '0111', 'M', '0010'
);

my $unitsel = \%unitseln;
foreach (1, 5, 9) { # specify group-id for which the "old" switch select is valid.
    if ($_ == $id) {
        $unitsel = \%unitselo;
    }
}

my $starthi = 350;
my $startlo = 2340;
my $proghi = 3000;
my $proglo = 7300;
my $highmark = 1100; # high value duration for logic 1
my $highspace = 440; # low value duration for logic 1
my $lowmark = 330;   # high value duration for logic 0
my $lowspace = 1210; # low value duration for logic 0
my $starter = "$starthi $startlo"; # normal start pulse
my $progter = "$proghi $proglo";   # long start pulse for programmode
my $footer = "200";
my $high = "$highmark $highspace"; # pulse for logic 1
my $low = "$lowmark $lowspace";    # pulse for logic 0

my $bincode = $codes[$id]->{"$unit$istate$codeseq"}; #indirection @{$codes[index]} or with ->
if (! defined($bincode)) { # if no hash code available
    my $codeseq_old = $codeseq;
    $codeseq=1;
    $bincode = $codes[$id]->{"$unit$istate$codeseq"};
    if (! defined($bincode)) { # if still no hash code available
        printf("Could not find any codeseq for switch %d:%1s-%s. Aborting!\n", $id, $unit, $ARGV[2]);
        exit(1);
    }
    printf("For group-id %d there is no codeseq# %d. Using 1 instead!\n", $id, $codeseq_old);
}
$bincode = sprintf("%04b", $id).$bincode.$unitsel->{$unit};
printf("Code#%s for switch %d:%1s-%s = %s\n",$codeseq, $id, $unit, $ARGV[2], $bincode);

my @rawcode;
for my $i (0 .. (length($bincode)-1))
{
    push(@rawcode, (substr($bincode, $i, 1) eq '1') ? $high : $low);
}
for my $i (0 .. $repeat)
{
    my $out = `$exe "$starter @rawcode $starter @rawcode $progter @rawcode $footer"`;
    # note that we "throw" a long (3x24 bits) code sequence to pilight-send
    my $rc = $? >> 8;
    print $out;
    if ($rc) { exit $rc; }
}
exit 0;
 
Reply
#20
@RinusW, can you by any chance make this into a pilight protocol?
 
Reply
  


Possibly Related Threads...
Thread Author Replies Views Last Post
  QUIGG GT9000 (Globaltronics/ALDI) NeoFlo 139 68,881 10-02-2019, 05:01 PM
Last Post: blackzombie
  Brennenstuhl RCR CE1 1011 with QUIGG GT9000 Protocol scootermacro 1 332 06-27-2019, 06:20 PM
Last Post: scootermacro
  quigg gt7000 Dimmer wchristi 11 8,246 04-30-2015, 09:25 AM
Last Post: wo_rasp
  Quigg Screens curlymo 6 4,073 01-31-2015, 07:33 PM
Last Post: curlymo
  QUIGG (Globaltronics/ALDI) neevedr 49 33,821 01-12-2015, 10:01 AM
Last Post: wo_rasp
  Kaku PAT-103 / PAR-1000 davem 0 2,199 04-20-2014, 10:51 PM
Last Post: davem
  Alecto WS-1000 koffie 1 2,111 12-30-2013, 10:19 PM
Last Post: curlymo
  [Fully Supported] IT PA3-1000 nett_flanders 55 23,205 09-11-2013, 04:42 PM
Last Post: Bram

Forum Jump:


Browsing: 1 Guest(s)