So, we’re starting a new series of articles called “VMware Training. Season 2021-2022”, in which we will consider all new educational directions of VMware and we will update the information on previous versions of courses.
To begin with, let us recall the features of authorized training.
Authorized Training
Authorized training from the vendor is a pointer to the best way to master this or that technology. Training programs vary in duration, difficulty level, target audience, training format. Given the trends of recent events in the world, training centers will have to reorient themselves mainly to online learning.
The main components of authorized training are branded textbooks, access to the laboratory environment during training, certified instructors. The training programs themselves are focused on official international certification and are based on new versions of products and technologies, reflect the latest advances in virtualization and cloud technologies in VMware. The content of the Authorized trainings of the last generation have a practice-oriented nature and form the professional competencies of the specialist. VMware provides an equally high level of education, regardless of the location of the training center, controls the content of courses, provides educational and methodological and technical support. There is a system and regulations for training and certification of instructors. An independent certification system allows course participants to obtain internationally recognized documents. Different forms of training allow students to choose the most convenient training option.
To understand the list of training programs and directions, you must visit the official resource: VMware Learning and the corresponding section with the areas of study: Learning Paths.
Learning Paths
In the last school season 2020-2021 in Vmware Education were formed four major product areas of study:
Data Center Virtualization & Hybrid Cloud Infrastructure;
Network Virtualization & Security;
Virtualization & Cloud Management Platform;
Desktop, Application Virtualization & Mobility.
Now there are five such major product areas:
Multi-Cloud;
Virtual Cloud Network;
Digital Workspace;
App Modernization;
Intrinsic Security.
Brief Summary
In this article, we have read the list of areas and specifics of authorized training VMware. In the next post, we will learn about Multi-Cloud training programs.
Follow the news until the meeting is on air in a few days. Sincerely, AIRRA.
Congratulations to all who have been looking forward to the next post in the series “My Smart Home. From the beginning, Step by step to… ”. At the moment we have a working copy of the Home Assistant. From the software applications we have the File Editor and Terminal. We made the first settings in the configuration.yaml configuration file and updated the system to the current version.
Today we will talk about Sensors for monitoring the parameters of the hardware system – Raspberry Pi Power Quality Control Sensor and Processor Temperature sensor. It is also important to know about the health of the software part of the Home Assistant system: we configure the Sensors to monitor the status of the Processor, Memory, Disk and Network. Home Assistant stores the collected data in a database, so we will monitor the growth of its volume with an appropriate sensor. With the help of integration, we will control the Internet connection. We will also configure communication with external devices: configure the control sensors of the Uinterruptible Power Supply.
So, get comfortable, it will be interesting!
Sensors for monitoring system parameters.
All the functioning of our Smart Home depends on the reliable work of the Home Assistant. We entrust control of the basic parameters to the corresponding sensors. Of the hardware, it is the Raspberry Pi power quality control sensor and the processor temperature sensor. From software, – control of loading of the processor, memory, a disk, a network. It is also important to control Internet access settings.
Let’s start with hardware sensors.
● ● ●
Raspberry Pi Power Quality Control Sensor.
On all models of Raspberry Pi since the Raspberry Pi B+ (2014) except the Zero range, there is low-voltage detection circuitry that will detect if the supply voltage drops below 4.63V (+/- 5%). This will result in a warning icon being displayed on all attached displays and an entry being added to the kernel log.
Raspberry Pi Power Supply Checker is based on this algorithm. In the Home Assistant, it is activated by adding the integration component of the same name.
To add this component to the integration, use the Configuration menu, Integration tab. Choose + Add Integration:
In the new window Set up a new integration in the search field enter Rasp. The search result should be displayed as a found integration component Raspberry Pi Power Supply Checker:
We confirm the installation of the Raspberry Pi Power Supply Checker integration component:
If the Raspberry Pi Power Supply Checker is successfully installed, we receive the following message:
And the newly installed component will appear in the list of integrations:
Select the link – 1 entity, and on the Entity tab we will get the filter of integration elements “Raspberry Pi Power Supply Checker”:
Let’s select this filtered element and find out some of its parameters in the RPi Power Status pop-up window. We are primarily interested in Entity ID: binary_sensor.rpi_power_status. Let’s write down this meaning for ourselves, we will need it later.
We will also open another RPi Power Status pop-up window using the icon at the top right. But we will see the status of the sensor, and the message that the history of the change has already begun to work, and events in the logbook are not yet found. This is normal because the state of the sensor has not changed since installation.
This concludes the work with this element of integration. A little later, we will adjust the display of this sensor on the Lovelace panels of the Home Assistant.
● ● ●
Raspberry PI 4 Processor Temperature sensor.
Our copy of the Raspberry Pi will be housed in a case mounted on a din rail of the electrical switchboard. Therefore, the issue of cooling is very important. Before choosing a cooling strategy, let’s evaluate the actual values of the temperature sensor of the Raspberry PI 4 Processor. Especially since Home Assistant himself has every opportunity to do so.
So, let’s create a temperature sensor for the Raspberry PI 4 processor. To do this, add the following code section to the configuration.yaml file:
sensor:
- platform: command_line
name: RPi CPU Temperature
command: "cat /sys/class/thermal/thermal_zone*/temp"
unit_of_measurement: "°C"
value_template: '{{ value | multiply(0.001) | round(1) }}'
Let’s check the configuration:
ha core check
And reboot the system.
ha core restart
Check the presence of the added sensor in the Configuration menu on the Entities tab.
Select this item and immediately open another RPi CPU Temperature pop-up using the icon at the top right. There we will see the temperature values that the sensor recently measured as well as the historical data.
This concludes the work with this sensor. A little later, we will adjust the display of this sensor on the Lovelace panels of the Home Assistant.
● ● ●
Processor Monitoring Sensors.
Now let’s move from the hardware level of monitoring to software. We will be interested in the health parameters of such components of the Home Assistant OS as: Processor, Memory, Disks and Network.
Home Assistant has a built-in special platform called System Monitor with a set of sensors to monitor the local system. System Monitor allows you to monitor CPU usage and temperature, RAM and disk usage, traffic on network interfaces.
We will not immediately add all possible resource sensors to the monitoring. Let’s do it gradually, and start with CPU load sensors and system load sensors for the last 1 minute, 5 minutes, 15 minutes.
To activate the System Monitor platform and start collecting monitoring data in the configuration.yaml configuration file, add the following code:
After adding the parameters, check the configuration and reboot the system, as described above.
Important: In the Home Assistant version of 2021.12, the design of the Configuration section has been changed:
Therefore, to check the operation of the added sensors, go to the already known section of the Configuration menu, Now the section is called Devices and Services, and the name of the Entities tab remains unchanged.
Here we will see recently added sensors:
Similar to the above steps, open the Processor Use pop-ups with information about the status of the sensor and the collected data in historical terms.
Perform similar steps for Load (1m), Load (5m), Load (15m) sensors.
This concludes the work with these sensors. A little later, we will adjust the display of these sensors on the Lovelace panels of the Home Assistant.
● ● ●
Memory Monitoring Sensors.
Now let’s move on to configuring and testing the memory usage monitoring sensors. Add a few more lines to the code we added above:
After adding the parameters, you should check the configuration again and reboot the system, as described above.
To check the operation of the added sensors, go to the already known section of the Configuration menu, Devices and Services section, Entities tab. Here we will see recently added sensors:
Similar to the above steps, open the “Memory use (persent)”, “Memory use”, “Memory free” pop-ups with information about the status of the sensor and the collected historical data.
This will similarly complete the work with these sensors. A little later, we will adjust the display of these sensors on the Lovelace panels of the Home Assistant.
● ● ●
Disk Monitoring Sensors.
The next step is to configure and test the disk usage and swap file sensors. Add a few more lines to the code we added above:
After adding the parameters, you should check the configuration again and reboot the system, as described above.
The test is similar to the steps described above: In the Configuration menu, Devices and Services section, on the Entities tab, we will see the recently added sensors:
Similar to the above steps, open the “Disk use / “, “Disk use / (percent)“, “Disk free /”, “Swap use“, “Swap use (percent)“, “Swap free” pop-ups with information about the status of the sensor and the collected data in historical terms.
This will similarly complete the work with these sensors. A little later, we will adjust the display of these sensors on the Lovelace panels of the Home Assistant.
● ● ●
Network Monitoring Sensors.
Finally, the last group of sensors in the System Monitor platform is network monitoring sensors. But before adding the code to the configuration file, you need to find out the required parameter – the alias of the network interface.
This can be done with the following command:
ha network info
And now, to the code we added above, we add a few more lines, using the alias just clarified as an argument:
After adding the parameters, you should check the configuration again and reboot the system, as described above.
The test is similar to the steps described above: In the Configuration menu, Devices and Services section, on the Entities tab, we will see the recently added sensors:
Similar to the above steps, open the “Network in enp2s0”, “Network out enp2s0”, “Network throughput in enp2s0”, “Network throughput out enp2s0“, “Packets in enp2s0“, “Packets out enp2s0” pop-ups with information about the status of the sensor and the collected data in historical terms.
This will similarly complete the work with System Monitor sensors. We have considered the full range of sensors on this platform. A little later we will adjust the display of all sensors on the lovelace panels of the Home Assistant. And now let’s move on to monitoring another important component of Home Assistant.
Home Assistant Database Size monitoring.
Monitoring the size of the Home Assistant database is very important. The database will expand during long-term use and after adding a significant amount of integration. The larger the database, the more SQLite read and write operations, which means that Home Assistant slows down. Extreme I / O will increase the load on the SD card, which means their accelerated degradation and failure.
In the default configuration, Home Assistant keeps a history of all events and states for all objects for approximately 10 days. This data provides the functions of History and Logbook. The data itself is stored using the Recorder integration, which by default writes it to the SQLite database file located in /config/home-assistant_v2.db.
The topic of database tuning is beyond the scope of this publication, but I promise that we will return to this issue later. For now, we will focus only on the process of monitoring the size of the database.
This sensor will be updated every half minute. Because each state change will add a couple of lines to the recorder’s database, we reduce the refresh rate with the scan_interval parameter.
After adding the parameters, you should check the configuration again. But to use them, this time you need to restart the host. This can be done with the following command:
ha host reboot
After rebooting, perform the verification in the same way as above: In the Configuration menu, Devices and Services section, on the Entities tab, we will see the recently added sensor:
Select this item, and immediately open another pop-up home-assistant_v2.db using the icon at the top right. There we will see the size of the Home Assistant database, which recently measured the sensor as well as historical data. You can see the attributes of the sensor:
This will similarly complete the work with the Home Assistant database size monitoring sensor. A little later, we will adjust the display of this sensor on the Lovelace panels of the Home Assistant.
Internet connection monitoring.
Another important parameter for constant monitoring is the quality of the Internet connection. It’s simple. Home Assistant has the ability to control these parameters using the integration component of Speedtest.net.
It is very easy to install. Go to the already familiar menu Configuration, section Devices and Services, Integration tab. We add a new Integration: + Add Integration. In the popup window Set up a new integration in the search field enter speedtest.net:
After confirmation of the installation in a short period of time we will receive a message about the successful operation.
After the successful installation of the speedtest.net integration component, we will see it in the list.
Choose the link 3 entities. And we will see the filtered three sensors.
Similar to the steps described above in this article, we will open pop-ups “SpeedTest Ping“, “SpeedTest Download“, “SpeedTest Upload” with information about the status of the sensor and the collected data in historical terms.
This will similarly complete the work with the monitoring sensors of the Internet connection. A little later, we will adjust the display of these sensors on the lovelace panels of the Home Assistant.
Uninterruptible power supply monitoring.
The operation of smart home algorithms primarily depends on a reliable power supply. Our Home Assistant on the Raspberry Pi platform will be connected to the uninterruptible power supply. Therefore, our next step is to set up monitoring of this device.
First, let’s add the Network UPS Tools integration package. To do this, in the Supervisor menu, Dashboard tab, select Add-On Store:
In the search field, enter the UPS:
Important: If the search for Network UPS Tools did not return any results, it means that there are no official components. And in the repository community, the search was not performed in the absence of the repository address parameter.
Let’s check this assumption: Call the additional menu by selecting the three-dot icon at the top right of the page. Select Repositories. Manage add-on repositories pop-up window opens:
The assumption of the absence of a repository address is true. Therefore, the following address should be added: https://github.com/hassio-addons/repository.
Immediately after adding the above parameter, the Network UPS Tools component we need appeared in the search results:
Next, on the Info tab, we can read current information about this component, version, and if necessary, go to the link to the page of project developers. Choose Install:
Next, check the status of the Start on boot and Auto update options. They must be turned on. A red indicator at the top right of the page indicates that the component is not running. But it’s too early to start.
Next you need to configure the settings of this application. To do this, go to the Configuration tab and add the following code in the Options section:
We save the settings in the Options section. And in the network section, specify the host port on which data will be exchanged between the Client and the Network UPS Tools server. Save the settings in the Network section. And start the component. If all is well, a green indicator will appear at the top right of the page and at the bottom right indicators of CPU and memory usage by this component.
This is the end of the work on setting up the so-called Network UPS Tools server part, but that’s not all. That’s only half the job. You still need to configure the client part so that the Home Assistant can receive data.
To do this, we need to add the appropriate integration: Network UPS Tools (NUT). This can be done similarly to the steps described above (for example in the section with SpeedTest.net).
Go to the already familiar menu Configuration, section Devices and Services, Integration tab. We add a new Integration: + Add Integration. In the popup window Set up a new integration in the search field, enter the ups:
Component found. Select this element and get to the Connect to the NUT server pop-up window. We only need to enter two parameters: Username and Password, which we specified in the Network UPS Tools Add-on configuration earlier.
If we did not make a mistake in the user and password parameter and the previous steps of setup are performed correctly, we will be asked to select a list of resources (sensors) for monitoring. You can choose all, I chose only the following: Battery Charge, Battery Runtime, Input Voltage, Load, Self-Test Result, Status.
In the final dialog, you will be prompted to link this object to the area of your Smart Home. We will not make this binding at the moment.
Congratulations! All our actions were performed successfully.
The list of integrations includes a new integration component Network UPS Tools (NUT), which receives data from the server.
Select the 40 entities link to go to the list of filtered sensors. The sensors we have selected are active, all others are off.
Similar to the steps described above in this article, we will open pop-ups with sensor parameters Mgeev1150Battery Charge, Battery Runtime, Input Voltage, Load, Self-Test Result, Status and data collected in historical terms.
This will similarly complete the work with Network UPS Tools (NUT) monitoring sensors. In the following publications, we will explain how to configure the display of these sensors on the Lovelace panels of the Home Assistant.
What’s next?
So at the moment we know about the health of the hardware, software and database of our Smart Home core. We learned how to add and customize Add-on application components and Integrations. We also have information on the status of the power supply and the parameters of the uninterruptible power supply.
Do not forget to update the system and back up.
At this stage we will pause, and in the next publication we will tell about:
Greetings to all who read the series of publications “My smart home. From the beginning, step by step to… ”. In a previous article, I described the process of installing Home Assistant and its first settings.
Today we will describe how to add and configure additional software components – File Editor, Terminal. Make the first changes to the main configuration file: configuration.yaml. Let’s update Home Assistant to the current version.
So, let’s move on!
Software add-on: File editor
In Home Assistant, many parameters can be configured through the user interface, but there are enough of them, which are in the .yaml configuration files. So we need a tool to edit them.
You can find and install this official Home Assistant component by selecting the Add-on Store tab in the Supervisor section and entering the word File in the search field:
Next, select Install:
Next, check the Start on boot option. It must be on. Optionally, we can enable the Show in sidebar option – display the File Editor menu in the Navigator on the left. We start the component:
If the start is successful, this will be indicated by the corresponding green indicator at the top right. There will also be indicators to monitor the load of this component of the processor and memory:
When the File Editor component is successfully installed, open it via the link in the left navigator. Select the shortcut Browse Filesystem, and open the main configuration file: configuration.yaml:
This file now contains the default settings. There are not many of them. And we will gradually make our parameters there.
Configuration file: configuration.yaml
Let’s start editing the configuration.yaml file. Enter the following parameters:
homeassistant:
# Name of the location where Home Assistant is running
name: Elephant Home
# Location required to calculate the time the sun rises and sets
latitude: 50.724928
longitude: 30.380581
# Impacts weather/sunrise data (atitude above sea level in meters)
elevation: 109
# metric for Metric, imperial for Imperial
unit_system: metric
# Pick yours from here: http://en.wikipedia.org/wiki/List_of_tz_database_time_zones
time_zone: Europe/Kiev
The green indicator indicates no syntax errors. Do not forget to save the configuration through the appropriate graphic menu item:
After saving successfully, this graphic element will disappear:
And to apply these added parameters, you must restart the OS Home Assistant. This can be done through the Configuration – Server Controls section:
Select the Restart option:
Communication with Home Assistant will be lost for a while. After restarting and reconnecting to web services, you can perform a small check of the added settings. To do this, go to the Maps section and see the location of your smart home on the map of OpenStreetMap:
Software add-on: Terminal
Before proceeding to configure various integrations, we need another software application: a Terminal.
But before you can proceed, you must enable the Advanced Mode in user profile:
Now, Find and install this official Home Assistant component is similar to how we installed File Editor, only in the search box by entering Terminal:
Additionally, enable the option Auto update. We start a component:
Similarly, after starting the component, the CPU and memory monitor indicators will appear:
You can check the operation of the installed application in the Terminal menu:
Upgrading Home Assistant components
Some time has passed since the establishment of Home Assistant. Updates to this platform are released regularly. So it’s time to upgrade the system.
The whole sequence of steps can be performed in two ways – through the graphical user interface and through commands in the terminal. I will perform these actions using the console commands of OS Home Assistant.
● ● ●
Step One: System Backup.
To backup the state of the system before performing the update, use the functionality of snapshots.
We open the session of the terminal.
First, let’s learn about the list of existing snapshots:
ha snapshot list
Let’s create a new snapshot:
ha snapshot new --name snapbeforeupdate
Again, ask for a list of snapshots to see its properties:
● ● ●
Step Two: Check the configuration.
For a successful update, it is recommended to check the configuration of the Home Assistant OS:
ha core check
● ● ●
Step Three: Update the Home Assistant OS.
First we learn about the version number of our system:
ha os info
Next, perform the update:
ha os update
After the upgrade, the system will automatically reboot. We will be informed about this by the lost connection:
After reconnecting, we will receive up-to-date information about the updated version:
● ● ●
Step Four: Update Home Assistant Core.
Similar to the previous step, we first learn about the number of our version:
ha core info
Next, perform the update:
ha core update
Similarly, after the upgrade, the system will reboot. The connection will be lost for a while. Also, after rebooting, we will be forced to go through the login process again.
After rebooting, run the command again:
ha core info
Congratulations! This completes the update to the current version!
What’s next?
So at this point in time we already have the ability to work with configuration files, monitor the work of Home Assistant using commands in the terminal and we have updated the system to the latest version.
At this stage we will pause, and in the next publication we will tell about:
Sensors for monitoring system parameters: Raspberry Pi Power Quality and Processor Temperature Control Sensors; Processor, Memory, Disk, Network Monitoring Sensors;
Home Assistant Database Size monitoring;
Integration: Internet connection monitoring;
Add-On and Integration with external devices: Uninterruptible power supply monitoring.
Hello everyone who reads the series of publications “My Smart Home. From the beginning, step by step to…”. In the previous story, I described the necessary equipment to start implementation.
Now that all the components have arrived and are available, let’s move on to the software part. So we need any computer with Windows (x86 / x64), macOS, Linux x64 (64-bit) / x86 (32-bit), with the ability to work with an SD Card adapter and Internet access.
Let’s get started!
List of Software
The list for downloading software components is as follows:
№
Software Component Name
File Name
Size
Links
1.
Etcher for Windows (x86|x64) (Installer), v.1.5.121
balenaEtcher-Setup-1.5.121.exe
140 MB
2.
Home Assistant image for Raspberry Pi 4 64-bit, v.5.8
hassos_rpi4-5.8.img.xz
230 MB
Importantly! Other versions balenaEtcher and Home Assistant image will be required for other hardware platforms.
Image burning
When all the software is available, you can start writing the image to the SD card. Three small steps.
The procedure is as follows:
Run balenaEtcher. Select the option “Flash from file”:
Choose the SD card that we will use to run the Home Assistant OS on the Raspberry Pi 4 platform:
Select “Flash!” to start recording an image. When balenaEtcher finishes recording the image and checks the result of the recording with the original, we will receive a confirmation:
Start Up Your Raspberry Pi
So the SD card with the image of Home Assistant is ready! The following sequence of steps is as follows:
Insert the newly created installation media (SD card) into the Raspberry Pi 4 slot;
Connect the Ethernet cable to the network;
Connect the power supply;
In a few minutes we will be able to access the Home Assistant page at http: //X.X.X.X: 8123, where X.X.X.X is the address that Raspberry Pi received from the DHCP server:
The first settings
So, Home Assistant OS is installed, it’s time to start setting it up.
At this stage, the web interface Home Assistant itself will offer to configure the basic parameters.
Create a Home Assistant owner account. This account will be an administrator and will always be able to change any settings. Enter the name, username, password:
Specify the name and location parameters of the house, time zone:
If you want to share information with developers about the work of your copy of Home Assistant in terms of analytics, integration, statistics or diagnostic data – select the necessary items:
The integration setup phase can now be postponed. We will return to this direction later:
Finish, we get the configured start web interface of Home Assistant:
Congratulations! And this important stage has been successfully completed!
Testing environment
We will need a test site to test the changes that will be made in the productive environment of Home Assistant. It is not necessary to allocate separate equipment for this task, so we will use the virtualization platform for this purpose.
As a cloud architect, I have my own test demo environment. It works on the basis of VMware vSphere 5.x and 6.x. Home Assistant OS can be successfully run in this virtualization platform, although with some features.
Since we will do such actions periodically, I decided to write a small script in Powershell (PowerCli). It is designed to automate the process of creating a test environment Home Assistant in the form of a virtual machine VMware vSphere 5.x, 6.x.
The script consists of 15 steps:
Define variables;
Download HASS OS vmdk.xz;
Extract HASS OS vmdk, rename from .tar, delete .xz;
Connect to VMware Infrastucture;
Set Datastore properties;
Create HASS OS Virtual Machine;
Copy HASS OS vmdk to Virtual Machine Datastore Folder;
Create Configuration Specification HASS OS Virtual Machine;
Check if there is an IDE COntroller present;
Add IDE harddisk to VM configuration;
Set VM EFI firmware;
Reconfigure HASS OS Virtual Machine;
Start HASS OS Virtual Machine;
Get Ip Address HASS OS Virtual Machine;
Open Web Browser and go to Home Assistant Start Web page.
The script code is below:
<#
.SYNOPSIS
Automate create Home Assistant test Virtual Machine in VMware vSphere.
.DESCRIPTION
This script is designed to automate the process of creating
a test environment Home Assistant in the VMware virtual machine.
.NOTES
File Name : HassVmwareTestEnv.ps1
Author : AIRRA (roman@airra.net)
Prerequisite : PowerShell V2 over Vista and upper,
7zip4powershell module,
VMware.VimAutomation.Core snap-in.
Copyright 2021 - AIRRA
.LINK
Script posted over:
http://blogs.airra.net
#>
# Step 1: Define variables
$HassVMDKUrl = "https://github.com/home-assistant/operating-system/releases/download/5.8/hassos_ova-5.8.vmdk.xz" # Home Assitant git download Release Path
$HassVMDKDownloadPath = $env:TEMP # Path to download Folder
$HassVMDKArchiveName = "hassos_ova-5.8" # Home Assitant VMDK Archive Name
$VIServer = "_" # Address of VMware Vcenter Server
$VIServerUser = "_" # User with admin permissions
$VIServerUserPassword = "_" # Password
$VIHost = "_" # Address of of VMware Esxi
$VIDatastoreName = "_" # Datasore Name
$VINetwork = "_" # Network Name
$HassVMName = "hassio.test" # Virtual Machine Name
$HassVMDKSourcePath = $env:TEMP
$HassVMDKSourceFile = "hassos.vmdk"
$HassVMDK = $HassVMDKSourcePath + "\" + $HassVMDKSourceFile
$PathDisk = "[" + $VIDatastoreName + "] " + $HassVMName + "/" + $HassVMDKSourceFile
# Step 2: Download HASS OS vmdk.xz.
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
Invoke-WebRequest -Uri $HassVMDKUrl -OutFile ($HassVMDKDownloadPath + "/" + $HassVMDKArchiveName + ".vmdk.xz")
# Step 3: Extract HASS OS vmdk, rename from .tar, delete .xz.
Expand-7Zip -ArchiveFileName ($HassVMDKDownloadPath + "/" + $HassVMDKArchiveName + ".vmdk.xz") -TargetPath $HassVMDKDownloadPath
Remove-Item -Path ($HassVMDKDownloadPath + "/" + $HassVMDKArchiveName + ".vmdk.xz")
Get-Item -Path ($HassVMDKDownloadPath + "/" + $HassVMDKArchiveName + ".vmdk.tar") | Rename-Item -NewName $HassVMDKSourceFile
# Step 4: Connect to VMware Infrastucture.
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls,[System.Net.SecurityProtocolType]::Tls11,[System.Net.SecurityProtocolType]::Tls12
Connect-VIServer -Server $VIServer -User $VIServerUser -Password $VIServerUserPassword
# Step 5: Set Datastore properties.
$Datastore = Get-Datastore $VIDatastoreName
New-PSDrive -Location $Datastore -Name vids -PSProvider VimDatastore -Root ""
Set-Location vids:
# Step 6: Create HASS OS Virtual Machine.
New-VM -Name $HassVMName -VMHost $VIHost -Datastore $VIDatastoreName -MemoryMB 1024 -NumCPU 1 -DiskMB 1 -NetworkName $VINetwork -GuestID debian6_64Guest
Get-HardDisk -VM $HassVMName -Name 'Hard disk 1' | Remove-HardDisk -Confirm:$false -DeletePermanently:$true
# Step 7: Copy HASS OS vmdk to Virtual Machine Datastore Folder.
Copy-DatastoreItem -Item $HassVMDK -Destination vids:$HassVMName
# Step 8: Create Configuration Specification HASS OS Virtual Machine.
$vm = Get-VM -Name $HassVMName
$spec = New-Object VMware.Vim.VirtualMachineConfigSpec
# Step 9: Check if there is an IDE COntroller present.
$ideCtrl = $vm.ExtensionData.Config.Hardware.Device | where {$_.GetType().Name -eq "VirtualIDEController"} | select -First 1
if(!$ideCtrl){
$ctrl = New-Object VMware.Vim.VirtualDeviceConfigSpec
$ctrl.Operation = "add"
$ctrl.Device = New-Object VMware.Vim.VirtualIDEController
$ideKey = -1
$ctrl.Device.ControllerKey = $ideKey
$spec.deviceChange += $ctrl
}
else{
$ideKey = $ideCtrl.Key
}
# Step 10: Add IDE harddisk to VM configuration.
$dev = New-Object VMware.Vim.VirtualDeviceConfigSpec
$dev.Operation = "add"
$dev.Device = New-Object VMware.Vim.VirtualDisk
$dev.Device.backing = New-Object VMware.Vim.VirtualDiskFlatVer2BackingInfo
$dev.Device.backing.DiskMode = "persistent"
$dev.Device.Backing.FileName = $PathDisk
$dev.Device.ControllerKey = $ideKey
$dev.Device.UnitNumber = -1
$spec.deviceChange += $dev
# Step 11: Set VM EFI firmware.
$spec.Firmware = [VMware.Vim.GuestOsDescriptorFirmwareType]::efi
# Step 12: Reconfigure HASS OS Virtual Machine.
$vm.ExtensionData.ReconfigVM($spec)
# Step 13: Start HASS OS Virtual Machine.
Start-VM -VM $HassVMName
# Step 14: Get Ip Address HASS OS Virtual Machine.
$Ip = (Get-VM -Name $HassVMName).Guest.IpAddress | ?{$_ -notmatch ':'}
Do {
Start-Sleep -s 10
}
While ($Ip -eq "" -or $Ip -eq $null)
# Step 15: Open Web Browser and go to Home Assistant Start Web page.
Invoke-Expression "cmd.exe /C start http://$Ip[1]:8123"
Important: The script uses the following components:
7zip4powershell module,
VMware.VimAutomation.Core snap-in.
What’s next?
So, at this point we have a deployed and initially set up Home Assistant.
At this stage we will pause, and in the future we will talk about:
Software add-on: Text config editor, Terminal;
Configuration file: configuration.yaml;
Upgrading Home Assistant components to the latest version.
Congratulations to everyone who periodically reads my blog. This time it will be about my attempt to implement the smart home model.
It all started down to the banal simple, with the purchase of a small townhouse. And while the main construction work was going on, experiments with different platforms of the Smart Home core began in parallel. Among the candidates were Home Assistant, MajorDoMo, OpenHUB and many others. After testing in a virtual environment, there is one candidate left – Home Assistant, about whom I want to tell you. And also about options of its integration with other systems.
This step-by-step review may be useful to some readers, because it will save the most important thing in our lives, it’s time. Much of what will be described was born of many successful and not-so-successful attempts.
So let’s get started!
Hardware
Let’s start with the hardware. At the first stage, the set of devices is not large, so you will fit into the mini budget.
● ● ●
Raspberry Pi 4 Model B
This is the fourth generation of the main line of minicomputers from the Raspberry Pi Foundation.
The technical characteristics of the board are as follows:
In its design of a smart home, it was decided to place its control components as much as possible in electrical switchboards. So we will need a housing for the Raspberry Pi 4 Model B on a DIN rail.
The DIN rail case for Raspberry Pi 4 Model B specifications:
Length – 88 mm;
Width – 90 mm;
Height – 58 mm;
The base material is plastic;
Material type – Polycarbonate;
Color – Gray.
● ● ●
Bill of materials
So the starting list for purchasing components is as follows:
№
Component Name
Part Number
Price, USD
1.
Raspberry Pi 4 Model B, 2Gb
–
~75$
2.
Official Raspberry Pi USB-C power supply for Raspberry Pi 4