Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to distinguish different types of rooms #26

Open
simonlou99 opened this issue Jul 30, 2018 · 7 comments
Open

How to distinguish different types of rooms #26

simonlou99 opened this issue Jul 30, 2018 · 7 comments

Comments

@simonlou99
Copy link

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

@cduvenhorst
Copy link

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).

@simonlou99
Copy link
Author

simonlou99 commented Jul 30, 2018

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));
........

@younghyunjo
Copy link
Owner

@simonlou99

How about distinguish by name?

@simonlou99
Copy link
Author

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.

@younghyunjo
Copy link
Owner

Do you want put every room sensons on single esp32?

@simonlou99
Copy link
Author

I want to use esp32 as a gateway.

@younghyunjo
Copy link
Owner

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants