Button behavior and unexpected logs

lights
variables
buttons
piston

#1

1) Give a description of the problem
I have a piston set up to manage my home theater lights. The piston is supposed to turn off certain lights and dim others when a button is pressed (entering movieMode ). When the button is pressed again, it should revert the lights to their original state (exiting movieMode ). However, the piston is not maintaining the movieMode state between button presses and instead, it seems to reverse the actions immediately after setting them.

2) What is the expected behavior?
Upon a single press of the button, the piston should:

  • Turn off specific lights (e.g., A, B, C).
  • Dim one light to 25% (e.g., Y).
  • Set a movieMode variable to true . When the button is pressed again, the piston should:
  • Turn the specific lights back on.
  • Restore light Y to its original brightness.
  • Set the movieMode variable to false .

3) What is happening/not happening?
The issue is that the lights do not stay in the ‘movieMode’ configuration. Instead, they immediately revert to their original state after the piston actions are executed, as if the commands to enter movieMode are being immediately followed by the commands to exit movieMode .

Equally strange is that while the piston does take action (turns the lights off and then back on again) the piston doesn’t show any logs recognizing the button press.

4) Post a Green Snapshot of the piston !

5) Attach logs after turning logging level to Full

11/20/2023, 10:07:52 AM +457ms
+8ms	╔Starting piston... (v0.3.114.20230828_HE)
+21ms	║╔Subscribing to devices...
+218ms	║║Device missing from piston. Loading all from parent (195ms)
+220ms	║║Attempting Attribute pushed value [1] subscription for device: Basement Button
+238ms	║║Attempting Attribute doubleTapped value [1] subscription for device: Basement Button
+241ms	║║Subscribing to Basement Button.pushed.1...
+262ms	║║subscribe override: always @movieMode
+263ms	║║Subscribing to Westerfield.:4ec393bf4a47293be18551df1035ea85:.@movieMode...
+273ms	║║Subscribing to Basement Button.doubleTapped.1...
+281ms	║║Piston utilizes Basement Kitchen Downlights []...
+282ms	║║Piston utilizes Basement Office Desk Signe Light []...
+282ms	║║Piston utilizes Basement Office Downlights []...
+283ms	║║Piston utilizes Basement Office Lamp []...
+284ms	║║Piston utilizes Family Room Downlight 1 []...
+285ms	║║Piston utilizes Family Room Downlight 2 []...
+286ms	║║Piston utilizes Family Room Downlight 3 []...
+286ms	║║Piston utilizes Family Room Downlight 4 []...
+287ms	║║Piston utilizes Family Room Downlight 5 []...
+288ms	║║Piston utilizes Background Light []...
+289ms	║║Piston utilizes Fish Tank Lights []...
+316ms	║╚Finished subscribing (306ms)
+322ms	║Subscribing to Westerfield.pistonID...(:521f8aa9793e240f4eaae1b7849a778f:)
+329ms	║Subscribing to Westerfield.oldpistonID...(:a3e9d684b343479eb2e8153dd3efa937:)
+336ms	║Comparison gets = false (event device/attr eXcluded)
+340ms	║Comparison (dynamic) false is (boolean) false = true (2ms)
+349ms	║Comparison gets = false (event device/attr eXcluded)
+370ms	╚Piston started (361ms)

#2

If I’ve understood correctly, I think your if’s have got a bit confused.
lines 55-73 need to be an else condition to the first if (line 24)
Not sure what the empty if on line 52 is doing.


#3

Not sure why you have “always subscribe” to your nested (second) “IF” - that makes it a trigger. The little blue “plus” sign means that “IF” statement is a trigger. See the orange lightning bolt at the far left of your second, nested IF? That means it is a trigger. Your second “IF” is a nested trigger and may cause execution problems.


#4

I’d wondered about the trigger on the second if too. It’s not required and not sure what WC would do with it.
Also, the log only shows the piston being saved/started. It does not show any execution activity.