From leader21
Here’s a device that tells you the actual system uptime.
create a script in your homedirectory called uptime.sh :
#!/bin/bash
# uptime.sh
# get uptime from /proc/uptime
uptime=$(</proc/uptime)
uptime=${uptime%%.*}
seconds=$(( uptime%60 ))
minutes=$(( uptime/60%60 ))
hours=$(( uptime/60/60%24 ))
days=$(( uptime/60/60/24 ))
echo "$days days $hours hours $minutes minutes $seconds seconds"
then you can use your device like this :
{
"id": "system-uptime",
"name": "System uptime",
"class": "ShellSensor",
"attributeName": "Uptime",
"attributeType": "string",
"attributeUnit": "",
"command": "sudo bash /home/pi/uptime.sh",
"interval": 60000
},
you can leave the seconds away at the echo in the script.
the gui will show up more cheerful on mobile devices.