{"action":"opened","number":312,"pull_request":{"url":"https://api.github.com/repos/mysensors/NodeManager/pulls/312","id":172733415,"html_url":"https://github.com/mysensors/NodeManager/pull/312","diff_url":"https://github.com/mysensors/NodeManager/pull/312.diff","patch_url":"https://github.com/mysensors/NodeManager/pull/312.patch","issue_url":"https://api.github.com/repos/mysensors/NodeManager/issues/312","number":312,"state":"open","locked":false,"title":"Inter-sensor communication","user":{"login":"user2684","id":8075171,"avatar_url":"https://avatars3.githubusercontent.com/u/8075171?v=4","gravatar_id":"","url":"https://api.github.com/users/user2684","html_url":"https://github.com/user2684","followers_url":"https://api.github.com/users/user2684/followers","following_url":"https://api.github.com/users/user2684/following{/other_user}","gists_url":"https://api.github.com/users/user2684/gists{/gist_id}","starred_url":"https://api.github.com/users/user2684/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/user2684/subscriptions","organizations_url":"https://api.github.com/users/user2684/orgs","repos_url":"https://api.github.com/users/user2684/repos","events_url":"https://api.github.com/users/user2684/events{/privacy}","received_events_url":"https://api.github.com/users/user2684/received_events","type":"User","site_admin":false},"body":"This PR is to enable users to hook with custom code into the out of the box sensors and ultimately allow inter-sensor communication without the need to involve the controller:\r\n* Added FEATURE_HOOKING, OFF by default\r\n* Added setPreLoopFunction() and setPostLoopFunction() to the Sensor class\r\n* The provided function must have the following constructor: `void function(Sensor* sensor)` so the user will have a direct reference to the sensor from within its custom code. Of course public only functions and variables will be accessible\r\n\r\nExample:\r\n// set the digital output of a pin, equals to the digital input of another pin\r\nvoid hook(Sensor* sensor) {\r\n  Serial.print(\"INPUT: \");\r\n  int digital_in = ((ChildInt*)sensor->children.get(1))->getValueInt();\r\n  Serial.println(digital_in);\r\n  Serial.print(\"OUTPUT: \");\r\n  Serial.println(digital_in);\r\n  digitalOut.setStatus(digitalOut.children.get(1),digital_in);\r\n}\r\n\r\n// before\r\nvoid before() {\r\n  // setup the serial port baud rate\r\n  Serial.begin(MY_BAUD_RATE);\r\n  \r\n  digitalIn.setPostLoopFunction(&hook);\r\n  node.setReportIntervalSeconds(10);\r\n}\r\n\r\n","created_at":"2018-03-04T18:30:13Z","updated_at":"2018-03-04T18:30:13Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/mysensors/NodeManager/pulls/312/commits","review_comments_url":"https://api.github.com/repos/mysensors/NodeManager/pulls/312/comments","review_comment_url":"https://api.github.com/repos/mysensors/NodeManager/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mysensors/NodeManager/issues/312/comments","statuses_url":"https://api.github.com/repos/mysensors/NodeManager/statuses/d792b7712cd776086c6c4e9130ee4e5721c5011f","head":{"label":"user2684:feature/sensors_communication","ref":"feature/sensors_communication","sha":"d792b7712cd776086c6c4e9130ee4e5721c5011f","user":{"login":"user2684","id":8075171,"avatar_url":"https://avatars3.githubusercontent.com/u/8075171?v=4","gravatar_id":"","url":"https://api.github.com/users/user2684","html_url":"https://github.com/user2684","followers_url":"https://api.github.com/users/user2684/followers","following_url":"https://api.github.com/users/user2684/following{/other_user}","gists_url":"https://api.github.com/users/user2684/gists{/gist_id}","starred_url":"https://api.github.com/users/user2684/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/user2684/subscriptions","organizations_url":"https://api.github.com/users/user2684/orgs","repos_url":"https://api.github.com/users/user2684/repos","events_url":"https://api.github.com/users/user2684/events{/privacy}","received_events_url":"https://api.github.com/users/user2684/received_events","type":"User","site_admin":false},"repo":{"id":92777864,"name":"NodeManager","full_name":"user2684/NodeManager","owner":{"login":"user2684","id":8075171,"avatar_url":"https://avatars3.githubusercontent.com/u/8075171?v=4","gravatar_id":"","url":"https://api.github.com/users/user2684","html_url":"https://github.com/user2684","followers_url":"https://api.github.com/users/user2684/followers","following_url":"https://api.github.com/users/user2684/following{/other_user}","gists_url":"https://api.github.com/users/user2684/gists{/gist_id}","starred_url":"https://api.github.com/users/user2684/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/user2684/subscriptions","organizations_url":"https://api.github.com/users/user2684/orgs","repos_url":"https://api.github.com/users/user2684/repos","events_url":"https://api.github.com/users/user2684/events{/privacy}","received_events_url":"https://api.github.com/users/user2684/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/user2684/NodeManager","description":"Plugin for a rapid development of battery-powered sensors","fork":true,"url":"https://api.github.com/repos/user2684/NodeManager","forks_url":"https://api.github.com/repos/user2684/NodeManager/forks","keys_url":"https://api.github.com/repos/user2684/NodeManager/keys{/key_id}","collaborators_url":"https://api.github.com/repos/user2684/NodeManager/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/user2684/NodeManager/teams","hooks_url":"https://api.github.com/repos/user2684/NodeManager/hooks","issue_events_url":"https://api.github.com/repos/user2684/NodeManager/issues/events{/number}","events_url":"https://api.github.com/repos/user2684/NodeManager/events","assignees_url":"https://api.github.com/repos/user2684/NodeManager/assignees{/user}","branches_url":"https://api.github.com/repos/user2684/NodeManager/branches{/branch}","tags_url":"https://api.github.com/repos/user2684/NodeManager/tags","blobs_url":"https://api.github.com/repos/user2684/NodeManager/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/user2684/NodeManager/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/user2684/NodeManager/git/refs{/sha}","trees_url":"https://api.github.com/repos/user2684/NodeManager/git/trees{/sha}","statuses_url":"https://api.github.com/repos/user2684/NodeManager/statuses/{sha}","languages_url":"https://api.github.com/repos/user2684/NodeManager/languages","stargazers_url":"https://api.github.com/repos/user2684/NodeManager/stargazers","contributors_url":"https://api.github.com/repos/user2684/NodeManager/contributors","subscribers_url":"https://api.github.com/repos/user2684/NodeManager/subscribers","subscription_url":"https://api.github.com/repos/user2684/NodeManager/subscription","commits_url":"https://api.github.com/repos/user2684/NodeManager/commits{/sha}","git_commits_url":"https://api.github.com/repos/user2684/NodeManager/git/commits{/sha}","comments_url":"https://api.github.com/repos/user2684/NodeManager/comments{/number}","issue_comment_url":"https://api.github.com/repos/user2684/NodeManager/issues/comments{/number}","contents_url":"https://api.github.com/repos/user2684/NodeManager/contents/{+path}","compare_url":"https://api.github.com/repos/user2684/NodeManager/compare/{base}...{head}","merges_url":"https://api.github.com/repos/user2684/NodeManager/merges","archive_url":"https://api.github.com/repos/user2684/NodeManager/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/user2684/NodeManager/downloads","issues_url":"https://api.github.com/repos/user2684/NodeManager/issues{/number}","pulls_url":"https://api.github.com/repos/user2684/NodeManager/pulls{/number}","milestones_url":"https://api.github.com/repos/user2684/NodeManager/milestones{/number}","notifications_url":"https://api.github.com/repos/user2684/NodeManager/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/user2684/NodeManager/labels{/name}","releases_url":"https://api.github.com/repos/user2684/NodeManager/releases{/id}","deployments_url":"https://api.github.com/repos/user2684/NodeManager/deployments","created_at":"2017-05-29T21:50:43Z","updated_at":"2017-07-01T22:23:02Z","pushed_at":"2018-03-04T18:25:58Z","git_url":"git://github.com/user2684/NodeManager.git","ssh_url":"git@github.com:user2684/NodeManager.git","clone_url":"https://github.com/user2684/NodeManager.git","svn_url":"https://github.com/user2684/NodeManager","homepage":"","size":968,"stargazers_count":1,"watchers_count":1,"language":"C++","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":null,"forks":0,"open_issues":0,"watchers":1,"default_branch":"master"}},"base":{"label":"mysensors:development","ref":"development","sha":"dae494c5872f13f8c2e48c7debfca4717a4fef41","user":{"login":"mysensors","id":6282844,"avatar_url":"https://avatars1.githubusercontent.com/u/6282844?v=4","gravatar_id":"","url":"https://api.github.com/users/mysensors","html_url":"https://github.com/mysensors","followers_url":"https://api.github.com/users/mysensors/followers","following_url":"https://api.github.com/users/mysensors/following{/other_user}","gists_url":"https://api.github.com/users/mysensors/gists{/gist_id}","starred_url":"https://api.github.com/users/mysensors/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mysensors/subscriptions","organizations_url":"https://api.github.com/users/mysensors/orgs","repos_url":"https://api.github.com/users/mysensors/repos","events_url":"https://api.github.com/users/mysensors/events{/privacy}","received_events_url":"https://api.github.com/users/mysensors/received_events","type":"Organization","site_admin":false},"repo":{"id":85987908,"name":"NodeManager","full_name":"mysensors/NodeManager","owner":{"login":"mysensors","id":6282844,"avatar_url":"https://avatars1.githubusercontent.com/u/6282844?v=4","gravatar_id":"","url":"https://api.github.com/users/mysensors","html_url":"https://github.com/mysensors","followers_url":"https://api.github.com/users/mysensors/followers","following_url":"https://api.github.com/users/mysensors/following{/other_user}","gists_url":"https://api.github.com/users/mysensors/gists{/gist_id}","starred_url":"https://api.github.com/users/mysensors/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mysensors/subscriptions","organizations_url":"https://api.github.com/users/mysensors/orgs","repos_url":"https://api.github.com/users/mysensors/repos","events_url":"https://api.github.com/users/mysensors/events{/privacy}","received_events_url":"https://api.github.com/users/mysensors/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mysensors/NodeManager","description":"Plugin for a rapid development of battery-powered sensors","fork":false,"url":"https://api.github.com/repos/mysensors/NodeManager","forks_url":"https://api.github.com/repos/mysensors/NodeManager/forks","keys_url":"https://api.github.com/repos/mysensors/NodeManager/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mysensors/NodeManager/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mysensors/NodeManager/teams","hooks_url":"https://api.github.com/repos/mysensors/NodeManager/hooks","issue_events_url":"https://api.github.com/repos/mysensors/NodeManager/issues/events{/number}","events_url":"https://api.github.com/repos/mysensors/NodeManager/events","assignees_url":"https://api.github.com/repos/mysensors/NodeManager/assignees{/user}","branches_url":"https://api.github.com/repos/mysensors/NodeManager/branches{/branch}","tags_url":"https://api.github.com/repos/mysensors/NodeManager/tags","blobs_url":"https://api.github.com/repos/mysensors/NodeManager/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mysensors/NodeManager/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mysensors/NodeManager/git/refs{/sha}","trees_url":"https://api.github.com/repos/mysensors/NodeManager/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mysensors/NodeManager/statuses/{sha}","languages_url":"https://api.github.com/repos/mysensors/NodeManager/languages","stargazers_url":"https://api.github.com/repos/mysensors/NodeManager/stargazers","contributors_url":"https://api.github.com/repos/mysensors/NodeManager/contributors","subscribers_url":"https://api.github.com/repos/mysensors/NodeManager/subscribers","subscription_url":"https://api.github.com/repos/mysensors/NodeManager/subscription","commits_url":"https://api.github.com/repos/mysensors/NodeManager/commits{/sha}","git_commits_url":"https://api.github.com/repos/mysensors/NodeManager/git/commits{/sha}","comments_url":"https://api.github.com/repos/mysensors/NodeManager/comments{/number}","issue_comment_url":"https://api.github.com/repos/mysensors/NodeManager/issues/comments{/number}","contents_url":"https://api.github.com/repos/mysensors/NodeManager/contents/{+path}","compare_url":"https://api.github.com/repos/mysensors/NodeManager/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mysensors/NodeManager/merges","archive_url":"https://api.github.com/repos/mysensors/NodeManager/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mysensors/NodeManager/downloads","issues_url":"https://api.github.com/repos/mysensors/NodeManager/issues{/number}","pulls_url":"https://api.github.com/repos/mysensors/NodeManager/pulls{/number}","milestones_url":"https://api.github.com/repos/mysensors/NodeManager/milestones{/number}","notifications_url":"https://api.github.com/repos/mysensors/NodeManager/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mysensors/NodeManager/labels{/name}","releases_url":"https://api.github.com/repos/mysensors/NodeManager/releases{/id}","deployments_url":"https://api.github.com/repos/mysensors/NodeManager/deployments","created_at":"2017-03-23T19:10:35Z","updated_at":"2018-03-04T06:06:29Z","pushed_at":"2018-03-03T17:38:17Z","git_url":"git://github.com/mysensors/NodeManager.git","ssh_url":"git@github.com:mysensors/NodeManager.git","clone_url":"https://github.com/mysensors/NodeManager.git","svn_url":"https://github.com/mysensors/NodeManager","homepage":"","size":524,"stargazers_count":57,"watchers_count":57,"language":"C++","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":30,"mirror_url":null,"archived":false,"open_issues_count":32,"license":null,"forks":30,"open_issues":32,"watchers":57,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mysensors/NodeManager/pulls/312"},"html":{"href":"https://github.com/mysensors/NodeManager/pull/312"},"issue":{"href":"https://api.github.com/repos/mysensors/NodeManager/issues/312"},"comments":{"href":"https://api.github.com/repos/mysensors/NodeManager/issues/312/comments"},"review_comments":{"href":"https://api.github.com/repos/mysensors/NodeManager/pulls/312/comments"},"review_comment":{"href":"https://api.github.com/repos/mysensors/NodeManager/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mysensors/NodeManager/pulls/312/commits"},"statuses":{"href":"https://api.github.com/repos/mysensors/NodeManager/statuses/d792b7712cd776086c6c4e9130ee4e5721c5011f"}},"author_association":"CONTRIBUTOR","merged":false,"mergeable":null,"rebaseable":null,"mergeable_state":"unknown","merged_by":null,"comments":0,"review_comments":0,"maintainer_can_modify":true,"commits":1,"additions":49,"deletions":8,"changed_files":4}}
{"actor":{"display_login":"user2684"}}