{"id":28952952,"url":"https://github.com/domiot-io/iot-bindings-node","last_synced_at":"2025-06-23T18:01:47.442Z","repository":{"id":299307890,"uuid":"1002639701","full_name":"domiot-io/iot-bindings-node","owner":"domiot-io","description":"Collections of HTML/DOM binding elements for linking DOM elements with physical components.","archived":false,"fork":false,"pushed_at":"2025-06-23T14:03:42.000Z","size":22,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-23T14:08:12.140Z","etag":null,"topics":["bindings","dom","domiot","elements","html","internet-of-things","iot","iot-system","nodejs","web-components"],"latest_commit_sha":null,"homepage":"https://domiot.org","language":"JavaScript","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/domiot-io.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,"zenodo":null}},"created_at":"2025-06-15T22:18:26.000Z","updated_at":"2025-06-23T14:03:45.000Z","dependencies_parsed_at":"2025-06-15T22:38:30.611Z","dependency_job_id":"9a9d1256-02a8-4b2c-ac05-62a33356e51b","html_url":"https://github.com/domiot-io/iot-bindings-node","commit_stats":null,"previous_names":["domiot-io/iot-bindings-node"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/domiot-io/iot-bindings-node","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/domiot-io%2Fiot-bindings-node","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/domiot-io%2Fiot-bindings-node/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/domiot-io%2Fiot-bindings-node/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/domiot-io%2Fiot-bindings-node/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/domiot-io","download_url":"https://codeload.github.com/domiot-io/iot-bindings-node/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/domiot-io%2Fiot-bindings-node/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261528613,"owners_count":23172747,"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":["bindings","dom","domiot","elements","html","internet-of-things","iot","iot-system","nodejs","web-components"],"created_at":"2025-06-23T18:00:30.552Z","updated_at":"2025-06-23T18:01:47.240Z","avatar_url":"https://github.com/domiot-io.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# HTML/DOM IoT Binding Element Factories\n\nCollections of HTML/DOM binding elements for linking DOM elements with physical IoT components.\n\n## Bindings\n\nThe binding elements link the DOM elements with physical components.\n\nBindings have two core attributes: `id` and `location`, without which they can't work.\n\nBindings listen for changes in the attributes of the elements that reference them (including CSS property changes). They parse these attributes into values interpretable by a driver and then communicate these values to that driver. Bindings also consume and interpret values from drivers, updating the DOM accordingly by modifying an attribute or dispatching an event.\n\n## Installation\n\n```\nnpm install iot-bindings-node\n```\n\n## Example\n\n```\nimport { retailElementFactoryCollection } from 'iot-elements-node';\nimport { linuxBindingFactoryCollection } from 'iot-bindings-node';\nimport { DOMIoT } from 'jsdomiot';\n\nconst html = `\n\u003chtml\u003e\n    \u003caisle\u003e\n        \u003ciot-ibits-button-binding id=\"buttonBinding\" location=\"/dev/ihubx24-sim0\"\u003e\n        \u003ciot-obits-color-binding id=\"colorBinding\" channels-per-element=\"2\" colors-channel=\"white;blue\" location=\"/dev/ohubx24-sim0\"\u003e\n        \n        \u003ciot-button id=\"myButton\" binding=\"buttonBinding\"\u003e\n        \u003ciot-shelving-unit id=\"myShelvingUnit\" style=\"color:white;\" binding=\"colorBinding\"\u003e\n    \u003c/aisle\u003e\n\u003c/html\u003e`;\n\nconst domiot = new DOMIoT(html, [retailElementFactoryCollection, linuxBindingFactoryCollection]);\nconst document = domiot.window.document;\n\n// Listen for button press events\ndocument.getElementById('myButton').addEventListener('press', (ev) =\u003e {\n    const myShelvingUnit = document.getElementById('myShelvingUnit');\n    myShelvingUnit.style.setProperty('color', 'blue'); // Changes physical light color to blue\n});\ndocument.getElementById('myButton').addEventListener('release', (ev) =\u003e {\n    const myShelvingUnit = document.getElementById('myShelvingUnit');\n    myShelvingUnit.style.setProperty('color', 'white'); // Changes physical light color to white\n});\n```\n\n## Available Bindings\n\n### Linux\n\n#### ibits-button (Input)\n\nBinding between drivers such as a hub of output channels communicating with bits, and a elements that can behave like buttons.\n\n**Example:**\n```\n\u003ciot-ibits-button-binding id=\"buttonBinding\" location=\"/dev/ihubx24-sim0\"\u003e\n\u003ciot-button id=\"btn1\" binding=\"buttonBinding\"\u003e\u003e\n\u003ciot-button id=\"btn2\" binding=\"buttonBinding\"\u003e\n```\n\nThe binding reads button state data (0 / 1) from a device file and dispatches press/release events to the elements associated with the binding. In the example above, it will dispatch events to the `iot-button` elements.\n\nButton states are read as strings where each character represents a button state:\n```\n\"011101000000000000000000\"  // 24 channels: 0=released, 1=pressed\n```\n\nThis binding can be used with [ihubx24-sim](https://github.com/domiot-io/drivers/tree/main/linux/ihubx24-sim) driver or any driver that implements the same interface.\n\n**Attributes:**\n- `id` (required): Unique identifier for the binding.\n- `location` (required): Path to the device file (e.g., `/dev/ihubx24-sim0`).\n\n**Events Dispatched:**\n- `press`: Fired when button is pressed (channel state changes to 1).\n- `release`: Fired when button is released (channel state changes to 0).\n\n\n#### obits-color (Output)\n\nBinding between drivers such as a hub of output channels communicating with bits, and css color property of the elements that reference the binding.\n\n**Example:**\n```\n\u003ciot-obits-color-binding \n    id=\"colorBinding\" \n    channels-per-element=\"2\" \n    colors-channel=\"white:0;blue:1\" \n    location=\"/dev/ohubx24-sim0\"\u003e\n\n \u003ciot-shelving-unit id=\"myShelvingUnit1\" style=\"color:white;\" binding=\"colorBinding\"\u003e\n \u003ciot-shelving-unit id=\"myShelvingUnit2\" style=\"color:white;\" binding=\"colorBinding\"\u003e\n```\n\nThe binding writes a color state data (0 / 1) to a device file when color CSS properties change on associated elements.\n\nColor states are written as binary strings:\n```\n\"101010000000000000000000\"  // 24 channels: 0=off, 1=on\n```\n\nThis binding can be used with [ohubx24-sim](https://github.com/domiot-io/drivers/tree/main/linux/ohubx24-sim) driver or any driver that implements the same interface.\n\n**Attributes:**\n- `id` (required): Unique identifier for the binding.\n- `location` (required): Path to the device file.\n- `channels-per-element` (optional): Number of channels per element (default: 1).\n- `colors-channel` (required): Color-to-channel mapping (format: `\"color1:channel1;color2:channel2\"`).\n\n**Monitored CSS Properties:**\n- `color`: Text color changes trigger device writes.\n\n\n#### iobits-lock (Input/Output)\n\nBinding between an IO driver such as an electronic lock mechanism driver communicating with bits and elements that can be locked/unlocked.\n\n**Example:**\n```\n\u003ciot-iobits-lock-binding id=\"lockBinding\" location=\"/dev/iohubx24-sim0\"\u003e\n\u003ciot-door id=\"hotelDoor\" locked binding=\"lockBinding\"\u003e\n```\n\nThe binding reads lock state data (0=unlocked, 1=locked) from a device file and updates the 'locked' attribute on associated elements. It also writes lock state data (0/1) to the device file when the 'locked' attribute changes on associated elements. Uses a single I/O channel to control the lock mechanism.\n\nLock states are read/written as single character strings:\n```\n\"0\"  // unlocked\n\"1\"  // locked\n```\n\nThis binding can be used with [iohubx24-sim](https://github.com/domiot-io/drivers/tree/main/linux/iohubx24-sim) driver or any driver that implements the same interface.\n\n**Attributes:**\n- `id` (required): Unique identifier for the binding.\n- `location` (required): Path to the device file (e.g., `/dev/iohubx24-sim0`).\n\n**Element Attributes:**\n- `locked`: Presence indicates locked state, absence indicates unlocked state.\n\n**Behavior:**\n- When device reports lock state change, updates element's `locked` attribute\n- When element's `locked` attribute changes, sends new state to device\n\n\n#### otext-attribute (Output)\n\nBinding between text consuming devices such as an LCD display, and elements that need to display text.\n\n**Example:**\n```\n\u003ciot-otext-attribute-binding id=\"lcdBinding\" attribute-name=\"message\" location=\"/dev/lcd-sim0\"\u003e\n\u003ciot-door id=\"hotelDoor\" message=\"Welcome to your room!\" binding=\"lcdBinding\"\u003e\n```\n\nThe binding writes message text to a device file when the 'message' attribute changes on associated elements.\n\nMessages are written as plain text strings (only first 120 characters are taken into account):\n\n```\n\"Welcome to your room!\"\n```\n\nThis binding can be used with [lcd-sim](https://github.com/domiot-io/drivers/tree/main/linux/lcd-sim) driver or any driver that implements the same interface.\n\n**Attributes:**\n- `id` (required): Unique identifier for the binding.\n- `location` (required): Path to the device file (e.g., `/dev/lcd-sim0`).\n- `attribute-name` (optional): Attribute containing the text to send to the device file. If no `attribute-name` is provided, the binding will use the 'text' attribute.\n\n**Element Attributes:**\n- `message`: Text message to display on the device (max 120 characters).\n\n**Behavior:**\n- When element's `message` attribute changes, sends new message to device\n- Messages longer than 120 characters are automatically truncated\n\n## API Reference\n\n### Linux Bindings\n\nImport the Linux binding collection:\n\n```\nimport { linuxBindingFactoryCollection } from 'iot-bindings-node/linux';\n```\n\nOr import individual binding creators:\n\n```\nimport { \n    createHTMLIoTIBitsButtonBindingElement,\n    createHTMLIoTOBitsColorBindingElement,\n    createHTMLIoTIOBitsLockBindingElement,\n    createHTMLIoTOTextMessageBindingElement,\n    bindingFactoryCollection \n} from 'iot-bindings-node/linux';\n```\n\n### Binding Element Methods\n\nAll binding elements inherit from `HTMLElement` and provide these callback methods:\n\n- `elementAttributeModified(index, el, attributeName, attributeValue)`: Called when bound element attributes change\n- `elementAttributeNSModified(index, el, namespace, attributeName, attributeValue)`: Called when namespaced attributes change  \n- `elementStyleModified(index, el, propertyName, propertyValue)`: Called when bound element styles change\n\n## License\n\nMIT.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdomiot-io%2Fiot-bindings-node","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdomiot-io%2Fiot-bindings-node","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdomiot-io%2Fiot-bindings-node/lists"}