Eigenes Pilight-Protokoll : Pilight_ctrl(Parse): unknown protocol -> becker

Begonnen von ikea, 05 April 2017, 16:18:37

Vorheriges Thema - Nächstes Thema

ikea

Hallo,

ich habe für Pilight 2 eignene neue Protokolle entwickelt und im Einsatz. Beide funktionieren unter Pilight auch tadellos.
Aber in FHEM wird eines der beiden nicht erkannt.

Das problemlose Protokoll habe ich unter dem Namen REFF_SWITCH in Pilight eingebunden.
Es wird ein JSON-Objekt erzeugt, welches dann von FHEMs Pilight_CTRL erkannt und ausgewertet wird.

Zitat"message": {
                "systemcode": 1,
                "unitcode": 1,
                "state": "on"
        },
        "origin": "receiver",
        "protocol": "reff_switch",
        "uuid": "0000-aa-zz-yy-xxxxxx",
        "repeats": 4
}

Das Problem-Protokoll "becker" haut auch ein ordentliches JSON-Objekt raus:

Zitat"message": {
                "systemcode": 1021,
                "unitcode": 1023,
                "state": "off"
        },
        "origin": "receiver",
        "protocol": "becker",
        "uuid": "0000-aa-zz-yy-xxxxx",
        "repeats": 4
}

Dieses Protokoll wird aber von FHEM nicht verarbeitet. Im Log:
ZitatPilight_ctrl(Parse): unknown protocol -> becker

So. Jetzt kommt natürlich die Frage: Warum?!

Hab ich rausgefunden. Dieser Thread ist auch keine wirkliche Frage sondern soll anderen als Hilfe dienen, die das selbe Problem haben und danach suchen.

In /opt/fhem/FHEM/10_pilight_ctrl.pm gibt es im Sub pilight_ctrl_Parse($$){} den Abschnitt
my $protoID = -1;
  switch($proto){
    #switch
    case m/switch/      {$protoID = 1;}
    case m/elro/        {$protoID = 1;}
    case m/silvercrest/ {$protoID = 1;}
    case m/mumbi/       {$protoID = 1;}
    case m/brennenstuhl/{$protoID = 1;}
    case m/pollin/      {$protoID = 1;}
    case m/daycom/      {$protoID = 1;}
    case m/impuls/      {$protoID = 1;}
    case m/rsl366/      {$protoID = 1;}
    case m/cleverwatts/ {$protoID = 1;}
    case m/intertechno_old/ {$protoID = 1;}
    case m/quigg_gt/    {$protoID = 1;}

    case m/dimmer/      {$protoID = 2;}

    #contact sensors
    case m/contact/     {$protoID = 3;}
    case m/ev1527/      {$protoID = 3;}
    case m/sc2262/      {$protoID = 3;}

    #Weather Stations temperature, humidity
    case m/alecto/      {$protoID = 4;}
    case m/auriol/      {$protoID = 4;}
    case m/ninjablocks/ {$protoID = 4;}

    case m/auriol/      {$protoID = 4;}
    case m/ninjablocks/ {$protoID = 4;}
    case m/tfa/         {$protoID = 4;}
    case m/teknihall/   {$protoID = 4;}
    case m/oregon_21/   {$protoID = 4;}

    #gpio temperature, humidity sensors
    case m/dht11/       {$protoID = 4;}
    case m/dht22/       {$protoID = 4;}
    case m/ds18b20/     {$protoID = 4;}
    case m/ds18s20/     {$protoID = 4;}
    case m/cpu_temp/    {$protoID = 4;}
    case m/lm75/        {$protoID = 4;}
    case m/lm76/        {$protoID = 4;}

    case m/screen/      {$protoID = 5;}


Das erklärt die Problematik. REFF_SWITCH wird wegen des Stichwortes "switch" erkannt und mit protoID=1 verarbeitet:
case m/switch/      {$protoID = 1;}

Das Protokoll BECKER entspricht keinem der Suchmuster. Deshalb wird es auch nicht erkannt und kann keiner ID zugeordnet werden.

Ich habe nun einfach die eine Zeile hinzugefügt:
    case m/becker/     {$protoID = 1;}

Nun noch service fhem stop und service fhem start  ...und es funktioniert.

Ich hoffe jemandem durch meine kurze Doku helfen zu können!

Gruß,
Ikea

PS:
Alternativ hätte ich auch einfach mein neues Protokoll z.B. "becker_switch" nennen und pilight neu kompilieren können, hätte sicher auch funktioniert.