#!/bin/sh # Gill WindSonic NMEA $WIMWV Parser fuer Meteobridge while true; do # Liest eine Zeile vom Eingang (Serielle Schnittstelle oder stdin) read line # Pruefen ob die Zeile ein $WIMWV NMEA Satz ist echo "$line" | grep -q '^\$WIMWV' || continue # Beispielzeile: $WIMWV,034,R,000.17,N,00*4D # Felder durch Komma trennen direction=$(echo "$line" | cut -d',' -f2) rel_abs=$(echo "$line" | cut -d',' -f3) # R oder T speed=$(echo "$line" | cut -d',' -f4) unit=$(echo "$line" | cut -d',' -f5) # Konvertiere Geschwindigkeit in Knoten (falls m/s, optional) # Hier setzen wir voraus, dass die Einheit schon Knoten ist (N), sonst Umrechnung noetig. # Leere Werte ueberspringen if [ -z "$direction" ] || [ -z "$speed" ]; then continue fi # Ausgabe im Meteobridge Format echo "wind_direction=$direction" echo "wind_speed=$speed" done
Direkt zum Seiteninhalt

Seite 14

#!/bin/sh # Gill WindSonic NMEA $WIMWV Parser fuer Meteobridge while true; do # Liest eine Zeile vom Eingang (Serielle Schnittstelle oder stdin) read line # Pruefen ob die Zeile ein $WIMWV NMEA Satz ist echo "$line" | grep -q '^\$WIMWV' || continue # Beispielzeile: $WIMWV,034,R,000.17,N,00*4D # Felder durch Komma trennen direction=$(echo "$line" | cut -d',' -f2) rel_abs=$(echo "$line" | cut -d',' -f3) # R oder T speed=$(echo "$line" | cut -d',' -f4) unit=$(echo "$line" | cut -d',' -f5) # Konvertiere Geschwindigkeit in Knoten (falls m/s, optional) # Hier setzen wir voraus, dass die Einheit schon Knoten ist (N), sonst Umrechnung noetig. # Leere Werte ueberspringen if [ -z "$direction" ] || [ -z "$speed" ]; then continue fi # Ausgabe im Meteobridge Format echo "wind_direction=$direction" echo "wind_speed=$speed" done
Zurück zum Seiteninhalt