====== meshdesk file ======
===== Background =====
* MESHdesk use the LEDs of the device it is installed on to signal about the environment.
* During startup one LED signals about the method it uses to try and fetch settings from the controller.
* After startup, if the device is used in a mesh network it, this LED signals how many neighboring nodes it sees.
* A second LED is used to indicate if the device has proper contact with the controller. (The LED can be either ON or OFF in such a case)
* Finally on mesh networks we can also specify a third LED that will indicate mesh traffic flowing through a node.
===== Exploring our hardware =====
* Lets look at the Xiaomi 4A 100M as a sample.
#change directory to where the LEDs are
cd /sys/class/leds/
ls
#These are the LEDs available
blue:power mt76-phy0 mt76-phy1 yellow:power
#turn it off
echo "0" > yellow\:power/brightness
#turn it on
echo "1" > yellow\:power/brightness
#turn it off
echo "0" > blue\:power/brightness
#turn it on
echo "1" > blue\:power/brightness
* We can use the blue LED to signal during startup and neighbor counts.
* We can also use the yellow LED to light up if communication to the controller is broken.
* There is however not a third LED so we will not define one for the mesh traffic.
===== Add a hardware section for our device =====
* With this info we can create a hardware section in /etc/config/meshdesk
config hardware 'xiaomi_4a_100'
option morse_led '/sys/class/leds/blue:power/brightness'
option internet_led '/sys/class/leds/yellow:power/brightness'
option wifi_led 'led0'
===== Adjust the settings section accordingly =====
* There are two important options here to adjust
* **hardware** - have to match the value of a hardware definition under the settings section.
* **id_if** - have to match the interface specified in the **wan_network** file.
config settings 'settings'
option hardware 'xiaomi_4a_100'
option id_if 'eth0'
option lan_up_file '/tmp/lan_up'
* Don't make the name of the hardware section more than 14characters. Longer names break things during deployment.
* Devices where the interface used in wan_network is eth0.1 simply use eth0 here.
* Later we will also use the value of **xiaomi_4a_100** to define the hardware on the controller.
===== Alarm On or Alarm Off? =====
* We use the yellow LED as an alarm which means it has to light up when communication to the controller is down.
* Since we want the **yellow LED** to be off when the communication to the controller is fine we need to check what the current setup is.
vi /etc/MESHdesk/reporting/report_to_server.lua
#Look for this section
if(ok_flag)then
internetLED('0'); -- NOTE Here we can swap them around eg make it 0 to turn off a red LED when the internet is OK
checkForContollerReboot('1');
else
internetLED('1');
checkForContollerReboot('0');
end
==== Review new hardware ====
* The following table lists the important items with comments
^ Item ^ Typical value ^ Comment ^
| settings -> hardware | xiaomi_4a_100 | Must match a hw definition in the file itself |
| settings -> id_if | eth0 | eg eth0, eth1 or wan - NOT eth0.1 (for those boards its just eth0) |
| settings -> skip_radio_0 | 0 | set to 1 when radio0 is a 5G radio and you don't want to use it for config SSID |
===== Remember Your Environment =====
* Finally you need to adjust some items to match up with your controller and its environment.
* The following table lists some of the important items with comments
^ Item ^ Typical value ^ Comment ^
| internet1 -> disabled | 1 | change it to 0 in order for the device to be centrally controlled |
| internet1 -> dns | cloud.radiusdesk.com | Supply Dummy Value If Not Using DNS System e.g. nohost.radiusdesk.com |
| internet1 -> protocol | https | Can be http or https |
| internet1 -> ip | 176.31.15.210 | Fallback when FQDN does not resolve on FQDN not used |
* We are nearly done. The last stop is to edit the **captive_config.json** file to fit our specific hardware.