+1
Solution Exists

Handle "mostlyOn" State for Trendsetter light group Switches

Jay Fisher 6 years ago in Panels (dashboards) / Special Tiles updated by Terry (ActionTiles) (Co-Founder) 6 years ago 3

Hello,


I noticed on a couple threads you guys mentioned Trendsetter as a good option to group lights.  I use Trendsetter and specifically the color light and light groups.  The only problem I have with it is if all lights arent the same status (brightness and on/off state) the icon changes to a ?


I know thats just the app responding because it doesnt have a valid state of ON/OFF for the button.  But the ? just looks really out of place.  I would love to see it change to the default state icon of the tile instead of the ?.


Image 1460


I love the app and just a request here, or if you know of any way to work around it I'd be willing to try it :)


Kudos for a great app and thanks in advance for the consideration of this 

Answers

+1
Answer

I took a closer look at Trendsetter to understand the exact situations it uses "mostlyOn" (and other non-standard State Values for Attribute "switch"). At this time, ActionTiles only handles the Commands, Attributes, and Values documented in the SmartThings Developer Documentation for Standard Official Capabilities. A Switch has Attribute switch(on,off). That's all. http://docs.smartthings.com/en/latest/capabilities-reference.html#switch


I do personally think the implementation of additional States in Trendsetter is clever and certainly not entirely unusual for custom Device Types, but without a standard, we would be constantly hardcoding additional customizations to ActionTiles. For a few "very popular" Device Types this may be justifiable, and/or, we can see what, ahem, trends arise in SmartThings development as more and more clever / creative DTHs are developed and shared. Non-Standard DTHs, though, just can't be expected to work with any or all arbitrary SmartApps, including ActionTiles. That means an entire sub-species of DTHs and SmartApps could evolve outside of SmartThing's documentation. It's a scary prospect, frankly.


In the meantime, the easiest workaround is for you to modify your personal instance of the Device Type Handler code to replace the non-standard Values with standard ones. In other words, decide to use either "on" or "off" instead of "half, almostAllOff, mostlyOff, or mostlyOn".


This is a code snip provided by one of our Beta testers when he experienced this same issue. Edit your DTH accordingly.


   if (percentOn == 50)
      //value = "half"
        value = "on"
    else if (percentOn > 0 && percentOn <= 25)
      //value = "almostAllOff"
        value = "off"
    else if (percentOn > 25 && percentOn < 50)
      //value = "mostlyOff"
        value = "on"
    else if (percentOn > 50 && percentOn < 100)
      //value = "mostlyOn"
        value = "on"

...Terry.

+1
PINNED

Worked perfectly, thanks for the tip!!  

+1
Answer

I took a closer look at Trendsetter to understand the exact situations it uses "mostlyOn" (and other non-standard State Values for Attribute "switch"). At this time, ActionTiles only handles the Commands, Attributes, and Values documented in the SmartThings Developer Documentation for Standard Official Capabilities. A Switch has Attribute switch(on,off). That's all. http://docs.smartthings.com/en/latest/capabilities-reference.html#switch


I do personally think the implementation of additional States in Trendsetter is clever and certainly not entirely unusual for custom Device Types, but without a standard, we would be constantly hardcoding additional customizations to ActionTiles. For a few "very popular" Device Types this may be justifiable, and/or, we can see what, ahem, trends arise in SmartThings development as more and more clever / creative DTHs are developed and shared. Non-Standard DTHs, though, just can't be expected to work with any or all arbitrary SmartApps, including ActionTiles. That means an entire sub-species of DTHs and SmartApps could evolve outside of SmartThing's documentation. It's a scary prospect, frankly.


In the meantime, the easiest workaround is for you to modify your personal instance of the Device Type Handler code to replace the non-standard Values with standard ones. In other words, decide to use either "on" or "off" instead of "half, almostAllOff, mostlyOff, or mostlyOn".


This is a code snip provided by one of our Beta testers when he experienced this same issue. Edit your DTH accordingly.


   if (percentOn == 50)
      //value = "half"
        value = "on"
    else if (percentOn > 0 && percentOn <= 25)
      //value = "almostAllOff"
        value = "off"
    else if (percentOn > 25 && percentOn < 50)
      //value = "mostlyOff"
        value = "on"
    else if (percentOn > 50 && percentOn < 100)
      //value = "mostlyOn"
        value = "on"

...Terry.

+1
PINNED

Worked perfectly, thanks for the tip!!  

Solution Exists

That's great news... you're welcome!

Commenting disabled