Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
| Beide Seiten der vorigen RevisionVorhergehende ÜberarbeitungNächste Überarbeitung | Vorhergehende Überarbeitung | ||
| alarmsystem [14.01.2018 07:18] – [Bewegungsalarmsystem] havelock | alarmsystem [20.01.2018 20:01] (aktuell) – [Software] havelock | ||
|---|---|---|---|
| Zeile 5: | Zeile 5: | ||
| Noch implementieren | Noch implementieren | ||
| * Konfiguration über '' | * Konfiguration über '' | ||
| - | * Freifunk-Clientnetzwerk im Fahrzeugknoten deaktivieren, | + | * Freifunk-Clientnetzwerk im Fahrzeugknoten deaktivieren, |
| - | + | ip link set down dev client0 | |
| + | ip link set up dev client0 | ||
| + | </ | ||
| Dieses System ist natürlich immer im Zusammenhang mit anderen Sicherungssystemen zu sehen. | Dieses System ist natürlich immer im Zusammenhang mit anderen Sicherungssystemen zu sehen. | ||
| + | |||
| + | Voraussetzung ist, daß im Fahrzeug eine permanente Stromversorgung sichergestellt ist. | ||
| Feststellen ob ein Fahrzeug von seinem Parkplatz bewegt wird. | Feststellen ob ein Fahrzeug von seinem Parkplatz bewegt wird. | ||
| Zeile 37: | Zeile 40: | ||
| * Am USB-Anschluß kann ein GPS-Stick angeschlossen werden | * Am USB-Anschluß kann ein GPS-Stick angeschlossen werden | ||
| * WR841N/ND im Fenster | * WR841N/ND im Fenster | ||
| + | |||
| + | ===== Software ===== | ||
| + | |||
| + | Das Link-Überwachungsprogramm | ||
| + | <file lua neighbourwatch.lua> | ||
| + | # | ||
| + | |||
| + | function file_exists(name) | ||
| + | local f=io.open(name," | ||
| + | if f~=nil then io.close(f) return true else return false end | ||
| + | end | ||
| + | |||
| + | function watch_mac(mac) | ||
| + | command = " | ||
| + | local handle = io.popen(command) | ||
| + | local result = handle: | ||
| + | handle: | ||
| + | return result: | ||
| + | end | ||
| + | |||
| + | counterfile = "/ | ||
| + | lastseen = watch_mac(" | ||
| + | age_seconds = tonumber(lastseen: | ||
| + | if age_seconds > 30 then | ||
| + | if not file_exists(counterfile) then | ||
| + | file = io.open(counterfile, | ||
| + | file: | ||
| + | file: | ||
| + | command = "ssh alarmuser@srv01.ffpi ./ | ||
| + | local handle = io.popen(command) | ||
| + | local result = handle: | ||
| + | handle: | ||
| + | end | ||
| + | else | ||
| + | if file_exists(counterfile) then | ||
| + | os.remove(counterfile) | ||
| + | end | ||
| + | end | ||
| + | </ | ||
| + | |||
| + | Der Cronjob der das Überwachungsscript regelmäßig aufruft | ||
| + | <file conf / | ||
| + | * * * * * / | ||
| + | </ | ||
| + | |||
| + | Alarmierung momentan per mail | ||
| + | <file bash alarmmail.sh> | ||
| + | #!/bin/bash | ||
| + | mail -s " | ||
| + | Alarm! | ||
| + | Das Fahrzeug /Mein Auto/ wird gerade bewegt. | ||
| + | EOF | ||
| + | </ | ||
| + | |||
| + | Dynamische Steuerung des Client-WLANs im Fahrzeug. | ||
| + | |||
| + | Erster Entwurf: | ||
| + | <file lua meshcheck.lua> | ||
| + | # | ||
| + | |||
| + | function neighbourcount() | ||
| + | local handle = io.popen(" | ||
| + | local result = handle: | ||
| + | handle: | ||
| + | return result | ||
| + | end | ||
| + | |||
| + | function ifstate() | ||
| + | local file = io.open("/ | ||
| + | local result = file: | ||
| + | file: | ||
| + | return result | ||
| + | end | ||
| + | |||
| + | state = ifstate() | ||
| + | if neighbourcount() == 0 then | ||
| + | if state == " | ||
| + | os.execute(" | ||
| + | end | ||
| + | else | ||
| + | if state == " | ||
| + | os.execute(" | ||
| + | end | ||
| + | end | ||
| + | </ | ||