myServer Advanced User Functionality

Welcome to the myServer Advanced User documentation

myServer represents Allonis's media management and home automation software components. myServer supports two way external integration that can be leveraged by advanced users and software developers.

Some of the documentation below has been gathered from user Forum contributions.

 

Scripting

Advanced users use Scripting to have a virtually unlimited means to expand myServer functionality.

Setting up Zones

To make it easy for users to select which zone they would like to experience their media: Zone Control

Naming the webclient:

To use functions specific to a given webclient, best is to name the client.  To do so, in the myUI.Phones (or Tablets) sample webpages, go to the Home page, click on the Menu, click on "Allonis".  You can set the clientname there.

Adding comments in Macros:

Put
?|
at the start of the line. Everything after that will be ignored until the next
!
delimeter

Shut off myServer Autostart on Windows launch:

Because myServer require elevated rights to run they cannot be started by placing a shortcut to the exe in the PCs startup folder. Instead, they get started as a Scheduled Task that runs on Windows Login. Go into the Control Panel / Admin Tools / Task Scheduler / Task Scheduler Library. You will see the task defined there that starts myServer on login. Delete that task. If you have already installed myServer you will see a task there for starting it too. Leave that one alone.

Macro

usage is 
sample.macro|p1value~p2value~p3value etc..

Inside the macro
p1value is <P1>
p2value is <P2>
p3valus is <P3>

Execute on myServer startup:

Create a Macro called System.Startup and that will automatically get executed every time the server starts up.

In the System.Startup macro if you need a delay then use the BackgroundMacro| command instead of Macro|. Then it won't tie up the system, waiting for the pause to complete.

BackgroundMacro|Pause|15!Do This!Then Do That....

Example:

Run|Program~<Program.exe>~<optional arguments>

or
Stop|<program name> (example:chrome)

You can also do something like:
Run|taskkill.exe~/F /IM chrome.exe

Playing sounds on the client device:

The sound files have to be in the path relative to the web app's root or a full URL.

For files local to the web app. For example create a folder called myServer\HTML\Ipad\Sounds then use 

WebCmd|{{clientname}}~Playsound|sounds/test.mp3

If the sound files are in the myServer\Sounds folder then you need to use the following full URL and grab the sound via the system web server. 

WebCmd|{{clientname}}~Playsound|http://<<myserver ip addess>>:6246/sounds/test.mp3

Display client screen resolution:

WebCmd|all~ShowDimensions

Shut down a chrome instance:

Run|taskkill.exe~/F /IM chrome.exe

Shut down myServer and Windows:

Use the myServer command Shutdown to gracefully shutdown myServer.

User the myServer command PowerDown to gracefully shutdown myServer and then gracefully shut down Windows and the PC.

Sending a popup message to all connected clients (or just the one addressed):

webcmd|all~toast|info~Hello~World~5000

Sending a request for the client to speak:

webcmd|all~Speak|hello world

Note you can target on client device:  webcmd|myclient1~Speak|hello world

Set the clientname on the device first (see above)

Schedule Tasks:

Create your scheduled tasks using the Task Schedules editor under the Schedules Tasks button on the server menu bar. Or use the Scheduler scenes that are part of the sample web apps. Much easier way to create and maintain the scheduled tasks than the legacy plugin "MLSchedule".

Rebooting Remote Client PCs:

Rebooting is easy using this command. Substitute the number 2 for the appropriate number for your AV driver

AV|2~Run~shutdown~/r /t 1

Ejecting the tray should work as long as your player software supports it. For example for PowerDVD and the command to use is:

AV|1~Eject

 

Background Macros:

Any Macro call can be turned into a Background Macro simply by changing Macro| to BackgroundMacro|.

The only difference is that Background Macros are run in their own thread and will not tie up the main server process while running. Background Macros are useful for long command sequences that have embedded delays in them.

Macros and BackgroundMacros are nothing more than strings of server commands separated with exclamation marks "!" as the delimiter. e.g. Macro|Command1!Command2!Command...

Example:

BackgroundMacro|
If|IsEqual##{{Program1_enable}}##False####BackgroundMacro|Run_Program_1!
If|IsEqual##{{Program2_enable}}##False####BackgroundMacro|Run_Program_2!
.
.
.
If|IsEqual##{{Program24_enable}}##False####BackgroundMacro|Run_Program_24

 

Variable Names

myServer Variable names cannot start with a number or punctuation mark and cannot contain spaces. Also a variable name cannot be longer than 128 chars.  Case is not important because the server converts all variable names to lower case.

Purge Variables

We cannot use {{variable*lastupdated}} and {{variable*lastchanged}} as the asterisk is part of a jQuery selector and is one of the "holy" characters. So instead it is implemented using a pair of dashes like {{variable--lastupdated}} and {{variable--lastchanged}} instead.

PurgeVariables|<<days>> will delete all variables that have not been updated within the last <<days>>

Executing DOS commands on the Server:

Run|<<program name>>~<<optional parameters>> -- Run the program in a normal window

RunHidden|<<program name>>~<<optional parameters>> -- Run the program in a hidden window

Stop|<<program name>> -- stop/kill the program

 

 GetURL and PostURL commands:


To control Sage use the command
 

CODE: SELECT ALL

GetURL|http://sage:This email address is being protected from spambots. You need JavaScript enabled to view it..1.9:8080/sage/SageCommand?context=001d6a4cf75e&command=Pause


You'll probably want to create a system macro called Sage that looks like
 

CODE: SELECT ALL

GetURL|http://sage:This email address is being protected from spambots. You need JavaScript enabled to view it..1.9:8080/sage/SageCommand?context=001d6a4cf75e&command=<P1>


and then use commands like
Sage|Play
Sage|Pause
etc.

 

Logging:

Data logging feature for capturing data items over time.

The myServer command is called Logger and supports the following command set (also in command builder)

a) Logger|Log~ItemClass~ItemName~ItemValue~(Optional)Comment
This command will add a new data log entry into the database. Logged items are classified by an Item Class and an Item Name e.g. Weather, Current Temp.
When an entry is logged the following 8 data items are stored into the Logger table
1) ID - The unique data logger item id (automatically generated)
2) Class - The item class
3) Item - The item Name
4) EventTime - The Date and Time the entry was added
5) Value - The value of the data
6) DecimalValue - If the value logged is numeric the value is converted to a decimal value and stored also it its numeric format
7) Duration - The time in seconds since the last time an event of the same Class and Name was logged
8) Note - The optional comment that can be stored with the data entry

b) Logger|Delete~ItemClass~ItemName~DeleteCmd~KeepAmount
Provides a way to manually delete logged data items.

c) Logger|Browse~ItemClass~ItemName~BrowseCmd~PageSize
Provides a way to browse the stored data items.

d) Logger|SetMax~ItemClass~ItemName~MaxEntries
Allows you to set the maximum number of logged entries for any given Class and Item. The system will automatically default to a maximum of 1024 items per Class/Name if not manually set.

e) Logger|Purge
This command is run automatically by myServer every morning as part of the maintenance activities. It automatically purges all old data entries out of the database while observing the MaxEntries rules.

What's this all good for? Well, a lot of things. For instance I created a simple automation rule that once every minute now logs the current temperature in my Kitchen zone, the current outside temperature and the HVAC state for that zone. I can now keep track of just how hard my HVAC is running.

It looks like
Whenever CurrentMinute Changes Value
Then
Macro|
Logger|Log~Climate~Kitchen Temp~{{climate_1_temprnd}}!
Logger|Log~Weather~Outdoor Temp~{{weather_current_tempf}}!
Logger|Log~Climate~Kitchen State~{{climate_1_hvacstate}}

Here's what is getting logged
 

CODE: SELECT ALL

ID     Class       EventTime                 Item              Value  DecimalValue  Duration
3      Climate     2013-08-03 15:13:00.563   Kitchen State     Cool   0             0   
6      Climate     2013-08-03 15:14:00.277   Kitchen State     Cool   0             59   
9      Climate     2013-08-03 15:15:00.080   Kitchen State     Cool   0             59   
1      Climate     2013-08-03 15:13:00.457   Kitchen Temp      78     78            0   
4      Climate     2013-08-03 15:14:00.273   Kitchen Temp      78     78            59   
7      Climate     2013-08-03 15:15:00.077   Kitchen Temp      78     78            59   
2      Weather     2013-08-03 15:13:00.560   Outdoor Temp      95     95            0   
5      Weather     2013-08-03 15:14:00.277   Outdoor Temp      95     95            59   
8      Weather     2013-08-03 15:15:00.080   Outdoor Temp      95     95            59   



The possibilities are wide open.

Right now you are only able to browse the events but there are some very cool new things in development that will let you look at this data in all sorts of ways. You can also access this data via the web server but that's a more advanced topic I'll save for later.

 

myServer Math command:

Math|Divide~Output Variable Name~First Number~Second Number
or
Math|Divide~result~{{blml2hs_blmhs zonnepaneel_value}}~10

The server variable {{result}} will contain the computed value. Change {{result}} to any variable name that makes sense.