Copy

Home Control Assistant Newsletter for Aug 29 2021

Have you read the Important Announcement posted on August 1, 2021? If you haven't you need to.
Can I build a HTTP Server in HCA?
As you know by now, to answer that question, I like to start with a statement of a problem and then make a design followed by an implementation.

My automation solution creates log files of various activities. Not the HCA log but separate text files that contain information that my programs add to them. I did that using the File operations available in the Compute expressions (FileOpen, FileClose, FileWriteString).

As an aside there is also a package in the online library called “Logger” that can do this work for you.

Regardless of how these files came to be, I wanted to be able to quickly look at them. I had several ideas for possible ways to do this. First, I could just go to the computer running the HCA Server which is in my utility room as it has a monitor attached to it. Second, I could use Team Viewer or Windows Remote Desktop to get access to the machine. Third, I could make its drive shared and access it from any of my other machines. And finally, I could install the Windows component to make the server computer into a web server and access the files using a browser from other machines on my network – this is called Windows “IIS”.

I didn’t want to get up and go to the other room, nor did I want to have to start Team Viewer. I never can remember the details on how to share a drive, and Windows is always complaining about some access permission when I do that, so I didn’t even try.  Installing IIS – even though very simple as I have done it in the past –just seemed like too much.

But what if I could use HCA interfaces and programs to make the HCA Server operate, in addition to all it does, as a very simple HTTP server? Then I could use a browser to view those log files and maybe do a few more things. Possible or impossible?

Turns out it is possible. The HTTP protocol, while complicated if the whole protocol is implemented, can be really stripped down enough so my browser (Chrome) can send to and get responses back from HCA.

I’m not going to go into the implementation here because you can look at the programs that implement this, as I put it all into the online library – look for the “HTTP Server” package. But I will show how to set it up if you want to try it.

Important aside: You will need HCA 17.0.38 for this package which has not yet been officially released but can be downloaded as a beta. Just drop me a note and I’ll give you the necessary download info.

First you will need to use one of the eight interfaces and identify it as a “Generic Server”. Like this:


And set up its configuration like this


Then all you need do is to go to the online library and add the package called “HTTP Sever” to your design.

After you do that, check that the program “Receive HTTP” that is part of the package has a single trigger like this:


It should import with that trigger if you named the “generic server” as “HTTPServer” – note no spaces in that name.

Next you will need to know the IP address of the computer running the HCA Server. In my network it is 192.168.0.144 – yours will be different.

Now start your browser and enter this in the address bar using your server computer IP address instead of mine.


Hit [Enter] and the daily report should appear. It will look boring unless you configure it using the “Daily Report Setup” tool in the “Tools” ribbon category.

This HTTP Server implements a few other things, one of which is the ability to have HCA read a file and return its contents to the browser. Like this:


The name of the file is after the ‘=’ sign and must be in the HCA documents area and if it has spaces in the filename then you must use the URL convention for that, replacing the spaces with %20.
That’s what I needed to implement, and it works. I created bookmarks in my browser to show the files I want to monitor.

If you look at the programs in the package you can see that I also built some additional facilities that I may be using in the future but no discussion of those now.

I’m sure that there are about a hundred “security” problems with this, but I choose to ignore those as it is all on my trusted internal network. If that seems reckless to you then you need not use this solution.

It really is amazing what one can build with HCA and a few programs.

 
Anyone who is using Hubitat with HCA – not SmartThings – please drop me a note as I would like to add you to a discussion list for those users. I have some Hubitat ideas that I would like to “kick around” and it would help to have a group of users who have experience with Hubitat. Please just send a note to the regular support address saying you would like to be added to that discussion list.
Backup!

When was the last time you made a backup of your HCA design? Not a month goes by without at least one tale of woe from a HCA user. Please use the "Design Backup Assistant" on the Tools ribbon category. The work you save will be your own.


 
Copyright © 2021 Advanced Quonset Technology, Inc, All rights reserved.


Want to change how you receive these emails?
You can update your preferences or unsubscribe from this list.

Email Marketing Powered by Mailchimp