{"id":20186620,"url":"https://github.com/zimbora/mqtt-freertos2","last_synced_at":"2026-05-11T10:35:47.856Z","repository":{"id":200529087,"uuid":"705721953","full_name":"zimbora/mqtt-freeRTOS2","owner":"zimbora","description":"uService to manage devices running freeRTOS2 firmware","archived":false,"fork":false,"pushed_at":"2023-10-16T16:27:40.000Z","size":15,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-13T18:18:00.039Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://iot.inloc.cloud/","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/zimbora.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}},"created_at":"2023-10-16T15:07:34.000Z","updated_at":"2023-10-17T15:50:38.000Z","dependencies_parsed_at":"2023-10-17T06:21:29.122Z","dependency_job_id":null,"html_url":"https://github.com/zimbora/mqtt-freeRTOS2","commit_stats":null,"previous_names":["zimbora/mqtt-freertos2"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zimbora%2Fmqtt-freeRTOS2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zimbora%2Fmqtt-freeRTOS2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zimbora%2Fmqtt-freeRTOS2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zimbora%2Fmqtt-freeRTOS2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zimbora","download_url":"https://codeload.github.com/zimbora/mqtt-freeRTOS2/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241622594,"owners_count":19992502,"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-11-14T03:17:58.809Z","updated_at":"2025-11-28T14:05:56.382Z","avatar_url":"https://github.com/zimbora.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# mqtt-freeRTOS2\n\n## mqtt parser\n\n### Command\n  \u003e\u003e node deploy\n\n  1. build/sync all tables inside models folder\n  2. registers users and clients if not registered already\n\n  3. build/sync all tables inside projects folder\n  4. registers projects and models/apps if not registered already\n\n## Working mode\n\n### Command\n  \u003e\u003e node index\n\n  1. Checks all projects inside src/projects folder and enable it if is activated in config/index.js\n\n  2. Connects to defined MQTT broker\n\n  3. Parse MQTT messages starting with :project/MACRO_UID_PREFIX+uid/\n\n    3.1 register device if not exists\n    3.2 Associate to a project if project is registered\n    3.3 Associate to a model/app if model is registered\n\n  4. Call project parseMessage function\n\n## Instructions\n\n  Projects folders must be kept\n\n  The following functions must exist inside a file with the same name of the project\n\n  ```\n  module.exports = {\n    sync_db : async()=\u003e{\n    },\n    init : async ()=\u003e{\n    },\n    parseMessage : async (client, project, device, topic, payload, retain, cb)=\u003e{\n    },\n  }\n  ```\n\n  Ex: If project name is freeRTOS2, so must exist a file in projects/freeRTOS2/freeRTOS2.js.\n\n  Calling the following methods will write data in a ${table} with the name of the project, and also\n  in other table called \"logs_\"+${table}. Data will be written if there is a field in the respective table\n  with the same name as the name in topic.\n\n  ```\n  $.db_data.update(project,device?.id,topic,payload);\n  $.db_data.addLog(\"logs_\"+project,device.id,topic,payload);\n  ```\n\nUse a docker-compose file to do that:\n```\nversion: '3.3'\nservices:\n  db:\n    image: mysql:8.0\n    restart: always\n    environment:\n      MYSQL_DATABASE: 'mqtt-aedes'\n      # So you don't have to use root, but you can if you like\n      MYSQL_USER: 'user'\n      # You can use whatever password you like\n      MYSQL_PASSWORD: 'user_pwd'\n      # Password for root access\n      MYSQL_ROOT_PASSWORD: 'root_pwd'\n    ports:\n      # \u003cPort exposed\u003e : \u003c MySQL Port running inside container\u003e\n      - '3306:3306'\n    expose:\n      # Opens port 3306 on the container\n      - '3306'\n      # Where our data will be persisted\n    volumes:\n      - my-db:/var/lib/mysql\n  mqtt-freeRTOS2:\n    #build: ./mqtt-freeRTOS2\n    image: zimbora:mqtt-freeRTOS2\n    restart: unless-stopped\n    command: sh -c \"node deploy \u0026\u0026 node index.js\"\n    environment:\n      # web\n      HTTP_PROTOCOL: 'http://'\n      DOMAIN: '192.168.1.108'\n      # MQTT\n      MQTT_PROTOCOL: 'MQTT'\n      MQTT_HOST: 'localhost'\n      MQTT_PORT: '1883'\n      #MQTTS_PORT\n      MQTT_USER: 'admin'\n      MQTT_PWD: 'admin'\n      MQTT_CLIENT: 'mqtt-freeRTOS2'\n      # DataBase\n      DB_HOST: 'db'\n      DB_PORT: '3306'\n      DB_USER: 'user'\n      DB_PWD: 'user_pwd'\n      DB_NAME: 'mqtt-aedes'\n      # sync_db\n      sync_main_tables: 'true'\n      #projects\n      freeRTOS: 'true'\n    volumes:\n      - .:/usr/app/mqtt_freeRTOS2/\n      - /usr/app/mqtt_freeRTOS2/node_modules\n    depends_on:\n      - db\n# Names our volume\nvolumes:\n  my-db:\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzimbora%2Fmqtt-freertos2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzimbora%2Fmqtt-freertos2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzimbora%2Fmqtt-freertos2/lists"}