Raspberry Pi 3 Home Automation Siri Rekay DIY

 Hey, Siri Turn on the nights. Hey, Siri. Turn off the lights. done Hello,everyone today I will introduce you to a new way to control our relay box this is our relay box Now we can control by iPhone and iPad by homekit we will tech you how to add this box to home assistant For many control ways This is our relay box And we will use a Homekit to control this relay output And we can use this IPhone and also This iPad control relay by homekit And we will use this product the relay box the iPhone or iPad, and this is a mini computer. This mini computer will run our program for homekit to use And all this product will connect with the router in LAN for local control Now I will tell you how it works.

 Now look at how it works. This is a router This a router This, have a  mini computer or just a computer we will give you have a demo show so we use a mini computer is conveniently to show you so. This is. Computer. You can use windows system. or linux system Linux operating system. And also the router This is our relay controller This controller can. control lamp and other device, such as a lamp. 

or such as other switch For many channels. And also you can connect with. switch board switch panel? This is for hand control, manual control not to need the computer and the router just control all switch in local mode and this we can see This is a Computer for user to use. You can use this computer login by website to control relays and this computer Also can Windows PC or Apple MacBook And another control way This is iPhone or iPad this two device all can control relay box this 2 device you can control by homekit or by Siri or by browser Just a open browser and input the Web address you can control relays so this is construction of whole system this main computer we need to install plugin and software on it Such as home assistant MQTT service And another Program we means: HADemo This is a coverter program write by our company.

 Because our relay box have our private protocol home assistant need MQTT protocol So we have install this HA demo program to convert our private protocol to MQTT protocol so we can control relay by iPad and iPhone from home assistant And this system work in LAN Just work in LAN , not need internet not need internet If you have already have the relay controller you just install this computer This computer you can find a PC or other device just install these software in this computer when you complete  install all software in this computer you can use PC computer or mobile phone iPhone iPad control relay box Now you can see this device means computer and this also means computer This is a client computer and this is the service This is a server. supply service for these client device if you connect with the Internet also no problem but if the Internet is broken down The whole system all can work well will be no problem So this internet line you can connect with router or disconnect, all no problem Now we began to install the software of the minicomputer. 

We can see the system. this is displayed CPU and memory and all the information We install the Windows10 OS First we need to install the python because home assistant is based on the python We opened the python website and chose download find newest python version to install You can choose your Windows version If you install on the Linux operating system you can also download the corresponding version Because our windows is 32bit,so we download the 32 bit application After download we run the program begin to install and chose add path option then begin install After complete we press "python", we will see the python version it shows the python install completed Then we began to install home assistant we input this command for setup This is a error information because we need to download Microsoft C++ Build Tool So we will visit Microsoft.com download the tools for Visual Studio This is the build tool for visual studio And we download I after we download he began to install and we check this option C++ build tools and begin to install when install complete,we install home assistant again then we will never see the error information again now we begin to install ActiveMQ this is MQTT service for home assistant Convert our private protocol to MQTT protocol Which was the Windows version to download. 

when download the file, we extract to this file we short rename it's convenient to press the command And the copy this folder to C:\ Now we use commands to create the MTQQ service we go to the ActiveMQ path go to the \bin folder And type this commander for create MQTT service But this is an error information because we have not installed JDK file the JDK is for java environment so we need to download JDK files We chose these windows OS verison download the JDK file and install the JDK we input "java -version" for check we need to add windows system environmental variable So we need to create new variable set the path of java you can just Input the name and other information as my information also add this 2 lines for java setting now we can input "java -version" for test when you can see the java version, that show java have install completed So now all the software have been installed This is a lesson for how to use home assistant with our relay module You can see this website and to do how to open software and config for homekit Now we need to begin create hademo MQTT service it takes some times we need to download hademomain.exe from our website This file is an application for convert our private protocol to MQTT protocol So when we download this file we can see the application.

 we can open this application The device ip/domain , port is your relay controller's You can open VirCom software see relay controller's IP and Port MQTT service because instsall at local computer, so input IP: next we need to config home assistant config file We can't find the home assistant config file in this path If you install the new system you will never see this more information You can download the config file from our website because we have supply config file for our relay controller you just need to change a little And a copy all information to a home assistant config file this config file show you every relay's ip and port if you want to use homekit, you need to add this homekit: line we can use the replace function with the notepad replace all ip address the name is "relay1" you can change, such as "light" such as a switch or socket after we changed, we save file And close the file now we ready to start home assistant service we can input the command hass --open-ui we enter "--open-ui" that after service start,open browser automatically Now you can see home assistant is opened We have already registered a username and the password so now just login with our information Now you can see 32 channel relay is listed You can control every relay ON/OFF by webpage And now we add device to homekit we just input this number then you can add all relay to Apple homekit Now the Apple Homekit has it been complete config set every relay, such as rename