Now that I have set up the environment it is time to take a closer look on how I am going to build and connect my applications. The architecture will contain 3 different components: a Web UI, a Host Controller and a Web Host to connect the Web UI and Host Controller together.
HTML UI (.NET CORE 2.1 Web app)
Universal Windows Program Host Controller (USB Interface)
If you have followed my previous post, you know that I am going to use the Aeon Labs Aeotec Gen 5 Z-Wave USB Interface. This Z-Wave USB is a Host Controller which send and receives the signals with other Z-Wave devices. As this USB will be attached to the Raspberry Pi, I need to make an application which will run on the Raspberry Pi who can handle the application logic and sends it to the USB Interface. The USB will send out the signal to the devices so they can respond on it.
MVC Web SignalR Hub (.NET CORE 2.1 Web app)
In order to connect the Web UI and the host controller I need to have a web based solution. Next to this, it also needs to be reliable and most important: real time connection! By digging around I stranded on a YouTube video of Hassan Rage who showed an example of using SignalR to connect his RPi, a send/receiver and a Console Client to turn his light on and off. As we are in a similar situation I choose the option of using SignalR as well.
The communication between these components is really easy. Within the Web UI I will show a list of possible switches. By pressing a switch, I will send a command to the Web Host SignalR Hub. The Hub will broadcast the message to the UWP App Host Controller. The UWP will send a command to the USB Interface. Once the command has been executed successfully the UWP app will return a response to the Web Host SignalR Hub. This response is broadcasted by the Hub to the Web UI where the UI can update the interface by visually toggling the light switch.
That’s all to it. All left to do now is making the implementations. In my next blog I will start with the UWP App first.