{"id":16883361,"url":"https://github.com/hardillb/node-flic-buttons","last_synced_at":"2025-04-11T11:51:40.907Z","repository":{"id":68666273,"uuid":"50383964","full_name":"hardillb/node-flic-buttons","owner":"hardillb","description":null,"archived":false,"fork":false,"pushed_at":"2016-01-30T19:52:38.000Z","size":9,"stargazers_count":21,"open_issues_count":1,"forks_count":1,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-03-25T08:11:14.532Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hardillb.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-01-25T21:59:13.000Z","updated_at":"2018-02-14T14:45:58.000Z","dependencies_parsed_at":"2023-04-23T15:03:59.117Z","dependency_job_id":null,"html_url":"https://github.com/hardillb/node-flic-buttons","commit_stats":{"total_commits":7,"total_committers":1,"mean_commits":7.0,"dds":0.0,"last_synced_commit":"591d16ee7592674ecb79a78903e50578796b9c64"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hardillb%2Fnode-flic-buttons","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hardillb%2Fnode-flic-buttons/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hardillb%2Fnode-flic-buttons/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hardillb%2Fnode-flic-buttons/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hardillb","download_url":"https://codeload.github.com/hardillb/node-flic-buttons/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248390457,"owners_count":21095797,"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":[],"created_at":"2024-10-13T16:11:23.239Z","updated_at":"2025-04-11T11:51:40.886Z","avatar_url":"https://github.com/hardillb.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"##node-flic-buttons\n\nA NodeJS node to interact with the [flic.io][1] BLE buttons.\n\nThis node requires the [fliclib-linux-dist][2] daemon to handle \nthe low level comunication with the buttons. You will need to install\nthis (and the correct version of bluez) before you start.\n\nThe node supports all method that can be accesses by the C++ \nlibrary made available in the fliclib-linux-dist package.\n\n - startScan \n - stopScan\n - connectButton \n - disconnectButton\n\n`connectButton` and `disconnectButton` take the button MAC address of the button\n\n```\nvar flic = require('node-flic-buttons');\n\nvar buttons = new flic();\n// defaults to localhost:5000 else\n//var buttons = new flic(host, port);\n```\n\nThe `buttons` object will emit the following events\n\n - `online` - when connected to the daemon\n - `offline` - when disconnected from the daemon\n - `discovered` - when a button is discoverd (as part of a scan)\n - `connected` - when a button is connected\n - `disconnected` - when a button is disconnected\n - `click` - when a button is clicked, double clicked or long clicked\n\nThe `discovered`, `connected`, `disconnected`, and `click` all pass objects along with the event\n\n```\nflic.on('click', function(clickEvt){\n  //{\"deviceId\":\"80:E4:DA:70:XX:XX\",\"queued\":false,\"timeDiff\":0,\"isSingleClick\":true,\"isDoubleClick\":false,\"isHold\":false}\n  if (clickEvt.isSingleClick) {\n    ...\n  } else if (clickEvt.isDoubleClick) {\n    ...\n  } else if (clickEvt.isHold) {\n    ...\n  }\n});\n```\nI'm not 100% confident the `startScan`, `stopScan`, `connect` all work 100% of the time.\nYou can pair buttons manually with the `flic` command that ships with the `fliclib-linux`\npackage using the following actions:\n\n - Ensure that `bluetoothd` and the `daemon` are running\n - run `flic`\n - type the command `startScan`\n - press the flic button (you may have to press and hold for 7 seconds \n to unlock if it has been previously paired)\n - type the command `stopScan`\n - type the command `list`, this will show all known flic.io buttons\n```\n80:E4:DA:70:XX:XX [Disconnected]\n```\n - type `connect [80:E4:DA:70:XX:XX]` where [mac address is the button you want\n to pair]\n - you should now see something that looks like \n```\nConnected to: 80:E4:DA:70:XX:XX\nVerified: 80:E4:DA:70:XX:XX\n```\n - the button should now be paired\n\n[1]: https://flic.io/?r=985093\n[2]: https://github.com/50ButtonsEach/fliclib-linux-dist","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhardillb%2Fnode-flic-buttons","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhardillb%2Fnode-flic-buttons","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhardillb%2Fnode-flic-buttons/lists"}