esp32-homekit icon indicating copy to clipboard operation
esp32-homekit copied to clipboard

How to distinguish different types of rooms

Open simonlou99 opened this issue 7 years ago • 7 comments

I added several devices and found them all in the same room. How to distinguish different types of rooms? Tks.

simonlou99 avatar Jul 30 '18 06:07 simonlou99

This is no issue with the server code. That‘s something the client side has to do.

If your client is the Apple home app, you are able to set the room in the accessory settings (deep press and settings).

cduvenhorst avatar Jul 30 '18 06:07 cduvenhorst

I did it as you said. When you set a room type for one device, all other devices are the same type
Please kindly help check the code to fix the issue. Tks . void hap_object_init(void* arg) { void* accessory_object = hap_accessory_add(a); struct hap_characteristic cs[] = { {HAP_CHARACTER_IDENTIFY, (void*)true, NULL, identify_read, NULL, NULL}, {HAP_CHARACTER_MANUFACTURER, (void*)MANUFACTURER_NAME, NULL, NULL, NULL, NULL}, {HAP_CHARACTER_MODEL, (void*)MODEL_NAME, NULL, NULL, NULL, NULL}, {HAP_CHARACTER_NAME, (void*)ACCESSORY_NAME, NULL, NULL, NULL, NULL}, {HAP_CHARACTER_SERIAL_NUMBER, (void*)"0123456789", NULL, NULL, NULL, NULL}, {HAP_CHARACTER_FIRMWARE_REVISION, (void*)"1.0", NULL, NULL, NULL, NULL}, }; hap_service_and_characteristics_add(a, accessory_object, HAP_SERVICE_ACCESSORY_INFORMATION, cs, ARRAY_SIZE(cs)); struct hap_characteristic cc[] = { {HAP_CHARACTER_ON, (void*)led, NULL, led_read, led_write, led_notify}, }; hap_service_and_characteristics_add(a, accessory_object, HAP_SERVICE_SWITCHS, cc, ARRAY_SIZE(cc)); struct hap_characteristic humidity_sensor[] = { {HAP_CHARACTER_CURRENT_RELATIVE_HUMIDITY, (void*)humidity, NULL, _humidity_read, NULL, _humidity_notify}, {HAP_CHARACTER_NAME, (void*)"HYGROMETER" , NULL, NULL, NULL, NULL}, }; hap_service_and_characteristics_add(a , accessory_object, HAP_SERVICE_HUMIDITY_SENSOR, humidity_sensor, ARRAY_SIZE(humidity_sensor));

struct hap_characteristic temperature_sensor[] = { {HAP_CHARACTER_CURRENT_TEMPERATURE, (void*)temp, NULL, temp_read, NULL, temp_notify}, {HAP_CHARACTER_NAME, (void*)"Temp" , NULL, NULL, NULL, NULL}, hap_service_and_characteristics_add(a , accessory_object, HAP_SERVICE_TEMPERATURE_SENSOR, temperature_sensor, ARRAY_SIZE(temperature_sensor)); ........

simonlou99 avatar Jul 30 '18 08:07 simonlou99

@simonlou99

How about distinguish by name?

younghyunjo avatar Jul 31 '18 02:07 younghyunjo

I wanted to add a lot of devices, but I found them all in the same room type in the apple homekit app, and if I change one room type, the other devices change with it. The equipment is always in the same room. You can add more than one device and test it out.

simonlou99 avatar Jul 31 '18 02:07 simonlou99

Do you want put every room sensons on single esp32?

younghyunjo avatar Jul 31 '18 21:07 younghyunjo

I want to use esp32 as a gateway.

simonlou99 avatar Aug 01 '18 02:08 simonlou99

You already did. You add many services with characteristics at single esp32.

younghyunjo avatar Aug 01 '18 07:08 younghyunjo