Category Archives: Driver Works

Driver work specific stuff

Control4 driver for IP Power 9258 DS power distribution unit (PDU)

A PDU is a power distribution unit. It provides some main inputs and some switched main outputs. Its the ideal way to manage power in your AV rack.

The  IP Power 9258 DS PDU (Rack mountable , 8 switched mains outputs) is available on many stores online. Just search with Google. Its a relatively cheap way to manage 8 outlets, pricing begins with 299$. In Europe we would recommend to order it from Sphinx  Connect, Part number 290085

The driver to use is the custom lua functions driver.
Download: (login needed) custom_lua_functions_DriverWorks_1_00_001
To make it work with the PDU you need to load this config file GTASLCO4CULUFU using the driver.

  1. Insert the custom lua functions driver with composer
  2. Go to the Properties page of the driver, there a path like \\\drivers\lua\sandbox\xxxx is displayed.  Browse with Explorer to that folder
  3. Copy and replace the GTASLCO4CULUFU.lua file with the one from the download above
  4. Open the file and make sure you have set the correct IP address in line 46 and also the correct username and password in line 47 and 48. User and pass are already set to the defaults of the PDU. If you load the file with incorrect username or password C4 Director may have to be restarted doing to the fact that the C4:urlGet function will block until killed
  5. In the drivers Actions page press Load file
  6. See in Programming that the driver has exposed 8 Variables named with POWER_RELAY_1 to POWER_RELAY_8 which can be set to true and false, true will have the relay to close, false will open.

If the driver does not act as expected, set the Log mode to  Print and the Log level to Debug. These setting  have the LUA window to print out whats going on.


Control4 driver for Cisco SBS series switches and network monitoring tools

This driver set is the Swiss army knife, it combines network monitoring tools with the ability to automatic reset power lines and/or ports of a switch. So first we need to make sure to have s Cisco Small Business Series switch in the project, a SG300-28 or whatever, 500 series also should work. It does not matter in which configuration the switches are running.

So for simple port control of the switch we just need the switch driver, setup as follows:

  1. Setup the Switch to allow Telnet access
    Login with your credentials and find the point to activate telnet. Usually Security->TCP/UDP Services
  2. Setup the driver in Control4
    Find the driver by tipping “cisco” into the search field
    And insert the properties
    If the driver starts correctly under Programming all ports are listed
    Each port can be switched on/off/toggled using this variables.

But wait, what about my ADSL that hangs every 2 days? No need for expensive power relays (that hang by itself…), we use C4 combined with the Cisco switch to do the job!

How to restart my ADSL modem if its not responding anymore

  1. Add the ping check driver
    Insert the IP of the router or in case of a modem a IP from the internet/from your provider
    Careful set the properties, in the drivers Documentation tab is explained what they do.
  2. Set the actions to take on ping loss
    To get something happen if the ping is lost, we have a variable named device_power_control, it goes to false if the ping times out, true if it the device answers correct. Furthermore a direct relay connection can be done
    The relay connection can be connected to a low voltage relay (to break 12V or such) like the  one from the Controller, also possible to connect to a high voltage relay from a DIN-8REL module to break the power. The down time is 10 seconds, after that the relay closes again
  3. Switch a POE port of the switch on ping  loss
    Jump to programming and set the ports variable to the device_power_control variable

Ping is ok but can I test also a telnet port, like the one from Director? Hang on!

Restart devices that should be checked on a telnet/TCP port

  1. Add the telnet check driver
    And set the properties, again read the Documentation tab of the driver..
  2. Set the actions to take if port is not available
    The telnet driver has the same variables and relay outputs as the telnet driver, see above how to set up

The drivers for all this you find here (login needed)

Latest switch driver version 1.00.005. Does expose a relay binding for each port
Download here (login needed)

Latest version switch driver 1.00.009

  • For each POE port and each link port a separate Relay connections is available in Connections
  • Only ports that are physically available are listed
  • Divers improvements

Download here (login needed) switch_300-500_Series_Managed_IP_driverworks_cisco_1_00_009


Control4: Pimp Programming with LUA code

A LUA driver writer often times see on site simple tasks that cannot be executed in Composers Programming like:

  • Round a number / calculations
  • Simple string formatting
  • etc…
  • All Lua “on board” functions

Now the “Custom Lua Functions” driver does provide a simple way to manage all this kind of tasks. The driver itself does contain all code that is needed to be a driver, from debug possibilities to  timer functions.

The functional code itself is outsourced to a file on the C4 file system. It also adds to the driver the variables that are used for data input and output via Programming. (For sure you can add as many variable as you want and you choose the name)
A sample file is included in the zip file which provides out of the box some working examples and also some instructions.
Looking to this file you will see that it is very easy for everybody that knows LUA  a little bit to add even complicated operations. Once the function code is defined, load the file via the drivers Actions and your done.  Now you can set the Variables via Programming and they will execute your own fancy code, delivering the output you have defined with your code.

Download here (login needed):


Camera text overlay drivers for Axis and Lilin

Due the lack that C4 does not show the outside temperature in mobile apps we have developed drivers that put  the temperature as text overlay into the camera picture. This way the customer from Miami can see the outside weather and as well the temperature when he connects to his Chalet in the alps. (looking to the security cams on the app)

Now how to set up all this:
First you need this driver to get the weather data for your location. Its a driver from Ryan Boucher (many thanks for such excellent drivers) with a little modification that we get the weather condition in Composer as string variable:
Download (login needed): other_ip_theory_Yahoo Weather
Then depending on the camera you have :
Download (login needed): camera_text_overlay_driverworks_axis
Download (login needed): camera_text_overlay_driverworks_lilin

How do I get there in detail?

Setup in Composer the camera:
Setup the weather driver: (The WOEID code for your location you find here:
Setup the text overlay driver: (same data as you inserted into the camera driver)
Then jump to Programming. At the end it should look like that:
First setup that as soon the temperature changes it gets written to the NUMBER1 variable of the overlay driver:
The weather condition need to go into STRING1:
Finally combine the string:
STRINGx and NUMBERx in the message string will be replaced with the data the variable contain.
See the result: