base-files: uci-defaults-new: fix storing rssi leds and triggers in board.json
[openwrt/openwrt.git] / package / base-files / files / lib / functions / uci-defaults-new.sh
index f795af33d7b9a299990f823427f5928c325d9a1a..6f9d716e9b1785b9ece2cf63f1db39a4a5547981 100755 (executable)
@@ -349,16 +349,16 @@ ucidef_set_led_rssi() {
 
        json_select_object led
 
-       json_select_object rssi
        json_select_object "$1"
+       json_add_string type rssi
        json_add_string name "$name"
+       json_add_string iface "$iface"
        json_add_string sysfs "$sysfs"
        json_add_string minq "$minq"
        json_add_string maxq "$maxq"
        json_add_string offset "$offset"
        json_add_string factor "$factor"
        json_select ..
-       json_select ..
 
        json_select ..
 }
@@ -368,12 +368,11 @@ ucidef_set_rssimon() {
        local refresh="$2"
        local threshold="$3"
 
-       json_select_object led
+       json_select_object rssimon
 
-       json_select_object rssi
-       json_add_string type rssi
-       json_add_string dev "$dev"
-       json_add_string threshold "$threshold"
+       json_select_object "$dev"
+       [ -n "$refresh" ] && json_add_int refresh "$refresh"
+       [ -n "$threshold" ] && json_add_int threshold "$threshold"
        json_select ..
 
        json_select ..