Noobie with a ton of questions


#1

Hi All,

New to (the absolutely amazing) WebCoRE and I have some question for which I can’t find an answer. I saved them up so as not to be a complete PITA. General ones first:

Can you add comments to a piston? I see a comment block is added automatically to the top of a newly created piston but I’m not sure if/how to add them later in the code for clarity.

Can I rename a Piston? I tried to use the Duplicate feature. It worked for a smaller piston but I only get a new, empty piston when I try to duplicate a longer piston.

I see a toggle in the IDE for allowing drag and drop but can’t figure out how to do it. Ideally, I’d like to drag and drop an individual line or a block of code. Is that possible?

Can you insert a new line of code into an existing block?

When I try to import a piston, I’m told there is no way to do that yet. Can you copy and paste from other pistons? I’d love to examine what others have done so I can learn how to create complex pistons.

Is there any way to trigger a piston using Alexa?

Now for more specific questions:

I have a piston that gets triggered when either of two contact sensors changes from a closed state and the Mode is Night. A ton of stuff then happens. I would like to determine which of the two contact sensors was opened and include it in the SMS message that gets sent. I thought I’d just query that status of both sensors, determine which one was open or very recently opened, and use a variable in the SMS. Unfortunately, I have no idea how to query a device and get its current or very recent status. Help, please.

My penultimate :grin: question is about latency. The aforementioned piston that reacts when one of two sensors changes from a closed state turns on 19 lights, flashes some between red and white, flashes some on and off, sets some to various levels, and pretty much blows up the house (not literally, I hope). The piston is long and it seems that it’s taking a long time for some events to occur. Thinking that synchronous blocks wait to finish before the code moves on, I changed each block to async. Will that help or am I misunderstanding how that works? Are there any best practices for maintaining performance?

Lastly, is there documentation that would answer my questions? If so, I apologize for adding static to the community and, in the future, will consult the documentation before posting a ton of questions.


#2

I’ve got time to help with a few of the questions.

You can add comments to blocks of code. To add a comment to an IF block click on the IF and then click the Cog and then you’ll see a place to add comments.

You can rename a piston by opening the piston and clicking into the name. This will allow you to change the name.

To drag and drop you need to be in the desktop version. Select the number next to the starting of the block you want to move. Click on the first up/down arrow and drag the block of code to where you want to place it. Takes a little practice and you need to make sure drag and drop is turned on in the piston.

You can add new code to a block at the end and then drag & drop to where you want it.

Hope this helps.


#3

use $currentEventDevice

separate each group of actions and put them in cascading async with blocks. that will help a bit.

yeah. ask questions here like you did. :slight_smile:


#4

Use the Orange restore button when trying to import someone else’s piston. The import will be used to import your own saved pistons back into webcore

On some levels yes you can.for example with actions you can insert into the beginning middle or end of your other actions.
Opposite example would be statements. Those go where the add a statement links are. But they can be moved with drag and drop

Directly, no. Using virtual switches, yes. In short setup a virtual switch then have Alexa turn it on or off. Your piston watches the switch and then does the actions.

There is limited documentation on the Wiki but i am severely behind in keeping it updated.