Commit 0e4c3384 authored by rubo77's avatar rubo77

option in config mode to dis-/enable the Offline-SSID

parent 6dc81ac6
ssid-changer.sh
===============
gluon-ssid-changer
==================
This script changes the SSID when there is no connection to the selected Gateway.
This package adds a script, that changes the SSID when there is no connection to
the selected Gateway.
Once a minute it checks if there's still a gateway reachable with
You can enable/disable it in the config mode.
Once every timeframe it checks if there's still a gateway reachable. There can be
selected two algorithms to analyze if a gateway is reacheable:
- `tq_limit` enabled: define an upper and lower limit to turn the offline_ssid
on and off in-between these two values the SSID will never be changed to
prevent it from toggeling every minute.
- `tq_limit` disabled: there will be only checked, if the gateway is reachable
with:
batctl gwl -H
Depending on the connectivity, it will be decided if a change of the SSID is
necessary: There is a variable `switch_timeframe` (for ex. 1440 = 24h) that
defines a time interval after which a successful check that detects an offline
state will result in a single change of the SSID to "FF_OFFLINE_$node_hostname".
Only the first few minutes (also definable in a variable `first`) the
OFFLINE_SSID may also be set. All other minutes a checks will just be counted
and reported in the log and whenever an online state is detected the SSID will
be set back immediately back to normal. when the timeframe is reached, there
will be checked if the node was offline at least half the timeframe, only then
the SSID will be changed.
site.conf
=========
......@@ -27,20 +50,6 @@ ssid_changer = {
},
```
if tq_limit is disabled, then it will be only checked, if the gateway is reachable with
batctl gwl -H
Depending on the connectivity, it will be decided if a change of the SSID is
necessary: There is a variable `switch_timeframe` (for ex. 1440 = 24h) that
defines a time interval after which a successful check that detects an offline
state will result in a single change of the SSID to "FF_OFFLINE_$node_hostname".
Only the first few (also definable in a variable `first`) minutes the
OFFLINE_SSID may also be set. All other minutes a checks will just be reported
in the log and whenever an online state is detected the SSID will be set back
immediately back to normal.
Commandline options
===================
......@@ -49,6 +58,11 @@ disable it with:
uci set ssid-changer.settings.enabled='0'
Or set the timeframe to every three minutes with
uci set ssid-changer.settings.switch_timeframe='3'
uci set ssid-changer.settings.first='3'
Manual installation
===================
......
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"PO-Revision-Date: 2017-06-19 18:25+0200\n"
"Last-Translator: <github@r.z11.de>\n"
"Language-Team: German\n"
"Language: de\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
msgid "Enabled"
msgstr "Aktiviert"
msgid ""
"Here you can enable to automatically change the SSID to the OFFLINE-SSID "
"when the node has no connection to the selected Gateway."
msgstr ""
"Hier hast du aktivieren, dass dein Knoten automatisch die SSID auf die "
"OFFLINE-SSID ändert wenn keine Verbundung zum Freifunk Server besteht."
msgid ""
msgstr "Content-Type: text/plain; charset=UTF-8"
msgid "Enabled"
msgstr ""
msgid ""
"Here you can enable to automatically change the SSID to the OFFLINE-SSID "
"when the node has no connection to the selected Gateway."
msgstr ""
entry({"admin", "ssid-changer"}, model("admin/ssid-changer"), _("Offline-SSID"), 15)
local uci = require('simple-uci').cursor()
local util = require 'gluon.util'
local f = Form(translate('Offline-SSID'))
local s = f:section(Section, nil, translate(
'Here you can enable to automatically change the SSID to the OFFLINE-SSID '
.. 'when the node has no connection to the selected Gateway.'
))
local enabled = s:option(Flag, 'enabled', translate('Enabled'))
enabled.default = uci:get_bool('ssid-changer', 'settings', 'enabled')
-- local prefix = s:option(Value, 'prefix', translate('First part of the Offline SSID'))
-- prefix:depends(enabled, true)
-- prefix.datatype = 'maxlength(32)'
-- prefix.default = uci:get('ssid-changer', 'settings', 'prefix')
function f:write()
if enabled.data then
uci:section('ssid-changer', 'settings', 'settings', {
enabled = '1',
-- prefix = prefix.data
-- switch_timeframe = switch_timeframe.data or '1440'
-- tq_limit_max = tq_limit_max.data or '55'
-- first = first.data or '5'
-- prefix = prefix.data or 'FF_OFFLINE_'
-- suffix = suffix.data or 'nodename'
-- tq_limit_min = tq_limit_min.data or '45'
-- tq_limit_enabled = tq_limit_enabled.data or '0'
})
else
uci:set('ssid-changer', 'settings', 'enabled', '0')
end
uci:commit('ssid-changer')
end
return f
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment