Homeyduino classes and capabilities?

So iv’e been developing simple solar shade controls. I use a micro controller (wemos d1 mini) and some relays. Connection with Homey is done with Homeyduino.

I started of using actions and Virtual devices. And it is working well. But it takes alot of flows to set up just to get manual controls. So now i want to move on to using capabilities instead.

It is working well code wise. But as many others i have trouble getting some capabilities to show up on the device card. For example. I would like to have 2 sliders (Preferably on the same tab). One tab with a toggle button and one tab with different data showing. Like solar intensity and current solar intensity trigger point.

I get that it is a class-problem. Is there an easy way to make your own class. Or is there a class that can display the thins i want already?

Is there some way i can see what capabilites shows up with what classes?

Regards / Patrik

It’s not a class problem. Each type of control always appears on the same tab so nothing to do there.
If you add new capabilities to the json file then you either need to remove and re-add the device or use the device.addCapability method, normally in the init device.

I know i have to reinstall the device. But i still can’t add two sliders. Is there a way to add two sliders to the same project?

When you add two or more sliders, there is a drop list at the top of the page to select each slider. So you can only see one at a time.

Ok

As i look under devices in Homey dev tools. It seems only one of two capabilities are added. No sure why.

This is how i added the capabilities. CondActions(); is called in setup.

void CondActions(){

  Homey.addCapability("windowcoverings_set" ,Slider_vardagsrum);
  Homey.addCapability("windowcoverings_set" ,Slider_balkong);
  
}

I have removed it from Homey each time i upload. I also tried restarting the Homeyduino App.

A device can only have one instance of a capability. If you want to “reuse” a capability you can use a sub-capability (I assume Homeyduino supports them, not sure though):

Homey.addCapability("windowcoverings_set.vardagsrum" ,Slider_vardagsrum);
Homey.addCapability("windowcoverings_set.balkong" ,Slider_balkong);

Well now i feel dumb. I have actualy done just that on another project :face_with_open_eyes_and_hand_over_mouth:

I will give it a try, thanks.

So, i know i have used sub-capabilities with Homeyduino before. With sensors the last time. It does not seem to work with sliders.

It did how ever dawn on me that there are different sliders. So a work around in this case. This worked and just as Adrian mentioned. A drop list apeared.

void CapdActions(){

Homey.addCapability("windowcoverings_set" ,Slider_vardagsrum);
Homey.addCapability("dim" ,Slider_balkong);
  
}

Thanks for your help guys.

I’d like to add that i managed to get this to work with sub-capabilities just as @robertklep suggested