What is a piston state and how is it used?


#1

1) Give a description of the problem
I’ve seen some pistons that set the piston state to something custom like the current value of the variable in a switch statement.

what is a piston state?
how can changing a piston state be useful?

I’m not talking about toggling “running” and “paused”

could I set my piston state to “beer?” If i could, what would I do with it besides wish I could drink it? :beer::grin:


#2

Yes — you can set your piston state to :beer: or :beers: — you can even add another :beer: every time you drink another :wink:

The piston state is displayed on the dashboard (typically true or false unless you use custom piston states). This allows you to use the dashboard to get information at a quick glance:

You will need to disable automatic piston state for that to work…


#3

Thank you.

So where do those icons come from? You’ve got two in your temp piston, a chicken, el sol, a car with a check and a battery. Is there a list of supported icons somewhere?


#4

Those are simply emojis which are Unicode characters. You can enter them directly into the text fields.


#5

Thank you.

:astonished: how simple the solution was!


#6

Forgive my ignorance but how do i actually call that?

i’ve got a string variable but how do I use the unicode to convert to the emoji? I was able to do :fa-bath: in the sting variable and that worked but when i put the unicode for :beers: (colon beers colon) which i believe is “U+1F37B” from (https://apps.timwhitlock.info/emoji/tables/unicode) it only comes out as the actual code and not the emoji.

I’m wondering if I’m just not using the correct method to make it work.

UPDATE
I was able to go to that site and there is a column that lets me copy the emoji. I was able to paste that into the variable. I suppose that is the best way to do it. If there is a method of using the unicode chars then I’d be interested in learning it.


#7

I depends on what operating system you use to compose your pistons. Some have a on-screen Emoji keyboard which might allow searching as well.


#8

How do I change piston state? I see that I have to disable automatic piston state but where do I do that?


#9

Under Options, select Show piston settings, then you’d see settings, click it.

image


#10

Additional question since I have now dived head first into piston states.

Can one piston clear or reset the piston state of another? And if so how?


#11

Not directly as far as I know but if you add a logic inside the piston to watch for a trigger from another piston then the target piston should be able to clear its state on command. Trigger can be in the form of a passed argument. This is not tested though :grinning:


#12

You are correct, @eibyer

I just want to add that the called piston will run top to bottom when the argument is passed, so you will have to code accordingly.


#13

@eibyer

Can you give me an example of this?


#14

Rough example…

piston 2 will have a make web request task calling piston 1’s external url with /?command=resetState appended. Once triggered, piston 1 will clear its piston state.