Making decisions on react variables
I am just now starting to absorb some of this. I have coded up a basic room with a watch and a couple source events.
My control variable is BedRoom-Activity.
I see my watch and whatever source event firing when variable gets set. For example, Watch-DTV
Now, in my watch event, I want to make decisions on source as well, for example to set an input on a TV.
Is there only way to get the current value of the react variable and store in a urc variable?
Then standard if/else on the value of the urc variable.
Doug, you should be storing all values of the React Variables into associated URC variables. You will still find occasions where the best option is to still do some filtering.
Explain exactly what you want to happen and I'll show how I would handle it.last edited by
In this case, I what to localize actions needed to watch TV in this room.
1 - turn TV on/or verify it is on
2 - delay until it is ready for input change
3 - change input based on source being watch.
I have localized the source actions in their corresponding event
The react variable has all the required information. To make decisions on the react variable, I am currently storing the variable in a URC variable just so I can do a if/else decisions on it.
if source:bedroom includes DTV
set input 1
if source:bedroom includes atv
set input 2
I am wondering if I can avoid having to store by react variable (bedroom-activity) to source:bedroom and achieve the same thing.
You are going to want to store the value always into the URC variable as a best practice, this may actually be required.
I understand that you don't want to use it though. You have a couple options here. You can just put input commands in with the sources. That way they don't need to be filtered. You could then send the input immediately and then again after a delay that would be needed in order for the TV to come on. An alternative would be tracking if the TV is ON or OFF with a URC var and then sending a refresh after the necessary delay in your TV Power On event. I am doing something like this with my Emotiva AVR. But it was pretty late when I finished it and now that I look at it, I could probably improve it. Let me do some testing and Ill report what I find.last edited by Spin
ok, thanks. I want to localize the delay. Also, I want the concurrent processing of the source actions and tv. I don't want to hold/delay the source actions because TV setup is slow
@Doug-Reiland do me a favor and read through the DRP Documentation and make sure you are following that protocol - it will be a big deal for React Organization so you don't start to see "Ghost Bugs" that are hard to troubleshoot.
Essentially you should have your room Activity be Bedroom not Bedroom-Activity. Other variables might use something like Bedroom-Lights - that will be valid but the activity will always be just the name of the room.
Value should always follow DRP as well "isWATCH-DirecTV" or "isWATCH-SatBox"
As for simultaneous triggering while keeping the delay, I don't recommend localizing the variable into the isWATCH and reading the value to see if DirecTV is included, for example. While this would work, it kind of takes away from the concept we are doing. Instead I would create Device Events for "If the variable includes DirecTV" - if you want, you can create two identical events that look to see if the variable includes DirecTV - this will create two macro streams and you can have one with the delay and one without - however I might be misunderstanding what you want to do.last edited by
Braden R. Napier
I have read it and I am playing. You guys have a lot more experience than I do so thanks for feedback. I hate redundant code and like to localize stuff. 1 place to change delays, 1 place if inputs need to shift, ..
Plus, I thought I nailed it moving the delay from keeping the source setup from proceeding.
Anyway, I still messing with it. I moved to small config and coding fake rooms/devices so downloads are fast and it makes trying stuff less of a burden
Doug here is an example of what I am doing. This may help you.last edited by