Skip to content

Python GeCoS Server Script. Ansprechbar per WebSocket

Notifications You must be signed in to change notification settings

bgersmann/GeCoS-Server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 

Repository files navigation

GeCoS-Server

Python GeCoS Server Script. Ansprechbar per UDP-WebSocket

Befehlsaufbau:

Parmeter: -d -> Zeigt Debug informationen Befehl in geschweiften klammern verpackt: {}
Trennzeichen: ;
Erste Info: Funktion (x-Buchstaben)
2. Info: BUS 0-2
3. Info: Modul Adresse
n. Sachinformation (z.B.: Port Status)
Antwort mit Befehl + Status

Bsp.: Output setzen, alle Ausgänge einschalten:
Befehl: {SOM;1;0x24;65535}
Antwort: {SOM;1;0x24;65535;OK}

Es werden nur Module ausgelesen die bei der Modulsuche(MOD) gefunden wurde.

Funktionen:

"SAI" = Status All IN -> Liest alle Eingangsmodule und sendet aktuellen Status
"SAO" = Status All Out -> Liest alle Ausgangsmodule und sendet aktuellen Status
"MOD" = Modulsuche -> Sucht nach Modulen und Antwortet mit Moduladressen
"SPWM" = Status All PWM -> Liest alle PWM Module aus und sendet aktuellen Status
"SRGBW" = Status All RGBW -> Liest alle RGBW Module aus und sendet aktuellen Status
"SOM" = "Set Output Module" -> INT Big = port A; Litte = Port B
"PWM" = "Set PWM Module" -> {PWM;I2C-Kanal;Adresse;PWMKanal;Status;Wert} Status=0/1 (0=Aus,1=Ein), Wert=0-4095
"RGBW" = "Set RGBW Module" -> {RGBW;I2C-Kanal;Adresse;RGBWKanal;StatusRGB;StatusW;R;G;B;W} Status=0/1 (0=Aus,1=Ein), R/G/B/W=0-4095
"SAM" = "Status Analog Module" -> {SAM;0;0x69;AnalogChannel;Resolution;Amplifier}
"RRTC" = Read RTC -> {RRTC} -> {RRTC;TT;MM;JJJJ;HH;MM;SS;OK}
"SRTC" = Set RTC -> {SRTC;TT;MM;JJJJ;HH;MM;SS;TEMP}
"OWS" = One Wire Suche -> {OWS}
"OWV" = One Wire Values -> {OWV;OWDevice ID} ({OWV;28-610119138fdf1b} -> {OWV;28-610119138fdf1b;23.568;OK})
"OWC" = One Wire Config -> {OWC;OWDevice ID;Werte} ({OWC;28-610119138fdf1b;31} -> {OWC;28-610119138fdf1b;31;OK}) -> Typ abhängig!

"DMX" -> "DMX Befehl" Sendet "Start","Stop",Status" Befehl {DMX;Befehl} ({DMX;Status}-> {DMX;Status;Aktiv})
"DMXSR" -> "DMX Set Range"-> Setz Mehrere Kanäle auf Wert -> {DMXSR;KanalStart;Anzahl;Werte;...;..} ({DMXSR;15;4;255;0;128;55}-> {DMXSR;15;4;255;0;128;55;OK}) Kanal 1-512, Wert 0-255
"DMXIR" -> "DMX Info Range" -> Liest Kanal Werte -> {DMXIR;Kanal,Anzahl} ({DMXIR;15;4}-> {DMXIR;15;4;255;128;0;255;OK}) Kanal 1-512
Kanal 0-2

MOD - Antworten

{MOD;0;0x24;OUT} -> 16Out erkannt
{MOD;0;0x20;IN} -> 16In erkannt
{MOD;0;0x50;PWM} -> PWM erkannt
{MOD;0;0x58;RGBW} -> RGBW erkannt
{MOD;0;0x68;ANA} -> Analog erkannt
{MOD;0;0x05;UNB} -> Unbekanntes i2c device
{MOD;0;0;END} -> Suche beendet

OWS -Antwort

{OWS;28-610119138fdf1b}} -> DS18B20
{OWS;10-460008037049d3} -> DS18S20
{OWS;3a-1d000000455f51} -> DS2413
{OWS;3b-910cfc09590677} -> MAX31850
{OWS;0;0;END} -> Suche beendet

OWC - Optionen

FamilyCode 28:
Resolution: 31 -> 9Bit, 63-> 10Bit, 95-> 11Bit, 127-> 12Bit
{OWC;28-610119138fdf1b;127} -> {OWC;28-610119138fdf1b;127;OK}

FamilyCode 3a:
Value: 0 -> IOA+IOB = LOW, 1-> IOA = HIGH;IOB = LOW, 2-> IOA = LOW; IOB = High, 3-> IOA+IOB = High
{OWC;28-610119138fdf1b;3} -> {OWC;28-610119138fdf1b;3;OK}

DMX

DMX über ttyAMA0
Bei PI3 folgende Einstellungen in Config.txt ergänzen:
dtoverlay=disable-bt
force_turbo=1

Download und Einrichten:

Download des git Verzeichnisses:
git clone https://github.com/bgersmann/GeCoS-Server
Kopiere GeCoS-Server.py zu /usr/local/bin/
sudo mv /home/pi/GeCoS-Server/GeCoS-Server.py /usr/local/bin/
sudo rm -r GeCoS-Server

Erstellen des Services:
sudo nano /lib/systemd/system/gecos.service
Folgenden Inhalt einfügen:

[Unit]
Description=GeCoS WebService
After=multi-user.target

[Service]
Type=simple
ExecStart=/usr/bin/python3 /usr/local/bin/GeCoS-Server.py
Restart=on-abort

[Install]
WantedBy=multi-user.target

Einrichten und Starten des Services:
sudo chmod 644 /lib/systemd/system/gecos.service
sudo chmod +x /usr/local/bin/GeCoS-Server.py
sudo systemctl daemon-reload
sudo systemctl enable gecos.service
sudo systemctl start gecos.service
sudo systemctl status gecos.service
sudo systemctl restart gecos.service
sudo systemctl stop gecos.service

Alternativ:

sudo wget -O /usr/local/bin/GeCoS-Server.py https://raw.githubusercontent.com/bgersmann/GeCoS-Server/master/GeCoS-Server.py
sudo wget -O /lib/systemd/system/gecos.service https://raw.githubusercontent.com/bgersmann/GeCoS-Server/master/gecos.service
sudo chmod 644 /lib/systemd/system/gecos.service
sudo chmod +x /usr/local/bin/GeCoS-Server.py
sudo systemctl daemon-reload
sudo systemctl enable gecos.service
sudo systemctl start gecos.service

About

Python GeCoS Server Script. Ansprechbar per WebSocket

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages