How do we use Capablity.Power?


(Darc Ranger) #1

In the Documentation section of the IDE there is a Capability Power.

Has anyone found a way for it or seen it used.
Here is information from the site.

Power

Capability Name_________SmartApp Preferences Reference
Power__________________capability.power

Attribute________________Type______________Possible Values
powerSource _________String "unknown""mains" “battery” “dc”

Commands:
None.


(ActionTiles.com co-founder Terry @ActionTiles; GitHub: @cosmicpuppy) #2

Really sad, isn’t it… The lack of deep Capability documentation on this foundational aspect of the platform?

One thing worth doing is a search of the public Community SmartThings GitHub repo to see if any DTH (or SmartApps!) use the Capability.

Also worth tagging @Jim


(Jim Anderson) #3

Perhaps @unixbeast can help answer any questions or find out more info.


(Dave Hastings) #4

This capability is mainly meant to be an indication of when the power source changes for a device. For example, if you device for some reason goes to a backup power source.

That being said, it sounds like the developers are thinking of renaming/reworking that capability a bit. So I would hold off a bit on using it until you see it updated in the docs.

Dave


(Convinced ST will never be unbroken…) #5

I use it with an original Smartsense motion detector to notify me of a power failure. IIRC the stock DTH for that device supports it (although they broke it for a time).

BTW @unixbeast where in the doc would I find whether ‘delay’ pauses script execution?


(Darc Ranger) #6

I was looking into the capability as more of a notification of power supply changes, like battery to AC and back. Although I do not have the original motions senor, I was wondering if other devices like dual powered thermostat could serve a similar function. I will hold off until things are revised and see we what can be done.


(Convinced ST will never be unbroken…) #7

That is exactly what the gen 1 detector provides, and why I was bummed they removed that capability from the new one. And while the Aeon multi-sensor supports both battery and usb power, it does not support this capability.

I don’t know of any other device that does.


(Dave Hastings) #8

Although it doesn’t directly answer your questions, maybe this will help:
http://docs.smartthings.com/en/latest/code-review-guidelines.html?highlight=delay#do-not-use-busy-loops


(Convinced ST will never be unbroken…) #9

Thanks. That seems pretty clear it pauses execution. But there is a specific ‘delay’ param…

mySwitch.on([delay: 2000])

where it is not clear if it pauses execution. Does anyone there know?


(Dave Hastings) #10

This is the response I got back from development:

“It’s handled by the platform as an optional Map parameter to device commands. The device handler itself doesn’t need to explicitly support it. It delays execution of the command but does not pause execution of the SmartApp”