Linking Virtual Dimmer level/on/off status to Audio System's Set Level volume control


#1

1) Give a description of the problem
I’m using redloro’s Russound integration with SmartThings, and working to build a control panel for my Russound CAM6.6 audio system in ActionTiles.
When the zone is off, ActionTiles switch tile loses the ability to set the level. Turning the zone on does not enable the level function for the tile without some other input outside of ActionTiles changing the level of the zone so that it can recognize it.

2) What is the expected behavior?
Set level of virtual dimmer = set level of Zone to match.
Turn virtual dimmer off = turn Zone off.
Turn virtual dimmer on = set Zone on and to level of virtual dimmer.

3) What is happening/not happening?
Zone turns on and off, no volume control.

4) Post a Green Snapshot of the pistonimage

5) Attach any logs (From ST IDE and by turning logging level to Full)
ST logs show no errors with regard to the Piston.
Logs on WebCoRE’s side show:
|+7ms|╔Received event [Living Room Volume Control].level = 38 with a delay of 91ms|
|—|---|
|+171ms|║RunTime Analysis CS > 36ms > PS > 80ms > PE > 50ms > CE|
|+187ms|║Runtime (36300 bytes) successfully initialized in 80ms (v0.2.0c3.20170618) (180ms)|
|+192ms|║╔Execution stage started|
|+206ms|║║Cancelling condition #47’s schedules…|
|+207ms|║║Condition #47 evaluated false (9ms)|
|+208ms|║║Condition group #46 evaluated true (state did not change) (0ms)|
|+209ms|║║Condition group #3 evaluated true (state did not change) (12ms)|
|+220ms|║║Comparison 38 changes = true (5ms)|
|+221ms|║║Cancelling condition #52’s schedules…|
|+222ms|║║Condition #52 evaluated true (11ms)|
|+223ms|║║Cancelling condition #48’s schedules…|
|+223ms|║║Condition group #48 evaluated true (state changed) (12ms)|
|+225ms|║║Cancelling statement #49’s schedules…|
|+249ms|║║Executed virtual command setVariable (14ms)|
|+253ms|║║Executed virtual command setVariable (1ms)|
|+256ms|║║Cancelling statement #51’s schedules…|
|+266ms|║║Skipped execution of physical command [Bathroom Speakers].on([]) because it would make no change to the device. (3ms)|
|+267ms|║║Executed [Bathroom Speakers].on (3ms)|
|+274ms|║║Invalid ternary operator. Ternary operator’s syntax is ( condition ? trueValue : falseValue ). Please check your syntax and try again.|
|+275ms|║║Calculating (integer) 1 ? (integer) 38 >> (integer)|
|+316ms|║║Executed physical command [Bathroom Speakers].setLevel([0]) (37ms)|
|+317ms|║║Executed [Bathroom Speakers].setLevel (38ms)|
|+321ms|║║Condition group #15 evaluated true (state did not change) (2ms)|
|+324ms|║╚Execution stage complete. (136ms)|
|+336ms|╚Event processed successfully (336ms)|


Need help copying "level" in a piston
#2

In the pic above, try changing line 45 to:

Set level to {intSwitchLevel}%


To test this, try adjusting Dimmer 6’s levels to populate that variable.
(it is currently blank)

Upon closer inspection, there is something wonky about the variable intSwitchLevel up top.
Please also edit line 19 and make sure it looks like this:

temp


#3

And one more…

I am not sure what you are doing with blnSwitchLevelManual, but keep in mind if you force in false on line 22, it will be false each time the piston runs.

If you do not want this, then edit line 22 to also say:
temp


#4

Thank you. The first change you suggested worked perfectly, and I now have volume control of the zone.
The second change you mentioned is already suggested.
image

I can turn the zone on due to a level change, but I can’t shut it off. I suspect this is a DTH issue in SmartThings not sending an actual “Off” command, and instead sending a set-level.


#5

You can test the Device Handler by making a new piston, with only one command.

Such as:

With
    Music Player 1
Do
    Turn off
End with

If that command works by itself, I think I know a workaround for you


#6

Ok. Interesting. I made the change you suggested with line 22 and lost the ability to volume control.
I changed it back to false, and still can not volume control though I can now power the zone on/off.

If it helps at all, I copied this from a “Dim all lights by master dimmer” piston that someone else wrote, and have been working to streamline and modify for my use.

First section is a “Turn Off” command from within the ST App for the virtual dimmer device.
The zone powered off.
8/18/2018, 10:08:07 PM +762ms
+1ms ╔Received event [Living Room Volume Control].switch = off with a delay of 73ms
+178ms ║RunTime Analysis CS > 18ms > PS > 83ms > PE > 77ms > CE
+191ms ║Runtime (35474 bytes) successfully initialized in 83ms (v0.2.0c3.20170618) (189ms)
+192ms ║╔Execution stage started
+203ms ║║Comparison off changes_to on = false (1ms)
+205ms ║║Cancelling condition #47’s schedules…
+205ms ║║Condition #47 evaluated false (7ms)
+206ms ║║Cancelling condition #3’s schedules…
+207ms ║║Condition group #3 evaluated false (state changed) (10ms)
+213ms ║║Comparison off changes_to off = true (0ms)
+215ms ║║Condition #60 evaluated true (6ms)
+215ms ║║Condition group #59 evaluated true (state did not change) (8ms)
+217ms ║║Cancelling statement #18’s schedules…
+255ms ║║Executed physical command [RNET: Patio].off() (32ms)
+256ms ║║Executed [RNET: Patio].off (34ms)
+259ms ║╚Execution stage complete. (68ms)
+270ms ╚Event processed successfully (270ms)

Clear

Full

The second section is a “Turn On” command with the same info as above. The zone powered on.
8/18/2018, 10:08:14 PM +207ms
+1ms ╔Received event [Living Room Volume Control].switch = on with a delay of 90ms
+182ms ║RunTime Analysis CS > 19ms > PS > 80ms > PE > 84ms > CE
+194ms ║Runtime (35478 bytes) successfully initialized in 80ms (v0.2.0c3.20170618) (192ms)
+195ms ║╔Execution stage started
+208ms ║║Comparison on changes_to on = true (1ms)
+212ms ║║Cancelling condition #47’s schedules…
+213ms ║║Condition #47 evaluated true (12ms)
+213ms ║║Cancelling condition #3’s schedules…
+214ms ║║Condition group #3 evaluated true (state changed) (14ms)
+224ms ║║Condition #52 evaluated false (8ms)
+225ms ║║Condition group #48 evaluated false (state did not change) (9ms)
+227ms ║║Cancelling statement #51’s schedules…
+269ms ║║Executed physical command [RNET: Patio].on() (36ms)
+270ms ║║Executed [RNET: Patio].on (38ms)
+301ms ║║Executed physical command [RNET: Patio].setLevel([85]) (28ms)
+301ms ║║Executed [RNET: Patio].setLevel (29ms)
+304ms ║╚Execution stage complete. (110ms)
+314ms ╚Event processed successfully (314ms)

The third section is a volume adjustment that did not work. 65% to 91%.
8/18/2018, 10:08:18 PM +444ms
+2ms ╔Received event [Living Room Volume Control].level = 91 with a delay of 75ms
+180ms ║RunTime Analysis CS > 19ms > PS > 85ms > PE > 76ms > CE
+191ms ║Runtime (35472 bytes) successfully initialized in 85ms (v0.2.0c3.20170618) (189ms)
+192ms ║╔Execution stage started
+207ms ║║Cancelling condition #47’s schedules…
+207ms ║║Condition #47 evaluated false (9ms)
+208ms ║║Cancelling condition #3’s schedules…
+209ms ║║Condition group #3 evaluated false (state changed) (11ms)
+217ms ║║Cancelling condition #60’s schedules…
+218ms ║║Condition #60 evaluated false (8ms)
+219ms ║║Cancelling condition #59’s schedules…
+219ms ║║Condition group #59 evaluated false (state changed) (10ms)
+222ms ║╚Execution stage complete. (30ms)
+231ms ╚Event processed successfully (231ms)


#7

I think I see why I lost volume control. Cleaning out some of the extraneous things left me with the level change section just under the switch changes to on section instead of standalone in its own right.
Because the zone is on already and does not receive an “On” command, it won’t process past #47. Right?


#8

I wondered what blnSwitchLevelManual was doing. It was only referenced once up top, and once in the code.

I would delete both lines that mention blnSwitchLevelManual and be done with it…


As far as why the piston stopped working? You must have accidentally deleted an extra line.
Check the highlighted section that needs to be in there if you want it to run on level changes:

temp


#9

Alternatively, you could separate all 3 triggers like this:

If Master switch changes to on
then do blah blah blah
end if

If Master switch's level changes
then do blah blah blah
end if

If Master switch changes to off
then do blah blah blah
end if

This is usually the path I take. I only nest IF statements when I have no other choice


#10

That’s super informative… I’m just starting out with webCoRE and felt like I needed to make things look pretty like everyone else. lol


#11

BAM! You are both a scholar AND a gentleman(woman)!

I am unable to remove the second blnSwitchLevelManual from line 34 withoutr removing line 35, and it does not seem to be harming anything at this time.


#12

Yes, it should be harmless, but if you really want the code to be “pretty”, you should be able to click on blnSwitchLevelManual to edit that one line, and then click on the Delete button. That should only affect the current line.

EDIT :
Same goes for that line in the device section up top. (line 21 in your last pic)


#13

I tried that. :frowning: It removes both. I can remove both and recreate the second without too much hassle.

Thank you so much for your advice tonight. I have six zones to set up. I can now clone this across to those zones and dimmers and get my control panels configured properly.


#14

Glad to help. If I may make one last suggestion.

Wait 24 hours before cloning it. I can’t tell you HOW many times I tweaked a piston, and then had to re-tweak all the clones afterwards.


#15

That is really solid advice! I’ll hold on that anyway, it’s 10:30 PM local, and I need to go crash out… Late night changes = bad things, usually.


#16

YES! Words of the wise!!

Have a great night