View Full Version : Conditionals Device Manager

December 23rd, 2015, 09:40 AM
please, I need to use conditionals like test status of device, state of power status on devices On/Off, states of input selections, devices on serial interface, etc. Can you explain me, how it works? At documentation I cannot understant it.
- Device status selections
- Devicve control values
- how it works at action tree

December 23rd, 2015, 10:43 AM
Conditionals are attached as a child to the node you are trying to conditionally execute. You still need an event to trigger the node as well.

* ACTION (for example Scripting print("Hello") )

Now whenever the key 'A' is pressed and the device is in error status the script will trigger. Does that help?

December 23rd, 2015, 11:42 AM
Partly yes, thank you. Can you add answer, how to with simple transport plugin (or other way) to check, if trhe device is on or other input is on eg. HDMI1 and then make conditionals?
Thank you

December 23rd, 2015, 11:52 AM
Sure, what is the protocol spoken by the hardware? Or what is the device?

December 23rd, 2015, 12:05 PM
It is AVR Harman KardonorLG TV and I use simple transport plugin to communicate with. I can send you device . if it will help.tcf

December 23rd, 2015, 12:21 PM
Sure let's have a look at the TCF. Probably we can do something with a scripting conditional.

December 23rd, 2015, 02:23 PM
OK, at attachments

December 23rd, 2015, 02:51 PM
Ah excellent, looks like you know what you are doing!

inside the data parser I would store the state of your TV or HK in some global variable table. Something like this:

-- create the global table if it doesn't exist.
if not HK_STATE then

if data1 == "AVRACK020300FB" then
HK_STATE.mute = false

if data1 == "AVRACK020301FA" then
HK_STATE.mute = true

Make sure you poll the mute state before you are going to need the conditional.

Next add a scripting conditional to the node you wish to only run when the HK is not muted. Enter this code:

if not HK_STATE then
return false -- don't run since we don't know the state yet.

if HK_STATE.mute then
return true -- yes allow an event to trigger the parent node!

return false -- don't run thank you.

An alternative approach would be to enable/disable nodes using the Mute On/Mute Off events attached to Girder Enable Node / Girder Disable Node. This would be a bit faster since it won't require a lua script to run every time the conditional is tested ( since there is no conditional ).

December 23rd, 2015, 04:23 PM
Yes, perfect, thanks!
Ones trouble by my LGTV, if is off, dont support serial port, then I have no parser data and the variable remain On. Is possible to set variable to off without received data from device? Something like no response from device, then set variable to off.
But the simple transport LGTV channel is always on and green.

December 23rd, 2015, 04:37 PM
What I would do is create a macro that set the 'On' variable to false as the first action. The second action would be to check the status of the TV and set the On variable to "true" if something comes in. Does that make sense?

December 25th, 2015, 12:52 PM
I resolve it:
- on power off I set the variable to false state
- I made heartbeat on power status and write timestamp on each received power status
- periodically I check, if the timestamp is not older than 60sec. If yes, I set power status to false
thank you

What difference is between Event and Macro event?

December 25th, 2015, 06:05 PM

Macro Event requires that all events inside the macro event are triggered before it triggers it's parent. ( so you can require sequence of events to happen before an action triggers ).

January 3rd, 2016, 08:06 AM
Can you describe me difference between script action at lef panel:
- Actions - here is true and false node return conditions - this I use to resolve conditionals
- Conditionals - here is no selections for true and false node. This I do not know, how it works

January 4th, 2016, 09:00 AM
Conditional nodes only control if their parent is allowed to run or not. They do not branch between two nodes.