项目作者: qmsk

项目描述 :
Go DMX controller with ArtNet discovery + Angular Web UI with WebSockets
高级语言: Go
项目地址: git://github.com/qmsk/dmx.git
创建时间: 2016-10-16T21:54:27Z
项目社区:https://github.com/qmsk/dmx

开源协议:Mozilla Public License 2.0

下载


Go DMX controller with ArtNet discovery + Angular Web UI with WebSockets

Web UI

qmsk::dmx Web UI

Usage

Docker

The recommended way to build and run the project is using Docker:

  1. $ git clone https://github.com/qmsk/dmx.git qmsk-dmx && cd qmsk-dmx
  2. $ docker build -t qmsk/dmx .
  3. $ docker run --rm --name qmsk-dmx -v $PWD/config:/etc/qmsk-dmx:ro -e ARTNET_DISCOVERY=2.255.255.255 -p 8000:8000 qmsk/dmx

The -v $PWD/config:/go/src/github.com/qmsk/dmx/config:ro allows editing the config and reloading it use docker restart qmsk-dmx.

The -e ARTNET_DISCOVERY=2.255.255.255 allows configuring a comma-separated list of broadcast/unicast addresses for ArtNet discovery.

The -p 8000:8000 allows accessing the API/UI at http://localhost:8000 on the machine running the Docker container.

github.com/qmsk/dmx/cmd/qmsk-dmx

  1. Usage:
  2. qmsk-dmx [OPTIONS] HeadsConfig
  3. Application Options:
  4. --log=
  5. --demo Demo Effect
  6. ArtNet:
  7. --artnet-listen=ADDR
  8. --artnet-discovery=ADDR
  9. --artnet-discovery-interval=DURATION
  10. --artnet-discovery-timeout=DURATION
  11. --artnet-dmx-refresh=DURATION
  12. --log.artnet=
  13. Heads:
  14. --log.heads=
  15. --heads-library=PATH
  16. Web:
  17. --http-listen=[HOST]:PORT
  18. --http-static=PATH
  19. Help Options:
  20. -h, --help Show this help message

github.com/qmsk/dmx/artnet

Go package supporting Art-Net discovery and DMX output.

github.com/qmsk/dmx/heads

DMX controller with support for multi-channel heads.
Configured using TOML configuration files, outputs DMX over Art-Net, controlled using a REST API and WebSocket event stream.

Configuration

Can be configured using a single toml file, or a structured directory of configuration files:

config/colors.toml

  1. [colors.red]
  2. Red = 1.0
  3. [colors.green]
  4. Green = 1.0
  5. [colors.blue]
  6. Blue = 1.0

config/groups.toml

  1. [led-par]
  2. Name = "LED-Par"
  3. [tri-bar]
  4. Name = "Tri-Bar"

config/heads.toml

  1. [led-par]
  2. Type = "stairville/ledpar56-5ch"
  3. Universe = 1
  4. Address = 1
  5. Count = 6
  6. Name = "LED-Par"
  7. Groups = ["led-par"]
  8. [tribar-1]
  9. Type = "american-dj/megatri60_mode2"
  10. Universe = 1
  11. Address = 20
  12. Name = "TriBar @ floor"
  13. Groups = ["tri-bar"]
  14. [tribar-2]
  15. Type = "american-dj/megatri60_mode2"
  16. Universe = 1
  17. Address = 30
  18. Name = "TriBar @ wall"
  19. Groups = ["tri-bar"]

config/presets/test.toml

  1. [Groups.led-par.Color]
  2. Red = 1.0
  3. Blue = 0.5
  4. [Groups.tri-bar.Intensity]
  5. Intensity = 1.0
  6. [Groups.tri-bar.Color]
  7. Red = 1.0
  8. Blue = 0.5

Web API

GET /api/

  1. {
  2. "Heads" : {
  3. "tribar-1" : {
  4. "Channels" : {
  5. "color:green" : {
  6. "Address" : 21,
  7. "DMX" : 0,
  8. "ID" : "color:green",
  9. "Value" : 0,
  10. "Type" : {
  11. "Color" : "green"
  12. },
  13. "Index" : 1
  14. },
  15. "intensity" : {
  16. "ID" : "intensity",
  17. "DMX" : 0,
  18. "Address" : 24,
  19. "Index" : 4,
  20. "Type" : {
  21. "Intensity" : true
  22. },
  23. "Value" : 0
  24. },
  25. "color:red" : {
  26. "ID" : "color:red",
  27. "DMX" : 0,
  28. "Address" : 20,
  29. "Type" : {
  30. "Color" : "red"
  31. },
  32. "Index" : 0,
  33. "Value" : 0
  34. },
  35. "control:control" : {
  36. "Value" : 0,
  37. "Index" : 3,
  38. "Type" : {
  39. "Control" : "control"
  40. },
  41. "Address" : 23,
  42. "DMX" : 0,
  43. "ID" : "control:control"
  44. },
  45. "color:blue" : {
  46. "Index" : 2,
  47. "Type" : {
  48. "Color" : "blue"
  49. },
  50. "Value" : 0,
  51. "ID" : "color:blue",
  52. "DMX" : 0,
  53. "Address" : 22
  54. }
  55. },
  56. "Intensity" : {
  57. "ScaleIntensity" : null,
  58. "Intensity" : 0
  59. },
  60. "Config" : {
  61. "Name" : "TriBar @ floor",
  62. "Type" : "american-dj/megatri60_mode2",
  63. "Universe" : 1,
  64. "Address" : 20,
  65. "Groups" : [
  66. "tri-bar"
  67. ],
  68. "Count" : 0
  69. },
  70. "Type" : {
  71. "URL" : "",
  72. "Model" : "Mega Tri 60",
  73. "Mode" : "2",
  74. "Channels" : [
  75. {
  76. "Color" : "red"
  77. },
  78. {
  79. "Color" : "green"
  80. },
  81. {
  82. "Color" : "blue"
  83. },
  84. {
  85. "Control" : "control"
  86. },
  87. {
  88. "Intensity" : true
  89. }
  90. ],
  91. "Vendor" : "American DJ",
  92. "Colors" : {
  93. "red" : {
  94. "Green" : 0,
  95. "Blue" : 0,
  96. "Red" : 1
  97. },
  98. "magenta" : {
  99. "Red" : 1,
  100. "Blue" : 1,
  101. "Green" : 0
  102. },
  103. "blue" : {
  104. "Red" : 0,
  105. "Green" : 0,
  106. "Blue" : 1
  107. },
  108. "cyan" : {
  109. "Blue" : 1,
  110. "Green" : 1,
  111. "Red" : 0
  112. },
  113. "amber" : {
  114. "Blue" : 0,
  115. "Green" : 0.5,
  116. "Red" : 1
  117. },
  118. "green" : {
  119. "Green" : 1,
  120. "Blue" : 0,
  121. "Red" : 0
  122. }
  123. }
  124. },
  125. "Color" : {
  126. "Green" : 0,
  127. "Blue" : 0,
  128. "Red" : 0,
  129. "ScaleIntensity" : null
  130. },
  131. "ID" : "tribar-1"
  132. },
  133. },
  134. "Outputs" : [
  135. {
  136. "Universe" : 1,
  137. "ArtNetNode" : {
  138. "OutputPorts" : [
  139. {
  140. "Address" : {
  141. "Net" : 0,
  142. "SubUni" : 1
  143. },
  144. "Type" : 0,
  145. "Status" : 128
  146. },
  147. {
  148. "Address" : {
  149. "Net" : 0,
  150. "SubUni" : 2
  151. },
  152. "Status" : 128,
  153. "Type" : 0
  154. }
  155. ],
  156. "Version" : 1,
  157. "Description" : "",
  158. "BaseAddress" : {
  159. "Net" : 0,
  160. "SubUni" : 0
  161. },
  162. "OEM" : 0,
  163. "Name" : "NodeMCU-ARTNET",
  164. "Report" : "",
  165. "InputPorts" : null,
  166. "Ethernet" : "00:00:00:00:00:00"
  167. }
  168. }
  169. ],
  170. "Groups" : {
  171. "tri-bar" : {
  172. "Color" : {
  173. "Red" : 0,
  174. "ScaleIntensity" : null,
  175. "Green" : 0,
  176. "Blue" : 0
  177. },
  178. "ID" : "tri-bar",
  179. "Name" : "Tri-Bar",
  180. "Intensity" : {
  181. "Intensity" : 0,
  182. "ScaleIntensity" : null
  183. },
  184. "Colors" : {
  185. "green" : {
  186. "Red" : 0,
  187. "Green" : 1,
  188. "Blue" : 0
  189. },
  190. "amber" : {
  191. "Green" : 0.5,
  192. "Blue" : 0,
  193. "Red" : 1
  194. },
  195. "cyan" : {
  196. "Red" : 0,
  197. "Blue" : 1,
  198. "Green" : 1
  199. },
  200. "red" : {
  201. "Green" : 0,
  202. "Blue" : 0,
  203. "Red" : 1
  204. },
  205. "magenta" : {
  206. "Green" : 0,
  207. "Blue" : 1,
  208. "Red" : 1
  209. },
  210. "blue" : {
  211. "Red" : 0,
  212. "Blue" : 1,
  213. "Green" : 0
  214. }
  215. },
  216. "Heads" : [
  217. "tribar-1",
  218. "tribar-2"
  219. ]
  220. },
  221. },
  222. "Presets" : {
  223. "test" : {
  224. "ID" : "test",
  225. "Groups" : {
  226. "led-par" : {
  227. "Intensity" : null,
  228. "Color" : {
  229. "Blue" : 0.5,
  230. "Green" : 0,
  231. "ScaleIntensity" : null,
  232. "Red" : 1
  233. }
  234. },
  235. "tri-bar" : {
  236. "Intensity" : {
  237. "Intensity" : 1,
  238. "ScaleIntensity" : null
  239. },
  240. "Color" : {
  241. "Red" : 1,
  242. "ScaleIntensity" : null,
  243. "Green" : 0,
  244. "Blue" : 0.5
  245. }
  246. }
  247. },
  248. "Config" : {
  249. "Name" : "",
  250. "All" : null,
  251. "Heads" : null,
  252. "Groups" : {
  253. "led-par" : {
  254. "Intensity" : null,
  255. "Color" : {
  256. "Green" : 0,
  257. "Blue" : 0.5,
  258. "Red" : 1,
  259. "ScaleIntensity" : null
  260. }
  261. },
  262. "tri-bar" : {
  263. "Intensity" : {
  264. "Intensity" : 1,
  265. "ScaleIntensity" : null
  266. },
  267. "Color" : {
  268. "Green" : 0,
  269. "Blue" : 0.5,
  270. "Red" : 1,
  271. "ScaleIntensity" : null
  272. }
  273. }
  274. }
  275. },
  276. "Heads" : {}
  277. }
  278. }
  279. }

POST /api/heads/tribar-1

  1. { "Color": { "Red": 0.517, "Green": 0.0, "Blue": 0.0}}

POST /api/groups/dimmer

  1. { "Intensity": 0.21 }

POST /api/presets/test

  1. { "Intensity": 0.69 }

Concepts

Heads

Top-level object that binds together everything else.

Output

A DMX universe (512 channels). Refreshed on every update. Connected to something like a github.com/qmsk/dmx/artnet Universe output.

Channel

Each *Head has multiple Channels, which are patched to some Output universe.

#

Head

Group

A number of Heads.

Preset

Parameters

Both Heads, Groups and Presets use Parameters.

Intensity

A single Intensity value.

Color

A combination of Red, Green and Blue values.