Jump to content

Welcome, Guest!

Be a part of CinemaVision today! Once registered and logged in, you will have access to public chat and your own private messenger, you can view and contribute guides, collaborate on the forums, review downloads, give reputation to your fellow members, contribute content and so much more. Registering is quick and completely free, so what are you waiting for?
   Sign In    Sign Up

Become a RedCarpet Club Member Today!

Lorem ipsum dolor sit amet, sea eu causae aperiri periculis, iusto affert soleat an sea, soluta petentium inciderint nec no. Dolorum reprimique ullamcorper sed ad. Ei quo malorum singulis, tota mundi feugait ut pro. Choro utamur inimicus ex sea. Tota dicit te usu. Sea ad erant possim reformidans. An modus detraxit postulant vel. Per no habeo ludus qualisque. Vix legere singulis legendos et, an cum eius soluta accumsan. Facer discere no nec.
   Join Now

Download the Kodi Add-on Today!

Lorem ipsum dolor sit amet, sea eu causae aperiri periculis, iusto affert soleat an sea, soluta petentium inciderint nec no. Dolorum reprimique ullamcorper sed ad. Ei quo malorum singulis, tota mundi feugait ut pro. Choro utamur inimicus ex sea. Tota dicit te usu. Sea ad erant possim reformidans. An modus detraxit postulant vel. Per no habeo ludus qualisque. Vix legere singulis legendos et, an cum eius soluta accumsan. Facer discere no nec.

Understanding CinemaVision Actions


This guide will teach you how to use CinemaVision Action Files to control your home automation solutions from your Sequence.

0

The Big Picture

CinemaVision uses Action Files (.cvaction) to integrate seamlessly with home automation solutions, control Kodi settings and add-ons, and much more. Using Action Files, CinemaVision can control any solution with a web-based or RESTful API. The possibilities are seemingly endless, and it's really simple to use. You do not have to know how to write code to successfully integrate CinemaVision with any solution.

The Basics

An Action File is made up of any number of Actions, and can contain comments.
An Action is a single command containing protocols, methods and data that can be sent to a target device or application, defined in an Action File.
There are scenarios in which Action Files can be used in CinemaVision.

  1. Sequence Triggered: Action Modules can be placed at any point in your Sequence, and be used to call an Action File at that point in your Sequence.
  2. Event Triggered: Action Files can be directly triggered on an event such as Pause/Resume/Abort. These can be set in the add-on settings under the Actions menu.

All of the files that CinemaVision uses for configuration are plain text files, and XML files. To avoid issues with file formatting, we recommend using Notepad++ to edit all files related to CinemaVision. Click the image below to download Notepad++ for free.

notepad++_logo.png

To create an Action File, simply create a new text document, input the command that you want to use and then save the file as <file_name>.cvaction in your %CVROOT%\Actions directory. Don't forget, we also have pre-built Actions for different home automation solutions in the Downloads section of the website. Try not to re-invent the wheel if you can avoid it, but feel free to tell us about any improvements we could make and send us the Actions that you create so they can be hosted on the site for others to use.

The Syntax, Methods, and Protocols

CinemaVision Action Files currently support the following Syntax:

Command What it does
# Adding this to the beginning of a line will comment or ignore the contents of that line.
<protocol>:// Adding this to the beginning of a line specifies the protocol to use for that command.
<method>: Adding this to the beginning of a line specifies the method to use for that command.

CinemaVision Action Files currently support the following Protocols:

Protocol Command
http:// Allows you to pass JSON commands via a URL.
addon:// Allows you to run a script or add-on by add-on ID and pass in arguments.
command:// Allows you to run a command or application at the OS level and pass in arguments.
module:// Allows you to run a Python script that has a main() method that is imported and called.
python:// Allows you to call any normal Python script via the operating system.
sleep://<milliseconds> Sleep (pause) within the Action File for the time specified in milliseconds before moving on to the next Action.

CinemaVision Action Files currently support the following Methods:

Method Function
HEADERS: Sends header information to the target device or application.
POST: Sends a POST command to the target device or application. Used to create information.
PUT: Sends a PUT command to the target device or application. Used to update information.
DELETE: Sends a DELETE command to the target device or application. Used to delete information.

Actions can be a single line, or multiple lines. Blank lines separate commands in Action Files. The first line of any Action is the Execution Line. The line following the Execution Line can be either a Headers Line or a Data Line. A Headers Line can be added before the Data Line to specify the content type, or any other headers. To specify a Header Line, prefix the line with HEADERS:. Data Lines, and are used to pass arguments or data. To specify the Method to use on your Data Line, prefix the Data Line with POST, PUT or DELETE. If no method is specified, the default method used is POST.

For example:

# THIS IS THE FIRST ACTION IN MY ACTION FILE
# The following is the Execution Line
http://192.168.1.1/api/71c7e131698139q20507d0c4b84d6e7/groups/0/action
# The following is the Headers Line (optional)
HEADERS: {"Content-Type": "application/json"}
# The following is the Data Line
PUT: {"on":true,"bri":100,"hue":65000}

# THIS IS THE SECOND ACTION IN MY ACTION FILE
# The following is the Execution Line
http://192.168.1.1/api/71c7e131698139q20507d0c4b84d6e7/groups/0/action
# The following is the Data Line
PUT: {"on":true,"bri":60,"hue":65000}

There is no limit for how many Actions you can put in one Action File. The Actions will be executed in order, first to last. Here is an example of a more comprehensive Action File:

# This is an example of a CinemaVision Action file
#
# Actions will vary based on the Home Automation system that you are using
# Please consult the API documentation for your Home Automation system
#
# Any line prefixed by "#" is a Comment, and will not be executed
# Comments can be placed between commands and arguments as long as there are no blank lines between the command and the arguments
# If you need to start a non-comment line with a "#", prefix it with a "\", for example "\#"
#
# Any blank line with no data signals the end of a command
#
# To execute Commands and Programs, prefix your Execution Line with "command://"
# To execute Python scripts, prefix your Execution Line with "python://"
# To execute Add-ons, prefix your Execution Line with "addon://"
#
# The first line of any Action is the Execution Line
# Any lines following the Execution Line are Data Lines, and are used to pass arguments or data


# This is an example of a simple GET: request and not very useful
http://google.com?q=frogs


# This is the Execution Line which opens the optical drive on local computer if you have "Allow remote control via HTTP" enabled
http://127.0.0.1:8080/jsonrpc
# This is the Data Line which makes this a POST request and passes the commands
POST:{"jsonrpc": "2.0", "method": "System.EjectOpticalDrive", "params": {}, "id": 1}


# This example will run the Global Search Kodi add-on, and pass two arguments, though in this example the arguments are not valid
addon://script.globalsearch
arg1
arg2


# This example will run a Python script via the OS on *nix systems with two arguments, though in this example the arguments are not valid and we're assuming that Python is in the system path
python:///home/username/test.py
arg1
arg2


# This example will run a Python script via the OS on Windows systems with two arguments, though in this example the arguments are not valid
python://c:\scripts\test.py
arg1
arg2


# This example will open Google Chrome to the CinemaVision.tv website by running a Command or Program
command://google-chrome
http://cinemavision.tv

# This example will run a batch file in Windows
command://C:/Temp/Run.bat

# This example will import a Python script as a module and run it's main method with two arguments, though in this example the arguments are not valid
module:///path/to/a/module.py
arg1
arg2

# This is an example of module.py to be used with this method:
#
# import xbmc
#
# def main(*args):
#     xbmc.log(args[0], xbmc.LOGNOTICE) #would print 'arg1' to kodi.log
#     xbmc.log(xbmc.getCondVisibility('Player.Playing'), xbmc.LOGNOTICE)


User Feedback

There are no reviews to display.

About Us

CinemaVision began in 2014 as a collaboration to create content for use with your home theater, offering movie trivia slides and video bumpers. It has since grown to be THE PREMIER WAY to create and customize your preshow experience. Download the CinemaVision add-on for Kodi today from the official Kodi repository, and easily create a sequence of trivia, videos, trailers, home automation triggers and more that will bring the experience of a movie theater straight to your screen!

×

Important Information

By using this site, you agree to our Guidelines and Terms of Use.