{"id":21002510,"url":"https://github.com/pimatic/homeduinojs","last_synced_at":"2025-05-15T00:31:12.808Z","repository":{"id":19343373,"uuid":"22582456","full_name":"pimatic/homeduinojs","owner":"pimatic","description":"Node.js library for interfacing with the homeduino ardunio library","archived":false,"fork":false,"pushed_at":"2019-05-28T20:51:38.000Z","size":376,"stargazers_count":4,"open_issues_count":1,"forks_count":9,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-11-14T11:11:32.980Z","etag":null,"topics":["433mhz","home-automation","homeduino","pimatic"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pimatic.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}},"created_at":"2014-08-03T19:59:37.000Z","updated_at":"2019-05-28T20:51:40.000Z","dependencies_parsed_at":"2022-08-28T03:21:25.469Z","dependency_job_id":null,"html_url":"https://github.com/pimatic/homeduinojs","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/pimatic%2Fhomeduinojs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pimatic%2Fhomeduinojs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pimatic%2Fhomeduinojs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pimatic%2Fhomeduinojs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pimatic","download_url":"https://codeload.github.com/pimatic/homeduinojs/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225316758,"owners_count":17455310,"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":["433mhz","home-automation","homeduino","pimatic"],"created_at":"2024-11-19T08:18:57.924Z","updated_at":"2024-11-19T08:18:58.651Z","avatar_url":"https://github.com/pimatic.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"homeduinojs\n===========\n\nNode.js library for using [homeduino](https://github.com/sweetpi/homeduino).\n\nAPI\n---\n\n### connect\n\n```CoffeeScript\n\nhomeduino = require('homeduino')\nBoard = homeduino.Board\nboard = new Board('/dev/ttyUSB0', 115200)\n\nboard.connect().then( -\u003e\n  #do stuff\n).done()\n```\n\n### readDHT(type, pin)\n\nRead a dht sensor\n\n```CoffeeScript\nboard.readDHT(22, 13).then( (ret) -\u003e \n  console.log ret.temperature, ret.humidity\n).done()\n```\n\n\n### readDstSensors (pin)\n\nReturns all Dallas temp sensors on [pin]\n\n```CoffeeScript\nboard.readDstSensors(12).then( (ret) -\u003e \n  console.log ret.sensors\n).done()\n```\n\n\n### readDstSensor (pin, address)\n\nReads a sensor with [address] on [pin].\n\n```CoffeeScript\nboard.readDstSensor(12, '12312312333').then( (ret) -\u003e \n  console.log ret.temperature\n).done()\n```\n\n\n### readDstAll (pin)\n\nReads all sensors connected to [pin]\n\n```CoffeeScript\nboard.readDstAll(12).then( (ret) -\u003e \n  console.log ret.temperatures\n).done()\n```\n\n\n### rfControlStartReceiving(pin)\n\n```CoffeeScript\n\nboard.on \"rfReceive\", (event) -\u003e \n  console.log 'received:', event.pulseLengths, event.pulses\n\nboard.on \"rf\", (event) -\u003e \n  console.log \"#{event.protocol}: \", event.values\n\nboard.connect().then( -\u003e\n  console.log \"board ready\"\n  board.rfControlStartReceiving(0).then( -\u003e\n    console.log \"receiving...\"\n  ).done()\n).done()\n```\n\n### pin read and writes\n\n```CoffeeScript\nboard.digitalWrite(4, 1).done()\nboard.analogWrite(1, 10).done()\nboard.digitalRead(4).then( (value) -\u003e\n  console.log value\n).done()\nboard.analogRead(4).then( (value) -\u003e\n  console.log value\n).done()\nboard.pinMode(1, 0).done()\n```\n\nREPL-Client\n-----------\n\nIf a pimatic-homeduino instance is using the board make sure to shutdown pimatic as the board only\n allows for a single connection.\n \nSetup:\n\n```\ngit clone https://github.com/pimatic/homeduinojs \u0026\u0026 cd homeduinojs \u0026\u0026 npm install\n```\n\nHint: If you want to use the client in a production setup you need to manually install the `colors` \n package as shown below.\n\n```\ncd ~/pimatic-app/node_modules/pimatic-homeduino/node_modules/homeduino/node_modules\nnpm i colors\n```\n\nStart the REPL-Client which is located in the lib directory:\n\n```\n# cd ~/pimatic-app/node_modules/pimatic-homeduino/node_modules/homeduino/lib in a production setup\ncd homeduinojs/lib\nsudo ./client.js /dev/ttyUSB0 115200\n```\n\nIt will connect to the arduino and give you a prompt, where you can enter a \n javascript command. To start receiving RF data enter the command \n `board.rfControlStartReceiving(0)` or  `board.rfControlStartReceiving(1)`\n depending on the receiving pin used in your setup\n\n```\nconnecting to /dev/ttyUSB0 with 115200\nraw data: \"ready\"\nconnected\nhomeduino\u003e board.rfControlStartReceiving(0)\nraw data: \"ACK\"\nundefined\nhomeduino\u003e raw data: \"RF receive 516 1928 3880 9204 0 0 0 0 01020102010202020201010102010101010101010202020101010101010102010201020103\"\nprocessed: \"pulseLengths\":[516,1928,3880,9204],\"pulses\":\"01020102010202020201010102010101010101010202020101010101010102010201020103\"\nmatched proto: \"weather1: {\"id\":120,\"channel\":1,\"temperature\":22.4,\"humidity\":42,\"lowBattery\":false}\"\nmatched proto: \"weather5: {\"id\":234,\"lowBattery\":true,\"temperature\":179.3,\"humidity\":40}\"\nmatched proto: \"weather16: {\"id\":234,\"channel\":1,\"temperature\":179.3,\"humidity\":164,\"lowBattery\":true}\"\n\n```\n\nThe output is colorized by default. You can disable colors by starting \n the REPL-Client with the option `--no-color`. \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpimatic%2Fhomeduinojs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpimatic%2Fhomeduinojs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpimatic%2Fhomeduinojs/lists"}