Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
CQC Web Server - SendUserEvent Macro
#1
This is a macro that you can use with the CQC Web Server to generate user events. These can then be picked up in triggered events to do whatever you want. This is an alternative to the HTTP Trigger drivers.

The benefits are:
  • More deterministic URL, no learning
  • Enhanced security - Can use SSL and authentication to control access

Unsecure Access
Macro Location: <CQCDIR>/CQCData/HTMLRoot
http://cqcserver/cmlbin/user/SendUserEvent?type=<type>&value=<value>

Secure Access
Macro Location: <CQCDIR>/CQCData/HTMLRoot/Secure
http://<username>:<webpassword>@cqcserver/cmlbin/user/secure/SendUserEvent?type=<type>&value=<value>

Triggered Event Example
Filter: Is User Action From Device: WebServer
Code:
// ---------------------------------------------
// CQC Webserver Event Routing
// ---------------------------------------------
Devices::FieldWrite(Security.SayWord, 165, True)
TrigEvent::GetUserActionVals(LVar:Type, LVar:Data)
System::GetNthToken(%(LVar:Data), ,, 1, LVar:Name)
System::GetNthToken(%(LVar:Data), ,, 2, LVar:Value)
System::LogMsg(WebServer Action, 0, Type: %(LVar:Type) Data: %(LVar:Data), Status)
// ---------------------------------------------
// Garage Door
// ---------------------------------------------
If System::Equals(%(LVar:Type), Garage, No Case)
   System::DoGlobalAct(\\User\\GarageDoor, "%(LVar:Value)")
End
// ---------------------------------------------
// Lights
// ---------------------------------------------
If System::Equals(%(LVar:Type), Lights, No Case)
   System::DoGlobalAct(\\User\\Lights, "%(LVar:Name)","%(LVar:Value)")
End

Code:
[b] Turn On KitchenLights [/b]
[url]http://cqcserver/cmlbin/user/secure/SendUserEvent?type=Lights&value=KitchenLights,True[/url]

[b] Open Garage Door [/b]
[url]http://cqcserver/cmlbin/user/secure/SendUserEvent?type=Garage&value=Blah,True[/url]


Attached Files
.cqcmacropack   Secure_SendUserEvent.CQCMacroPack (Size: 1.18 KB / Downloads: 1)
.cqcmacropack   UnSecure_SendUserEvent.CQCMacroPack (Size: 1.16 KB / Downloads: 1)
Wuench
My Home Theater/Automation Website

[THREAD=5957]BlueGlass CQC Config[/THREAD]
[THREAD=10624]Wuench's CQC Drivers[/THREAD]
Reply


Possibly Related Threads...
Thread Author Replies Views Last Post
  How To - Run CQC on VMWare Server wuench 10 15,427 12-07-2012, 05:43 AM
Last Post: wuench
  How to make event from web server on CQC? 0 127 Less than 1 minute ago
Last Post:

Forum Jump:


Users browsing this thread: 1 Guest(s)