tenWare Software

Tips and FAQs

01 Incompatible HS4 library files

tenScripting4 uses many HS4 functions to simulate the HomeSeer environment, and needs access to the HS libraries containing these functions.  Since version 4.5, these libraries have been distributed with the installation package.  There may be a situation where the libraries included with tenScripting4 are incompatible with the libraries that are used by your HS4 server.  One solution, probably unacceptable, is to upgrade/downgrade your HS4 installation to the same version that the tenScripting4 version is based upon.  A less disruptive solution is to just copy the library files from your HS4 installation to the tenScripting4 folder located at \tenScripting4\tenScripting4\Libraries.  The following files should be copied:







After you have copied these six files, open tenScripting4 and click on the Build menu and then Rebuild Solution

02 Cannot retrieve HsDevice object using hs.GetDeviceByRef() in HS4, works in tenScripting4

UPDATE:  HS4 version resolves this problem by making available the IHsController class members instantiated as hs4.   When you export your script from tenScripting4 (version 4.7 or higher), the hs4 will NOT be replaced with hs and hs4.GetDeviceByRef(174) will work as expected.

The following code used in a script running under tenScripting4:


correctly returns an object of type HomeSeer.PluginSdk.Devices.HsDevice

When run in the HS4 scripting environment, the following:


returns an object of type Scheduler.Devices.DeviceClass

The problem is that the HS4 hs object is of type hsapplication, which contains the members from both IHSApplication (which is primarily the HS3 scripting functions) and IHsConroller (which contains new functionality added with HS4).  Both contain a GetDeviceByRef method with the exact signature, and hence only one could be included, and it appears that HomeSeer included the prior HS3 version of GetDeviceByRef in the HS4 hs object.  There is a way to retrieve the HsDevice object for a DeviceRef using the following:

Dim ad As HomeSeer.PluginSdk.Devices.AbstractHsDevice

 Dim aDevice As HomeSeer.PluginSdk.Devices.HsDevice

 If hs4.IsRefDevice(174) Then

   '' DevRef is a Device (root)

   ad = hs4.GetDeviceWithFeaturesByRef(174)


   '' DevRef is a Feature (child)

   ad = hs4.GetFeatureByRef(174)

 End If

aDevice = CType(ad, HomeSeer.PluginSdk.Devices.HsDevice)


The code can be greatly simplified if you know if the Reference is to a Device or a Feature.

03 Cannot Use Realtime Debugging for a Device Button script

HS allows you to create a button on a device that will run a specified script.  While a script run from an Event is passed a single parameter of type String, HS passes an array of Object to a script run via a Device Button.  The first array element contains the device reference (Integer) of the device triggering the script, and the remainder of the entries are the individual parameters (String) defined for the Device Button.  The tenRunScript script does not support this kind of parameter passing.
Version 4.10 of tenScripting4 contains an additional script tenRunScriptButton that provides the same functionality as tenRunScript, except that it handles the parameters for a Device Button.

04 Problems Connecting to HS4

If you are running tenScripting4 on a separate computer from HS4, you may have to open port 10400 for TCP in the firewall on your HS4 computer.  While this is usually only necessary if connecting remotely, some users have reported that they needed to open this port even when connecting from within the same local network. Also, check to make sure the network connection on the HS server computer is set to Private, not Public.  If you need it set to Public, then you will probably have to open port 10400.