{"id":19064913,"url":"https://github.com/thekeenant/dhub","last_synced_at":"2025-06-12T21:35:48.738Z","repository":{"id":77222607,"uuid":"85766400","full_name":"thekeenant/dhub","owner":"thekeenant","description":"Experimenting with home automation in Java.","archived":false,"fork":false,"pushed_at":"2017-08-22T21:40:38.000Z","size":274,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-02T14:12:03.752Z","etag":null,"topics":["home-automation","internet-of-things","iot","iot-platform","java-8","z-wave"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/thekeenant.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-03-22T00:12:00.000Z","updated_at":"2017-09-09T17:57:10.000Z","dependencies_parsed_at":null,"dependency_job_id":"e76a80c2-59ab-4a0c-8d7d-a174af94fff2","html_url":"https://github.com/thekeenant/dhub","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thekeenant%2Fdhub","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thekeenant%2Fdhub/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thekeenant%2Fdhub/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thekeenant%2Fdhub/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thekeenant","download_url":"https://codeload.github.com/thekeenant/dhub/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240118329,"owners_count":19750471,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["home-automation","internet-of-things","iot","iot-platform","java-8","z-wave"],"created_at":"2024-11-09T00:47:53.836Z","updated_at":"2025-02-22T02:44:31.070Z","avatar_url":"https://github.com/thekeenant.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# dhub\n\nDevice Hub is an internet-of-things REST API that allows communication with various connected\ndevices from a centralized server. Through enabling different plugins, devices of\ndifferent communication protocols can be connected to the platform, and then manipulated\nvia the REST interface.\n\nCurrently the REST interface is not complete, but the plugin for communicating\nwith Z-Wave enabled devices supports many commands and can be used reliably with modern\nZ-Wave devices.\n\n## Z-Wave\n\nYour Z-Wave USB controller must be connected to the same machine of the server because\nit will communicate over the serial port.\n\n**Controller:** Provide the name of the serial port and start communication. Multiple\ncontrollers are supported as controllers are completely isolated.\n\n```java\nController = controller = new Controller(\"ttyACM0\");\ncontroller.start() // open the port, enable communication\n```\n\n**Setting:** The most basic test of a Z-Wave device is the basic set command.\n```java\n// set the node with id of 1 to 50%\ncontroller.send(new SendDataMsg\u003c\u003e(1, CmdClass.BASIC.setPercent(0.5)));\n\n// turn off\ncontroller.send(new SendDataMsg\u003c\u003e(1, CmdClass.BASIC.setOff()));\n```\n\n**Get/Reports:** We can request updates to a node and fetch their current status.\nThe message system leverages mbassador as the event bus within the controller object.\n\n```java\n// first we must listen to the report back with an async handler\ncontroller.listen(BasicReportEvent.class, (listener, event) -\u003e {\n    if (event.getNodeId() == 1) {\n        double percent = event.getCmd().getPercent();\n        // ...\n    }\n});\n\n// then send the request\ncontroller.send(new SendDataMsg\u003c\u003e(1, CmdClass.BASIC.get()));\n```\n\n**Multichannel support:** Some devices have multiple endpoints, such as a power outlet\nwith 4 separate AC outlets that can be controlled individually. Here, we set the\n3rd subnode of the node with id 1 to 25%.\n\n```java\nEncap\u003cInboundCmd\u003e encap = CmdClass.MULTI_CHANNEL.encap(3, CmdClass.BASIC.setPercent(0.25));\ncontroller.send(new SendDataMsg\u003c\u003e(1, cmd)).await();\n```\n\n**Other commands:** More can be found in the source. Here we request the controller\na list of nodes:\n\n```java\n// first we register and async handler for a future reply message\ncontroller.listen(NodeListReplyEvent.class, (listener, event) -\u003e {\n    Set\u003cInteger\u003e nodeIds = event.getMessage().getNodeIds();\n    // handle node ids accordingly\n});\n// then send the request message\ncontroller.send(new NodeListMsg());\n```\n\nMore examples can be found in the examples folder.\n\n## Contribute\n\nI welcome any contributions, and the source code is licensed under the\nhighly permissive MIT license.\n\n**Resources:**\n\n* [Z-Wave Public Spec](http://z-wave.sigmadesigns.com/resources/)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthekeenant%2Fdhub","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthekeenant%2Fdhub","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthekeenant%2Fdhub/lists"}