CoRE icon indicating copy to clipboard operation
CoRE copied to clipboard

Deleted conditions increment trigger/condition number

Open holycacao opened this issue 8 years ago • 3 comments

if you add an 'If...' condition, then remove it by unselecting the capability, the trigger number still increments, so future 'If...' conditions for the same piston skip numbers. im not sure if this also implies a data leak ie the condition is not being removed from the st database?

phone: iphone 6+ ios: 9.3.4 hub type: hub v2.0, rev e, us hub firmware: 000.015.00003 core: v0.2.13c.20160814

holycacao avatar Aug 15 '16 22:08 holycacao

This behavior is intentional. I would not call it a "leak", but yeah, settings will remain for the deleted condition (I cannot modify the settings variable). The reason for this is pretty simple. If you create an IF with individual actions but then later delete it, and create a new one that would have the same id, you'd inherit everything you deleted on the previous condition which may be contradictory with what you're trying to do. i.e. actions would be pre-populated for a new condition that you wanted empty... Once an id is used, it is not recycled.

ady624 avatar Aug 17 '16 14:08 ady624

why can you not modify the settings variable (sorry, don't know enough about st development yet)? also, seeing Trigger #1 followed by Trigger #5 can be confusing to the user. why not use separate ids for backend and ui display, so users will always see their triggers in consecutive order?

holycacao avatar Aug 17 '16 15:08 holycacao

the Settings part of things is read only to the SmartApp. I could implement a second list of IDs but they would change as you modify things. They would get renumbered all the time.

ady624 avatar Aug 17 '16 21:08 ady624