PowerSource capability might not work

I am integrating Shelly’s H&T sensor in the Shelly Cloud plugin and I tried to use the PowerSource capability to show the battery status or USB power and it seems not to work? It does not show up in the capabilities list either. I ended up using an attribute with the same parameters as the capability which works fine.

I’ve fixed this on my development machine. The PowerSource Capability will work in the next release. For the time being use the custom attribute.

Great Bill, many thanks again. I have made several improvemnets to the Shelly plugins which I will post after the fixes in the new release :wink:
I have also included your suggestion about how to run the HasSubscribers() and the App runs much faster now!!

1 Like

Bill, have you been able to fix the PowerSource capability? It does not work yet in my project?
Many tanks!

It should work now. What values are you assigning to it?

It only accepts 3 values: Battery, DC, Mains. Make sure you are using the latest version as well. 4.2.1.0 was released yesterday.

I am not able to set it? Even if I force it to “Mains” it always shows “Unknown”. I guess I correctly set the Enum like:

ShellyCloud.PowerSource = “Mains”;

Is this corect?
Many thanks.

That looks correct. Are you sure you’ve added PowerSource to the Capabilities for the ShellyCloud object?

Maybe add a console.log message immediately above that statement just to make sure the code is running. If you could, email me your project so I can take a look.

You are correct. There is indeed a bug in the Plugin’s handling of the Capability. This will be fixed in the next 4.2.2 release. For the time being, continue using your custom Attribute.