custom subscriptions JSON examples v0.3
custom subscriptions JSON examples

--- a/assets/js/iotcc.js
+++ b/assets/js/iotcc.js
@@ -32,6 +32,12 @@
     appConfig: {
         templateDebug: false,
         pageContainer: true
+    },
+    customSubscriptionWidgetJson: {
+        'toggle' : '{"pageName": "Custom", "pageId": 1000, "widget":"toggle", "title":"On/Off Toggle", "template": "template-1", "icon": "ion-ios-home", "class": "bg-orange", "order": 10}',
+        'radios': '{"pageName": "Custom", "pageId": 1000, "widget":"radios", "title":"Multiple choice", "options":[{"checked":true, "label": "Off", "status":"1"}, {"label": "Confort", "status":"2"}, {"label": "Anti freeze", "status":"3"}, {"label": "Confort -2", "status":"4"}], "template": "template-3", "icon": "ion-ios-home", "class": "bg-blue", "order": 20}',
+        'data': '{"pageName": "Custom", "pageId": 1000, "widget":"data", "title":"Data sensor", "value": "22", "valuedescription": "degrees C", "template": "template-3", "icon": "ion-ios-home", "class": "bg-green", "class2": "text-center", "order": 30}',
+        'data-control': '{"pageName": "Custom", "pageId": 1000, "widget":"data-control", "format":"int", "title":"Heater", "value": "22", "valuedescription": "degrees C", "template": "template-3", "icon": "ion-ios-home", "class": "bg-green", "class2": "text-center", "order": 40}',
     },
     init: function() {
         if (typeof jQuery == 'undefined') {
@@ -506,6 +512,7 @@
 
     $('#widget').change(function(e) {
         e.preventDefault();
+        $('.help-block.widgetJson').html('Example JSON Options: ' + iotCC.customSubscriptionWidgetJson[$(this).val()]);
         if ($(this).find('option:selected').data('action') == 'on') {
             $('.subscriptionAction').removeClass('hide');
         } else {

file:a/index.html -> file:b/index.html
--- a/index.html
+++ b/index.html
@@ -158,6 +158,7 @@
                                 <div class="form-group subscriptionWidgetJson">
                                     <label for="widgetJson">Widget JSON options</label>
                                     <input type="text" class="form-control" id="widgetJson" name="widgetJson" placeholder="Widget JSON options" />
+                                    <span class="help-block widgetJson"></span>
                                 </div>
                                 <div class="form-group subscriptionAction hide">
                                     <label for="actionTopic">Widget action topic</label>
@@ -337,7 +338,7 @@
 
     <footer class="main-footer">
         <div class="pull-right hidden-xs">
-            <b>Version</b> 0.1
+            <b>Version</b> 0.3
         </div>
         <strong>Copyright &copy; 2017 <a href="http://www.razvi.ro">Razvan Stanga</a>.</strong> All rights reserved.
     </footer>

file:a/readme.md -> file:b/readme.md
--- a/readme.md
+++ b/readme.md
@@ -17,7 +17,7 @@
 - all open control interfaces to show the same data/statuses without the need for refresh
 - TODO: create `scenarios` based on IoT data. if sensor1Temp < 10 then turn on heat
 - TODO: use NodeRed to create scenarios/notifications
-- TODO: subscribe to custom topics, assign template for display
+- BETA: subscribe to custom topics, assign template for display. To do configurator
 - TODO: OTA updates with widget configuration
 
 How it works (WIP) :

comments