Basic Logic Help


#1

1) Give a description of the problem
Basic pistons not working. I’ve checked a lot of tutorials and forums, but not finding the answer. I’m sure I’m missing something obvious, but none of my pistons are firing and all have the “this piston is not subscribed to any events…” message.

2) What is the expected behaviour?
Anything! Right now I’m just trying to create basic on/off or dimming pistons.

3) What is happening/not happening?
None are firing.

4) Post a Green Snapshot of the pistonimage
image

5) Attach logs after turning logging level to Full
9/7/2019, 9:36:38 AM +277ms +0ms ╔Starting piston... (v0.3.10f.20190822) +117ms ║╔Subscribing to devices... +178ms ║║Subscribing to Den Lamp 2... +180ms ║╚Finished subscribing (71ms) +213ms ╚Piston successfully started (213ms)


#2

Try

IF
   Time happens daily at 9:38 am
      THEN
          Do stuff
END IF

#3

Or the timer block

Every day at 9:38am
Then
With den lamp 2
Do
Turn on


#4

The reason behind your issue is that system variables (such as $time24) do not make good triggers.
(they work great as conditions though)


Pro Tip:

  • @Pantheon’s tip will process the entire piston, even outside the IF block
  • @jkp’s tip will only process that single IF block at that time

Both are useful, depending on the structure of your piston


#5

So, based on your recommendation, I created a new test piston as below which works. What was wrong with the logic from the first example?

image


#6

The reason behind your issue is that system variables (such as $time24) do not make good triggers .
(they work great as conditions though)


#7

Ok, making more sense now although I’m a little confused about the whole ‘trigger’ thing. Most of the tutorials have you click on ‘add statement’ and then add an IF condition as the first step before moving on to the DO something part. That is what I was doing with the IF time is a certain time condition at the beginning.


#8

Each device will have different options, but when creating the IF, notice how conditions are listed first, and triggers are lower in the list.

  • Conditions are vague, and can be true for many hours
  • Triggers are precise, and are only true for a brief moment

Also keep in mind if you do not use any triggers in a piston, then all conditions become triggers.
(unless it is based on a $system variable)

Ideally, a precise trigger will begin execution, and optional conditions beneath can direct what happens next


#9

That helps. I’ll take this and try to create all the pistons I need.

Thanks everyone!


#10

See the lightening bolt at line 13? That means that the code is a trigger. In the beginning, I also had difficulty understanding triggers and conditions. It becomes much easier as you continue to write code.


#11

Sure you want date and time? If yes, it will only run once.

If you choose time instead then it will run daily.


#12

Starting to make more sense. Thanks guys!