{"id":16729023,"url":"https://github.com/boriswerner/iobroker-script-midi2mqtt","last_synced_at":"2025-03-15T16:35:04.704Z","repository":{"id":209866111,"uuid":"236331294","full_name":"boriswerner/iobroker-script-midi2mqtt","owner":"boriswerner","description":"midi2mqtt adaptation for iobroker Script Engine","archived":false,"fork":false,"pushed_at":"2020-01-26T16:21:50.000Z","size":5,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-22T06:24:57.273Z","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/boriswerner.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}},"created_at":"2020-01-26T15:27:06.000Z","updated_at":"2020-01-26T16:21:52.000Z","dependencies_parsed_at":"2023-11-29T15:44:24.953Z","dependency_job_id":null,"html_url":"https://github.com/boriswerner/iobroker-script-midi2mqtt","commit_stats":null,"previous_names":["boriswerner/iobroker-script-midi2mqtt"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boriswerner%2Fiobroker-script-midi2mqtt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boriswerner%2Fiobroker-script-midi2mqtt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boriswerner%2Fiobroker-script-midi2mqtt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boriswerner%2Fiobroker-script-midi2mqtt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/boriswerner","download_url":"https://codeload.github.com/boriswerner/iobroker-script-midi2mqtt/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243760914,"owners_count":20343733,"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-12T23:12:52.242Z","updated_at":"2025-03-15T16:35:04.680Z","avatar_url":"https://github.com/boriswerner.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# iobroker-script-midi2mqtt\nmidi2mqtt adaptation for iobroker Script Engine\n\nbased on https://github.com/TheOriginalAndrobot/midi2mqtt\n\nThe script is just a temporary solution. \nI am currently using it to send messages to the MQTT adapter in iobroker.\n\nI initially installed the midi2mqtt on the same Raspberry Pi 4 as the iobroker was running on and the delay between MIDI command recognized in the midi2mqtt and received mqtt message in iobroker MQTT was about a minute (using timestamps with both in debug mode).\nSo I checked whether I could send a message directly from the script engine in iobroker using the same mqtt library and it was without a delay.\nLast but not least I adjusted the whole script to run in the script engine.\nI just checked the receiving of MIDI signals to control some hue devices (dimming, switching on/off).\n\nNext is to implement MIDI directly into iobroker as an adapter.\nFor more flexibility RTP-MIDI (MIDI over network) should  be used either by a direct implementation or via a virtual device/proxy (some references on the topic are available below).\n\n## Installation\n\n- In the iobroker script engine instance add the NPM modules \"mqtt\" and \"easymidi\"\n- Create a new JavaScript script in iobroker Script Engine and paste the content of iobroker-script-midi2mqtt.js\n    - if the \"require\" section is marked red with an error \"Cannot find name 'require'.\" just try, this is at the time of writing a bug in the code editor.\n\n## Setup\n\nAdjust the following two lines with your information:\n\n```javascript\nvar MQTT_BROKER = 'mqtt://192.168.0.10';\nvar MIDI_DEVICE = 'Numark ORBIT:Numark ORBIT MIDI 1 20:0'\n```\nThe MIDI device information can be retrieved by starting the script and looking at the log, e.g.:\n\n`info\tjavascript.0 (1381) script.js.media.MIDI2MQTT_Test: Available MIDI inputs: Midi Through:Midi Through Port-0 14:0,Samson Graphite M25:Samson Graphite M25 MIDI 1 20:0,Numark ORBIT:Numark ORBIT MIDI 1 24:0,RtMidi Output Client:RtMidi Output 131:0`\n\n`info\tjavascript.0 (1381) script.js.media.MIDI2MQTT_Test: Available MIDI outputs: Midi Through:Midi Through Port-0 14:0,Samson Graphite M25:Samson Graphite M25 MIDI 1 20:0,Numark ORBIT:Numark ORBIT MIDI 1 24:0,RtMidi Input Client:RtMidi Input 130:0`\n\nHere you can see two MIDI devices (the number might change if you add more MIDI devices, initially the Numark device had `20:0`, when I added the Samson this changed to `24:0`):\n\n`Numark ORBIT:Numark ORBIT MIDI 1 24:0`\n`Samson Graphite M25:Samson Graphite M25 MIDI 1 20:0`\n\n## References\n\nOriginal script:\nhttps://github.com/TheOriginalAndrobot/midi2mqtt\n\n### RTP-MIDI\nhttps://github.com/ravelox/pimidi --RTP MIDI proxy for raspberry pi\nhttps://github.com/jdachtera/node-rtpmidi\nhttps://github.com/mik3y/pymidi\nhttps://github.com/lathoub/Arduino-AppleMIDI-Library\nhttp://www.humatic.de/htools/nmj","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fboriswerner%2Fiobroker-script-midi2mqtt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fboriswerner%2Fiobroker-script-midi2mqtt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fboriswerner%2Fiobroker-script-midi2mqtt/lists"}