Last Updated on 16/10/2024 by Kevin Agar
Some general commands and some specific to MaxAir
A lot of commands require root access. Either log in with root
password:
This requires root password and changes user to root. It doesn’t change the working directory but stays in the original home directory. So if logged in as pi, you stay in /home/pi
pi@MaxAir:~ $ su root
Password:
root@MaxAir:/home/pi# pwd
/home/pi
root@MaxAir:/home/pi#
Alternatively, you can start all commands with sudo. This gives root permissions and stays in the original home directory. So if logged in as pi, you stay in /home/pi
Rather than type sudo before every command, you can use the command sudo -i This will give root access without the need for a password, but will also change the working directory to /root
root@MaxAir:~# pwd
/root
root@MaxAir:~#
#kill the gateway process
#Check gateway is running
#Start the gateway in the console window and see the messages_out and messages_in
green = outgoing, yellow = incoming
#Check that it’s sending data to Home Assistant
#Check the status of the HA_integration service
#print working directory – displays the current directory you’re in
#list a directories content
#list a directory’s content with details
#change directory
#users home directory. eg /home/pi/
#an interactive process viewer.
#run the python program gateway.py
#reboot the system
#halt the system
#edit the file rc.local
#make a file copy
#change owner – change file user:group
#change ownership of all in /var/www recursively
or
#to find what version of python is being used – – is a double dash – no space
#list all running processes
#show the PID nnn of the running process eg. gateway.py
#kill the PID number nnn to stop the program
#Raspberry pi configuration tool
#to see which network is connected
(from previous command) #To change which network is connected
#show mac address and IP address
#Show disk space
Breaking this down.
- find – command
- sudo – superuser permissions
- / – directory to run the search (this is the root directory)
- -name – searching for a file name
- file.txt – the file we are searching for
Breaking this down.
- find – command
- sudo – superuser permissions
- / – directory to run the search (this is the root directory)
- -type what to find
- d directory
- -name – searching for a file name
- ‘httpdocs’ – the directory we are searching for
Increase the swapfile size
#edit the swapfile
CONF_SWAPSIZE=1024 #change swapsize from 100 to 1024
#stop the swapfile process
#start the swapfile process
#check the amount of memory and free memory
# check if the cpu clock is being throttled due to heat. Should return 0
Generate a backup of MaxAir db
run System Configuration Menu>Backup which will generate a file in /var/www eg maxair_mysql_2021-09-22_11-07-52.zip.
Install the MaxAir backup db into clean installation
- copy the zip file to your pc and unzip, it should create a *.sql file
- install new image
- install updates
- copy the sql file back to the pi to say /home/pi
- on the pi run
- sudo mysql -u root -ppassw0rd maxair < ‘the name of the sql file you copied’
- eg sudo mysql -u root -ppassw0rd maxair < /home/pi/maxair_mysql_2021_09-22_11-07-52.sql
Raspberry pi – how to measure CPU and GPU Temperature
Enter into the file
Save the file and change the permissions
To run the file
Sample output
To map a directory to a NAS directory
Create a directory/folder on the pi that you want to map to a directory/folder on the NAS
#You need to add the folder to the mnt or media folder as these aren’t included in the backup
Create a directory/folder on the NAS that you want mapped to a directory/folder on the pi
In my case it’s //192.168.1.254/Volume_1/MaxAir_Backups
Add a line to /etc/fstab and save
Enter into the file and save
//192.168.1.254/Volume_1/MaxAir_Backups – NAS address and directory to map to
/mnt/pibackups – MaxAir folder to map from
nofail – System will still boot up even if connecting to the NAS fails
Noatime – Stop changing the file read time. (Improves performance)
vers=1.0 – Used to specify which version of SAMBA is used
username=****,password=**** – The credentials for logging into the NAS
0 0 –
uid=www-data – set permissions for user www-data
gid=www-data – set permissions for group www-data
Manually Update MaxAir
To manually get the database updates run:
To manually get the code updates run:
Then move them to the correct locations using:
To check GPIO relays
This will turn the relay connected to GPIO pin 13 on
This will turn the relay connected to GPIO pin 13 off
To Add MQTT_dependencies
run install.sh from /var/www/add_on/MQTT_dependencies
run
To find, remove or install an earlier paho version
to find the version
to remove paho
To install an earlier version, create a text file with nano
add the line
Save the file, and in the same directory execute the following