Hello to everyone on the Smart Box channel
Today will be the next part of the video
From the video series about Orange Pi Zero
In previous videos, I already showed how
to install on Orange Pi Zero
the operating system Arbian
Web server Apache, MYSQL database
PHPMyAdmin and MQTT Server
And in today's video, I'll install on Orange Pi Zero
Smart home system MAJORDOMO
And also additional software for the correct operation of multimedia
in the smart home system MAJORDOMO
So let's get started
To start we open the terminal
And enter the IP address of ORANGE PI ZERO
Authorization in the system
At the moment the temperature of the processor is 62 degrees Celsius
My ORANGE PI ZERO works without a glued radiator
And of course without a fan
All this aggravates the plastic case
In the very near future I will put the radiator and fan
What I recommend everyone to do
Well, now proceed to install the smart home system MAJORDOMO on ORANGE PI ZERO
The first thing to do is
apt-get update and apt-get upgrade
Let's do it
Enter the command
sudo apt-get update
Confirm with the password
Enter the following command
sudo apt-get upgrade
Now let's create a directory for the smart house system MAJORDOMO
Enter the command
sudo mkdir /home/majordomo
Go to this directory
Enter the command
cd /home/majordomo
Download archive with smart home system MAJORDOMO
Enter the command
sudo wget http://majordomo.smartliving.ru/download/_majordomo_linux_100b.tar.gz
And now it remains to install the system
Enter the command
sudo tar xvfz _majordomo_linux_100b.tar.gz
Enter the following command
sudo cp -rp /home/majordomo/html/* /var/www
And enter the last command
sudo cp -rp /home/majordomo/html/.htaccess /var/www
Then you need to change the owner of the folder /var/www
Enter the command
sudo chown -R www-data:www-data /var/www
Now you need to add the user www-data to the audio group
Enter the command
sudo usermod -a -G audio www-data
Now it is necessary to open the browser and download the archive of the smart home system MAJORDOMO on the computer
https://github.com/sergejey/majordomo/archive/master.zip
start to download the archive
Archive has been downloaded, now it needs to be unzipped
I unzipped it directly to the desktop
Done
Now you need to go to PHPMyAdmin
For this we enter IP address ORANGE PI ZERO
And add through the slash /phpmyadmin
For login you need to enter the login root
And in the password field enter the password that we
created in the previous video when installing PHPMyAdmin
Now you need to create a database db_terminal
For this, click on the link to create a database
In the field "database" we enter
In the "comparison" field, select the encoding utf8_general_ci. (EN) | cp1251_general_ci. (RU)
And click on the "create"
Further we pass in the created database
Go to the tab "import"
Click on the button "select a file"
And now it is necessary in the previously unzipped folder
Find a database dump
So, I found a database dump db_terminal
Choose it
Then move down this page
And click on the "forward"
Tables with data successfully imported
And now you need to create a user
For this we go to the tab "privileges"
Follow the link "add a user"
In the field "username" we enter the login of the new user
At me it will be admin
And create a new password for this user
Just the new password can be simply generated
Further down the page
And click on the "forward"
Done. User added
And now we return to the terminal
Next, you need to edit the configuration of the smart home system MAJORDOMO
Enter the command
sudo nano /var/www/config.php
find the lines: Define('DB_USER', 'USER');
and Define('DB_PASSWORD', 'PASS');
And enter the user data of which we just created in PHPMyAdmin
If you plan to connect to the server MAJORDOMO not only from the home network,
but also through the Internet
Then you need to add the following code to the file:
Define('HOME_NETWORK', '192.168.0.*'); // home network (optional) Define('EXT_ACCESS_USERNAME', 'user'); // access details for external network (internet) Define('EXT_ACCESS_PASSWORD', 'password');
In the first line we indicate our home network
Being in this network you can go to the server MAJORDOMO without authorization
In the next two lines, you need to register a login and password
for connecting to the MAJORDOMO server
via the Internet
This is for the time being all the settings in the config file. Now save the file
"ctrl" "x"
"Y"
"enter"
Next, you need to create a file describing the service for the main loop MAJORDOMO
Open the editor. Enter the command:
sudo nano /etc/systemd/system/majordomo.service
Add the following code to the file:
[Unit] Description=MajorDoMo
[Service] Requires=mysql.service Requires=apache2.service Type=simple WorkingDirectory=/var/www ExecStart=/usr/bin/php /var/www/cycle.php Restart=always
[Install] WantedBy=multi-user.target
This code will be in the listing file, in the description under the video
Now save the file
Then you need to restart all services
enter commands:
sudo systemctl daemon-reload
sudo apache2ctl restart
sudo service mysql restart
sudo systemctl enable majordomo
sudo systemctl start majordomo
Now open the browser and do the initial setup MAJORDOMO
Open IP address ORANGE PI ZERO
In the time zones list, you must select your time zone
Next, you must select the language on which the system will work
And the last is the choice of the skin
Dark or light
Click on the "continue"
Return to the terminal again
And reboot the server
Enter the command
sudo shutdown -r now
Reopen the terminal
Authorization on the server
And now you need to install several programs for the correct operation of multimedia
But first we will do apt-get update and apt-get upgrade
Enter commands
sudo apt-get update
sudo apt-get upgrade
No updates, but it had to be done
The first program you need to install - MPLAYER
Enter the command
sudo apt-get install mplayer -y
And start the installation
The MPLAYER is installed and now we proceed to install the next player - VLC
Enter the command
sudo apt-get install vlc -y
And start the installation
Further it is necessary in crontab to add a line with the code
in order to start the VLC player with the system
crontab -e -u admin
Open the file
Select editor
And at the end of the file add a line with the command:
In the line with the code it is necessary to specify the password for authorizing the VLC player
The password can be anything, you come up with it yourself
Now save the file and exit
Now you need to reboot
Reopen the terminal
And are authorized in the system
Now you need to install a speech synthesizer
that would make the smart home system MAJORDOMO start talking
We will install RHVoice but first install dependencies
Enter the command:
apt-get install gcc g++ git pkg-config scons libao4 libao-common libao-dev
confirm the action by entering the password
Agree
Dependencies are established and now we proceed to install RHVoice
Go to the folder, enter the command:
cd /usr/src/
Copy RHVoice
sudo git clone https://github.com/Olga-Yakovleva/RHVoice
Go to folder
cd RHVoice
And install
Enter the command:
sudo scons
Continue the installation, enter the following command:
sudo scons install
And now it remains to enter the last command and complete the installation
Enter the command:
sudo ldconfig
The speech synthesizer is complete
Now you need to do a test
This will require speakers or headphones
I had at hand such a portable speaker
This audio column I will connect to ORANGE PI ZERO
Now try to enter the command
echo "test" | RHVoice-test
again
echo "test" | RHVoice-test
Well, now let's try something in Russian
echo "Привет Смарт Бокс" | RHVoice-test -p Anna
again
echo "Привет Смарт Бокс" | RHVoice-test -p Anna
The installation of the speech synthesizer was successful and now you need to restart the system
Enter the command:
sudo reboot
Close terminal
Now move on to the smart home system MAJORDOMO
And make several settings for
correct operation of speech synthesis and for
the correct operation of the MQTT server
Go to the control panel
Next, click the link - check for updates
And click on the button - update the system
Then go to the tab - equipment
And look for the addition of MQTT
Install
Now on the tab - interaction is looking for RHVoice and install it
Go to the section - applications
Go to the RHVoice
Here we choose the voice except the last one
this application is not installed
You can add caching
And click on the button - update
Go to the Settings section
Go to subsection - terminals
Here while one terminal, this terminal ORANGEPIZERO
Go to edit
Choose the type of player - VLC over HTTP
Specify the port of access to the player - 8080
And the password we added earlier
And click on the save button.
Now let's go to the main page
And ask the smart house system MAJORDOMO something to say
Now let's move on to MQTT
Go to the control panel
Go to the section - devices
Go to subsection - MQTT
Click on the button - configure
Let's subscribe immediately to all the topics
And enter the data for authorization
video part # 3
From the smartphone, let's go to MQTTOOL
Authorization
Now send a message to the topic - test
Back to the MAJORDOMO system panel
And refresh the page
Now the smart house system MAJORDOMO receives data on MQTT
installation of the smart house system MAJORDOMO on the ORANGE PI ZERO can be considered complete
In the following videos, I'll show you how to set up a smart home system MAJORDOMO
How to connect sensors to the system, how to receive data from sensors
How to connect various relays, switches
And many other things
All who like this video do not forget to put - like
subscribe to my channel
All bye
No comments:
Post a Comment