CastleHUB and CastleOS Review – Part 4 – Scripting

This post is part of a series of my thoughts on CastleOS and the CastleHUB. If you haven’t already, you should check out my initial thoughts here. The following is my opinion, and Your Mileage May Vary.

 

CastleOS claims it has one of the most powerful scripting languages in the industry. It’s advertised as simple to use, but in my limited experience it has been anything but simple.

CastleOS’ scripting language is C#. Coming from a PHP background the learning curve for me wasn’t too high. However to get a simple script to fetch the weather over an XML library and then speak it over TTS, I had to compile an EXE. Although powerful, the CastleOS scripting features have a huge barrier to entry. There’s little to no documentation available, and I can see it being very daunting for new users who want to add in some of their own customisations.

Debugging errors in custom scripts is also a nightmare. To test my scripts, I created a custom voice command which would run the script in CastleOS. However, if something went wrong, it would crash CastleOS, and I’d have look through the Windows Event Log to see what the problem was. Luckily this has since been fixed, and CastleOS shouldn’t crash as often. However, debugging your scripts is still a PITA.

Are you up?

At one point my script development was causing CastleOS to crash so frequently, I needed a quick way to see if CastleOS was up. I created a simple script, that when called would send some speech back to my speakers. That way I could tell if CastleOS was up or down.

Get Script

 

API Access

One of the promises from the CastleHUB Kickstarter campaign was a free and open API. Well, over a year later and there has just recently been the introduction of a HTTP REST API. There’s also a new Developers portal on the CastleOS website.

There’s some features and functions that are missing from the REST API still, like thermostat control. However, if you’re looking for a way to control your home devices from your own web application, I’ve written a PHP Wrapper Class that will allow you to turn on/off devices, change light colours, etc.

CastleOS HTTP PHP Wrapper

A simple PHP class to interact with your CastleOS installation over HTTP.

View on GitHub

 

Adding Device Support

The Home Automation industry is moving at an extremely fast pace. With new devices and protocols coming out every month, it’s impossible for any one system to support them all. Open source libraries like OpenHAB and Home-Assistant have an advantage over closed systems, where others can add support for these new devices/protocols, then share them with the community.

The CastleHUB Kickstarter promised an open driver development system. It’s still not there, and I’m wary that even when it does make it to developers, it will be restricted. Right now, if there’s a new device or protocol that comes out, you’ll need to wait for CastleOS to support it.

 

Next Up

Next up I’ll be testing out the media playback of the CastleHUB, so be sure to follow me or subscribe on your favourite social media.

[facebook_follow_button href=”https://www.facebook.com/philhawthorne” layout=”button”]

Recommended Posts

Start typing and press Enter to search