[Domotica | Win IoT | .NET Core 2.1] MVC Web SignalR Hub

Ok, so I have a working application on my RPi to communicate with the z-stick.

The next step would be to replace the simple loop on/off test with an actual interface with some switches to turn adapter on and off. At first I had the idea to go for a simple web api. From there I would create a web interface to send command to the web api which would pass the command to the z-stick. The issue I was facing with this solution is that when there are multiple interfaces open (my wife’s phone, my phone and perhaps some general device hanging on the wall), I can only update the interface of the current user when a switches has been pressed, unless I would use a polling mechanism to the web api endpoint and continuously check the state of the adapter. I absolutely do not prefer this solution because of the possible load I might generate in the endpoint (and let’s be honest, checking every second for a state which only changes once in a while is sort of a DDos attack on your own environment).

While I was searching the internet for how to deal with this scenario, I came across a Youtube post of Hassan Rage. In this video he shows a really simple example of using SignalR for communication between his RPi and his switch. As SignalR provides a real time connection between the host and multiple devices and as of the solution works very well in the video, I decided to use this option as well.

Continue reading [Domotica | Win IoT | .NET Core 2.1] MVC Web SignalR Hub