{"action":"created","issue":{"url":"https://api.github.com/repos/maximkulkin/esp-homekit-demo/issues/82","repository_url":"https://api.github.com/repos/maximkulkin/esp-homekit-demo","labels_url":"https://api.github.com/repos/maximkulkin/esp-homekit-demo/issues/82/labels{/name}","comments_url":"https://api.github.com/repos/maximkulkin/esp-homekit-demo/issues/82/comments","events_url":"https://api.github.com/repos/maximkulkin/esp-homekit-demo/issues/82/events","html_url":"https://github.com/maximkulkin/esp-homekit-demo/issues/82","id":324153881,"number":82,"title":"What type and characteristics","user":{"login":"supersjimmie","id":16191439,"avatar_url":"https://avatars3.githubusercontent.com/u/16191439?v=4","gravatar_id":"","url":"https://api.github.com/users/supersjimmie","html_url":"https://github.com/supersjimmie","followers_url":"https://api.github.com/users/supersjimmie/followers","following_url":"https://api.github.com/users/supersjimmie/following{/other_user}","gists_url":"https://api.github.com/users/supersjimmie/gists{/gist_id}","starred_url":"https://api.github.com/users/supersjimmie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/supersjimmie/subscriptions","organizations_url":"https://api.github.com/users/supersjimmie/orgs","repos_url":"https://api.github.com/users/supersjimmie/repos","events_url":"https://api.github.com/users/supersjimmie/events{/privacy}","received_events_url":"https://api.github.com/users/supersjimmie/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":10,"created_at":"2018-05-17T19:25:06Z","updated_at":"2018-05-19T20:12:50Z","closed_at":null,"author_association":"NONE","body":"I have a wallmount dimmer. It's a double dimmer with touch buttons. Those buttons are controlled over 433MHz. See my other \"issue\" where I am building communication with (e.g.) some other 433MHz devices.\r\n\r\nDoes anyone know what type/characteristics I could use for a dimmer with such buttons:\r\n```\r\n/---------------\\\r\n| [ 1 ]   [ 4 ] |\r\n| [ 2 ]   [ 5 ] |\r\n| [ 3 ]   [ 6 ] |\r\n\\---------------/\r\nDinner room:\r\n1 = UP\r\n2 = on/off\r\n3 = DOWN\r\n\r\nMain room:\r\n4 = UP\r\n5 = on/off\r\n6 = DOWN\r\n\r\n```\r\nI have been experimenting with values from types.h  and characteristics.h  but still unable to find how to \"create\" such device."},"comment":{"url":"https://api.github.com/repos/maximkulkin/esp-homekit-demo/issues/comments/390429678","html_url":"https://github.com/maximkulkin/esp-homekit-demo/issues/82#issuecomment-390429678","issue_url":"https://api.github.com/repos/maximkulkin/esp-homekit-demo/issues/82","id":390429678,"user":{"login":"maximkulkin","id":10785,"avatar_url":"https://avatars2.githubusercontent.com/u/10785?v=4","gravatar_id":"","url":"https://api.github.com/users/maximkulkin","html_url":"https://github.com/maximkulkin","followers_url":"https://api.github.com/users/maximkulkin/followers","following_url":"https://api.github.com/users/maximkulkin/following{/other_user}","gists_url":"https://api.github.com/users/maximkulkin/gists{/gist_id}","starred_url":"https://api.github.com/users/maximkulkin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/maximkulkin/subscriptions","organizations_url":"https://api.github.com/users/maximkulkin/orgs","repos_url":"https://api.github.com/users/maximkulkin/repos","events_url":"https://api.github.com/users/maximkulkin/events{/privacy}","received_events_url":"https://api.github.com/users/maximkulkin/received_events","type":"User","site_admin":false},"created_at":"2018-05-19T20:12:50Z","updated_at":"2018-05-19T20:12:50Z","author_association":"OWNER","body":"@supersjimmie Yes, you should be able to deduce which button that is by inspecting data starting from a characteristic pointer provided. The easiest way in your case would be:\r\n```c\r\nhomekit_characteristic_t *button_name = homekit_service_characteristic_by_type(\r\n    _ch->service, HOMEKIT_CHARACTERISTIC_NAME\r\n);\r\nprintf(\"button name: %s\\n\", button_name->value.string_value);\r\n```\r\n\r\nThe other way to do that is to use characteristic callback context. It wasn't exposed through macros yet and I just pushed a change to enable that.\r\n```c\r\n// NOTICE \"context\" argument\r\nvoid dim3_callback(homekit_characteristic_t *_ch, homekit_value_t on, void *context);\r\n\r\nhomekit_characteristic_t dim3 = HOMEKIT_CHARACTERISTIC_(\r\n    ON, false, .callback=HOMEKIT_CHARACTERISTIC_CALLBACK(\r\n        dim3_callback, .context=(void*)\"button1\"\r\n    )\r\n);\r\n\r\nvoid dim3_callback(homekit_characteristic_t *_ch, homekit_value_t on, void *context) {\r\n    printf(\"button %s callback\", (char *)context);\r\n}\r\n```\r\nOf course instead of just passing string as context you can pass any other type or structure pointer in case you need to pass more data."}}
{"actor":{"display_login":"maximkulkin"}}