diff --git a/src-electron/generator/helper-c.js b/src-electron/generator/helper-c.js
index a472b6ec819220e0c8e98117379338060edf622e..b52658c37b979bfbf7168b1ac4d9f3afb7bfeeb5 100644
--- a/src-electron/generator/helper-c.js
+++ b/src-electron/generator/helper-c.js
@@ -26,7 +26,8 @@ const bin = require('../util/bin.js')
  */
 
 /**
- * Formats label as a C macro.
+ * Formats label as a C macro. This method performs a very simply substition
+ * of illegal characters, such as ' ', ':' and such into a '_' character.
  *
  * @param {*} label
  * @returns Label formatted as C macro.
@@ -39,6 +40,31 @@ function asMacro(label) {
   return l
 }
 
+/**
+ * Takes a label, and delimits is on camelcasing.
+ * For example:
+ *    VerySimpleLabel will turn into VERY_SIMPLE_LABEL
+ * @param {*} label
+ */
+function asDelimitedMacro(label) {
+  var ret = ''
+  if (label == null) return ret
+
+  for (var i = 0; i < label.length; i++) {
+    var ch = label.charAt(i)
+    var upch = ch.toUpperCase()
+    if (ch == upch) {
+      // uppercase
+      if (i != 0) ret = ret.concat('_')
+      ret = ret.concat(ch.toUpperCase())
+    } else {
+      // lowercase
+      ret = ret.concat(upch)
+    }
+  }
+  return ret
+}
+
 /**
  * Formats label as a C hex constant.
  * If value starts as 0x or 0X it is already treated as hex,
@@ -149,3 +175,4 @@ exports.asHex = asHex
 exports.asType = asType
 exports.asSymbol = asSymbol
 exports.asBytes = asBytes
+exports.asDelimitedMacro = asDelimitedMacro
diff --git a/test/gen-template/zap-id.handlebars b/test/gen-template/zap-id.handlebars
index 7448db8d61916c40d772ddc15338da88a81155c9..d9d76018685ac3e610b4ff69c0f1b290d98caaa6 100644
--- a/test/gen-template/zap-id.handlebars
+++ b/test/gen-template/zap-id.handlebars
@@ -4,7 +4,7 @@
 
 // Global, non-cluster-specific things
 {{#zcl_global_commands}}
-#define ZCL_{{asMacro label}}_COMMAND_ID ({{asHex code}})
+#define ZCL_{{asDelimitedMacro label}}_COMMAND_ID ({{asHex code}})
 {{/zcl_global_commands}}
 
 {{#zcl_clusters}}