View Full Version : Triggering event payloads from DM webservice?

December 18th, 2011, 02:00 PM

I'm using the DM webservice and would like to trigger an event when a specifc button is pushed. But in the log viewer when I click on a button all I see is /ajax/setvalue.lhtml which when set as an event will trigger on any button push in the DM. When I right click on the item in the log viewer I can see more info that would make the button push unique:
Time Date Source Details Payloads
11:46:07:671 12/18/2011 WebServer /ajax/setvalue.lhtml Control=htpc\SharpTV\TV\Power Value=On

Is there a way to trigger based on the event payload as opposed to just the Details?

Just in case someone has another suggestion on solving my problem, here it is:
I have a Sharp TV with RS232 and I'm using the SharpTV component in Girder. Most of the TV functions can be controlled when the TV is on, including the ability to turn it off, but once it's off it can not be turned on via serial command. The Girder SharpTV component DM has an on/off switch, so I want to trigger a USBUIRT Action to turn on the TV only when the DM TV On button is selected.


December 18th, 2011, 02:16 PM
I am no expert but you might be able to use that event to trigger a script which then would look at the payload to see if its the button you want. Try a simple script with

print (pld1)
print (pld2)
print (pld3)
print (pld4)

Then hit a button and check the Interactive LUA Console and see if the payloads show any details as to which button is hit. You can then use this with an if-then to trigger your own event using the gir.TriggerEvent command which would be used as the event for the script you really want to execute.

December 18th, 2011, 05:24 PM
Most SharpTV's can be turned on via RS232 (or IP if it is newer). You just have to set it to accept the on command while off (a menu pick and/or a RS232/IP command).

Ultimately, are you wanting to use the default DM webpage or make your own webpage?

December 18th, 2011, 05:51 PM
@John, Thanks! I was over thinking it. The following script works great!
print("PLD1 = ", pld1)
print("PLD2 = ", pld2)
if pld1 == "Control=htpc\\SharpTV\\TV\\Power" and pld2 == "Value=On" then
print("Turning on TV")

@shaun5, well, my TV is lame (if big.) It's a LC65D93U. The command table in the manual only specifies an off option in the power setting command, and I've tried sending a bunch of tests to get it to turn on to no avail. I think the problem is when the TV is off, it's really off with no power to the serial controller. I'd love to be wrong, but I think it's just a poor design. Today I'm using the DM webpage. Been toying with creating something from scratch but always seem to have other projects to tackle.