espressif / esp-homekit-sdk

550 stars 99 forks source link

Controlling multiple devices with one esp32 #23

Closed manvish closed 3 years ago

manvish commented 3 years ago

Hello Developers, I have successfully implemented controlling of single light bulb from Accessory button in Home App. Now I want to add more things like PWM generation on 3 channels and 3 more GPIO to control from different buttons on APP. Is there any example similar to my requirement. ?

shahpiyushv commented 3 years ago

@manvish , you have 2 options

1) Add an additional lightbulb service to the same accessory by repeating the lines from here. 2) Define your primary accessory as a bridge and then add some lightbulb accessories to it, as per this example

The actual hardware interfacing code will have to be written by you as it is very use case specific.

manvish commented 3 years ago

Thanks. Can you tell me how to add three different slider on Home App, to change pwm on 3 different pins

shahpiyushv commented 3 years ago

@manvish are the 3 different pins for 3 different lights or for RGB?

If it is for 3 different lights, please create 3 different lightbulb services and map brightness characteristic with your pwm duty cycle.

If it is for RGB, you will have to convert RGB to HSV (hue, saturation, value) as HomeKit supports HSV format for colour lights. You can find a conversion function here.

shahpiyushv commented 3 years ago

Closing this issue since it has been answered.