{"id":14156028,"url":"https://github.com/john30/ebus-typespec","last_synced_at":"2026-03-02T22:02:24.514Z","repository":{"id":243529532,"uuid":"807277250","full_name":"john30/ebus-typespec","owner":"john30","description":"TypeSpec library for defining eBUS messages and emitting to ebusd CSV.","archived":false,"fork":false,"pushed_at":"2025-01-27T21:07:39.000Z","size":692,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-02T22:45:57.134Z","etag":null,"topics":["ebus","ebusd","ebusd-configuration","typespec"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/john30.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-05-28T19:46:04.000Z","updated_at":"2025-01-27T21:07:43.000Z","dependencies_parsed_at":"2024-06-09T17:14:32.775Z","dependency_job_id":"7f5d4803-275a-45fa-b39c-87d9764a1860","html_url":"https://github.com/john30/ebus-typespec","commit_stats":null,"previous_names":["john30/ebus-typespec"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/john30%2Febus-typespec","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/john30%2Febus-typespec/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/john30%2Febus-typespec/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/john30%2Febus-typespec/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/john30","download_url":"https://codeload.github.com/john30/ebus-typespec/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247324638,"owners_count":20920687,"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":["ebus","ebusd","ebusd-configuration","typespec"],"created_at":"2024-08-17T08:05:09.933Z","updated_at":"2026-03-02T22:02:24.487Z","avatar_url":"https://github.com/john30.png","language":"TypeScript","funding_links":[],"categories":["others"],"sub_categories":[],"readme":"# eBUS TypeSpec library\n\nThis is a [TypeSpec](https://typespec.io/) library for defining eBUS messages on a high level.\n\nIt comes with [decorators](#decorators) for the eBUS specific aspects of circuits, messages, fields and data transfer, as well as eBUS specific [data types](#data-types).\n\nOnce a message is declared in a typespec file, it can be converted to [ebusd CSV format](https://github.com/john30/ebusd/wiki/4.-Configuration) using an [emitter](#emitter).\n\nThis library is also used for [generating ebusd message configuration](https://github.com/john30/ebusd-configuration) files.\n\n## Decorators\nThis is a short overview of the [decorators](lib/decorators.tsp) offered by the library:\n* source address `QQ`: `@qq(QQ)`\n* target address `ZZ`: `@zz(ZZ)`\n* message ID `PB`, `SB`, `ID*`: `@id(PB, SB, ID*)`  \n  when using inheritance:\n  * base ID: `@base(PB, SB, ID*)`\n  * ID extension: `@ext(ID*)`\n  * inheritance: ``@inherit(...)`\n* message chaining: `@chain(...)`\n* message direction: `@write`, `@passive`\n* message condition(s): `@condition(model, values)`\n* message authorization: `@auth(level)`\n* field location: `@in`, `@out`\n* field divisor/factor: `@divisor(number)`, `@factor(number)`\n* field value list: `@values(...)`\n* field unit: `@unit(...)`\n\n## Data types\nAll the standard eBUS base data types like UCH etc. are available in the [`Ebus` types namespace](lib/types.tsp) under:\n* `Ebus.Num`: numeric+bit types\n* `Ebus.Str`: string types including hex sequence\n* `Ebus.Dtm`: date/time type\n\n## Models\nThe identification message is available in the [`Ebus` model namespace](lib/models.tsp) under:\n* `Ebus.Id`: read/write/broadcast versions of identification message\n\n## Emitter\nThe CSV emitter is available as with the following parameters:\n\nIt can be used via `tsp compile --emit @ebusd/ebus-typespec \u003ctsp files\u003e`.\n\n## Example\nHere is a small example of a message carrying just a single byte:\n\n```typespec\nimport \"@ebusd/ebus-typespec\";\nusing Ebus;\nusing Ebus.Num;\n\n@zz(0x08)\n@id(0x01, 0x02)\nmodel Message {\n  field1: UCH,\n}\n```\n\nThis fits to an eBUS byte sequence like this\n```hex\nff08010200 / 0105\n```\nthat transfers the `Message` from source `0xff` where the target `0x08` replied with a value of 5 for `field1`.\n\n## Scripts\nThis library also provides the following scripts via npm:\n\n* `tsp2ebusd`: converts TypSpec file(s) or stdin to an ebusd CSV file or stdout and can also send the output directly to an ebusd instance having the \"--define\" feature enabled.\n\n## Documentation\nSee [here for the documentation](docs.md) generated from the source.\n\n## Style guide\nFollowing the [TypeSpec style guide](https://typespec.io/docs/handbook/style-guide) with these additions/exceptions:\n* template models are supposed to be in camelCase (instead of PascalCase), e.g.  \n  ```typespec\n  model tempSensor {temp: UCH, sensor: UCH}\n  ```\n* default models (inherited from by \"real\" models) are supposed to be in camelCase (instead of PascalCase), e.g.  \n  ```typespec\n  @base(8, 9)\n  model r {}\n  ```\n  versus a \"real\" model, e.g.  \n  ```typespec\n  @inherit(r)\n  @ext(1, 2)\n  model Temperature {\n    value: UCH,\n  }\n  ```\n* the name of value lists in `enum` is supposed to begin with `Values_` followed by the name of the message or field referring to, e.g.  \n  ```typespec\n  enum Values_manufacturer {...}\n  ```\n* due to absence of an option to include models in a namepsace from another namespace, the construct for inclusion is putting these namespaces into a union named `_includes`:  \n  ```typespec\n    union _includes {\n      NamespaceModelName, // \u003c= unnamed entry inlines the referenced definition or emits an \"!include\" instruction (if includes is set in the emitter options)\n      _include: NamespaceModelName, // \u003c= entry with a name starting with \"_include\" explicitly emits an \"!include\" instruction\n      named: NamespaceModelName, // \u003c= named entry emits a !load instruction (if name does not start with \"_include\")\n      // etc.\n    }\n  ```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjohn30%2Febus-typespec","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjohn30%2Febus-typespec","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjohn30%2Febus-typespec/lists"}