[DEPRECATED Thread: visit community.webcore.co for assistance] webCoRE - Piston Design Help (ask your fellow members for assistance)

ChandelierLevel should be an integer, not a device - he probably set it to that device’s level, but then changed the type - since the variable is of device type, it can hold a device, not an attribute value.

Now, that’s a total mess.

I’d define the variables as integer/whatever matches the attributes, set them to that attribute in the define section - no need to use them in those Set variable… anymore, as they’ll be set automatically during init. Then instead of setting stuff to {ChandelierLevel}'s level, they should be set to {Chandelier}

Alternatively, let them be devices, delete the Set variable… (except the one with true in it) and use it as is, even though there are multiple variables referencing the same device.

UPDATE: Fixed it for you:

yeah, i solved it this way at that time. but i am working on a better routine for save and restore device attributes just for my own use. so, thanks for all of your feedback here, i have a better sense of how to do the save and restores now.

I will add the capture/restore to webCoRE - the capture is easy, the restore is difficult - there needs to be a way back to restoring a value - that usually uses commands, so I need a way to know when restoring level to use setLevel, when restoring switch to use either on() or off(), etc. CoRE did that, webCoRE is yet to learn that magic trick.

I cannot use events to set attributes, as that may go around logic built into the DTH or simply not do anything at all (i.e. an on() command in the DTH may send the physical command to the bulb and simulate an switch=on event - if I were to simply send a switch=on event, I’d mark the bulb as on, but there would never be a physical command sent to the bulb so that it actually turns on). It’s harder than it looks :smiley:

1 Like

Works like a charm, thank you!

1 Like

You’re welcome. I had to build that escaping feature at some point… LOL

thank you. tagging @lflorack so he sees your fixes as well.

leaving them as device didn’t work for me. if you change the device attributes then reference them later via the variable device then you don’t have access to the original values any more. example:

define device devicex

set variable devicex = device light 1
change the level of device light 1 to new level
set level for device light 1 to [devicex : level]

that last statement just sets it to the new level, it does not have a way to reference the old value of level for device light 1. so, that’s why it did not work for me.


@eibyer Works fine now!

For the life of me I can’t figure out how to add comments to different sections on a piston. What am I missing?

@ady624 sweet. that’s awesome … will save a whole bunch routines just trying to save and restore device states and i will stop writing up a kind of generic routine that i was writing up for myself.

i am sure its harder than it looks … otherwise you would have had it working already. :smile: much appreciate your adding it to the feature queue.

Thanks again!

Nice! I will try it on the piston I was playing with when I get home.

If you click on the ‘cog’ you can enter a description. This is available on most actions/ifs etc.

1 Like

Click on the cog icon and you should be able to add your comment

1 Like

… how did I miss that :grin: Thanks!

1 Like

I guess comments should not be “advanced” options, the thought behind it was to not overload the UI with comments, especially on the mobile version which would then draw the buttons out of sight (there are only a bunch of us here have OCD LOL)

1 Like

How about a check box that displays the comment box only when checked, save a trip to the cog :grinning:

You can check the code for changes from the IDE

thanks @c1arkbar. @ady624 cleared up most of those questions with his subsequents comments. i still don’t know why I didn’t notice this in the UI before, but i will chalk this one up to my own oversight.

actually just figured that one out also. if you change the variable type definition between int and device, the options that show up in the UI for set variable operations is different and that’s what had to have happened with that piston.


@ady624 the task set level to allows using an expression but set switch to does not support using an expression. till we have capture/restore state support for devices, and maybe even afterwards, it would be useful to have support for using an expression when doing set switch to.

thank you.

@bangali @ady624 @c1arkbar

Thank you all for the lesson in using variables to capture and restore. I appreciate all of your efforts and will spend some time looking over everything. It may take some time :wink: But it will be a good lesson in using variables.

I also look forward to having the capture/restore function added to WebCore! :wink: :wink: