ramp-thermostat.html 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. <script type="text/x-red" data-template-name="ramp-thermostat">
  2. <div class="form-row">
  3. <label for="node-input-profile"><i class="fa fa-line-chart"></i> Profile</label>
  4. <input type="text" id="node-input-profile">
  5. </div>
  6. <div class="form-row">
  7. <label for="node-input-hysteresisplus"><i class="fa fa-arrows-v"></i> Hysteresis [+]</label>
  8. <input type="text" id="node-input-hysteresisplus" style="width:50px">
  9. </div>
  10. <div class="form-row">
  11. <label for="node-input-hysteresisminus"><i class="fa fa-arrows-v"></i> Hysteresis [-]</label>
  12. <input type="text" id="node-input-hysteresisminus" style="width:50px">
  13. </div>
  14. <div class="form-row">
  15. <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
  16. <input type="text" id="node-input-name" placeholder="Name">
  17. </div>
  18. <div class="form-tips"><span>The Hysteresis is used to prevent osciliation. The [+] value is added to the target and the [-] (absolute) value is subtracted from the target. Within this neutral zone no action accurs.</span>
  19. </div>
  20. </script>
  21. <script type="text/x-red" data-help-name="ramp-thermostat">
  22. <p>A node that emulates a thermostat.</p>
  23. <p>The ramp-thermostat controls an actuator depending on the current input temperature and the target temperature.</p>
  24. <p>The target temperature is defined by a profile that
  25. provides the value depending on the current time <code>00:00-24:00</code>.
  26. The profile consists of several points whose connections build a sequence of lines.
  27. The switching moment can be optimized by defining a gradient line like a <code>ramp</code>.</p>
  28. <p>Input settings at runtime:</p>
  29. <ul>
  30. <li>msg.topic: setTarget, msg.payload: number</li>
  31. <li>msg.topic: setProfile, msg.payload: profile-name</li>
  32. </ul>
  33. <p>The node provides 3 outputs:</p>
  34. <ul>
  35. <li><code>state (boolean)</code></li>
  36. <li><code>current temperature</code></li>
  37. <li><code>target temperature</code></li>
  38. </ul>
  39. </script>
  40. <script type="text/javascript">
  41. RED.nodes.registerType('ramp-thermostat',{
  42. category: 'smart home',
  43. color: '#E9967A',
  44. defaults: {
  45. name: {value:""},
  46. profile: {value:"",type:"profile"},
  47. hysteresisplus: {value:""},
  48. hysteresisminus: {value:""}
  49. },
  50. inputs:1,
  51. outputs:3,
  52. icon: "trigger.png",
  53. label: function() {
  54. return this.name||"ramp-thermostat";
  55. },
  56. paletteLabel: 'thermostat'
  57. });
  58. </script>
  59. <script type="text/x-red" data-template-name="profile">
  60. <div class="form-row">
  61. <label for="node-config-input-name"><i class="fa fa-tag"></i> Name</label>
  62. <input type="text" id="node-config-input-name">
  63. </div>
  64. <div>
  65. <label style="float:left; margin-bottom:10px"><i class="fa fa-dot-circle-o"></i> Points:</label>
  66. <label style="float:left;margin-left:45px;"> Time (hh:mm)&nbsp;&nbsp&nbsp;Temp (°)</label>
  67. </div>
  68. <div class="form-row">
  69. <label for="node-config-input-time1"><i class="fa fa-dot-circle-o"></i> #1</label>
  70. <input class="input-append-left" type="text" id="node-config-input-time1" style="width:50px">
  71. <input type="text" id="node-config-input-temp1" style="margin-left:45px; width:50px">
  72. </div>
  73. <div class="form-row">
  74. <label for="node-config-input-time2"><i class="fa fa-dot-circle-o"></i> #2</label>
  75. <input class="input-append-left" type="text" id="node-config-input-time2" style="width:50px">
  76. <input type="text" id="node-config-input-temp2" style="margin-left:45px; width:50px">
  77. </div>
  78. <div class="form-row">
  79. <label for="node-config-input-time3"><i class="fa fa-dot-circle-o"></i> #3</label>
  80. <input class="input-append-left" type="text" id="node-config-input-time3" style="width:50px">
  81. <input type="text" id="node-config-input-temp3" style="margin-left:45px; width:50px">
  82. </div>
  83. <div class="form-row">
  84. <label for="node-config-input-time4"><i class="fa fa-dot-circle-o"></i> #4</label>
  85. <input class="input-append-left" type="text" id="node-config-input-time4" style="width:50px">
  86. <input type="text" id="node-config-input-temp4" style="margin-left:45px; width:50px">
  87. </div>
  88. <div class="form-row">
  89. <label for="node-config-input-time5"><i class="fa fa-dot-circle-o"></i> #5</label>
  90. <input class="input-append-left" type="text" id="node-config-input-time5" style="width:50px">
  91. <input type="text" id="node-config-input-temp5" style="margin-left:45px; width:50px">
  92. </div>
  93. <div class="form-row">
  94. <label for="node-config-input-time6"><i class="fa fa-dot-circle-o"></i> #6</label>
  95. <input class="input-append-left" type="text" id="node-config-input-time6" style="width:50px">
  96. <input type="text" id="node-config-input-temp6" style="margin-left:45px; width:50px">
  97. </div>
  98. <div class="form-row">
  99. <label for="node-config-input-time7"><i class="fa fa-dot-circle-o"></i> #7</label>
  100. <input class="input-append-left" type="text" id="node-config-input-time7" style="width:50px">
  101. <input type="text" id="node-config-input-temp7" style="margin-left:45px; width:50px">
  102. </div>
  103. <div class="form-row">
  104. <label for="node-config-input-time8"><i class="fa fa-dot-circle-o"></i> #8</label>
  105. <input class="input-append-left" type="text" id="node-config-input-time8" style="width:50px">
  106. <input type="text" id="node-config-input-temp8" style="margin-left:45px; width:50px">
  107. </div>
  108. <div class="form-row">
  109. <label for="node-config-input-time9"><i class="fa fa-dot-circle-o"></i> #9</label>
  110. <input class="input-append-left" type="text" id="node-config-input-time9" style="width:50px">
  111. <input type="text" id="node-config-input-temp9" style="margin-left:45px; width:50px">
  112. </div>
  113. <div class="form-row">
  114. <label for="node-config-input-time10"><i class="fa fa-dot-circle-o"></i> #10</label>
  115. <input class="input-append-left" type="text" id="node-config-input-time10" style="width:50px">
  116. <input type="text" id="node-config-input-temp10" style="margin-left:45px; width:50px">
  117. </div>
  118. <div class="form-tips"><span>A Profile has at least 2 Points and should typically start at 00:00 and end at 24:00.</span>
  119. </div>
  120. </script>
  121. <script type="text/javascript">
  122. RED.nodes.registerType('profile',{
  123. category: 'config',
  124. defaults: {
  125. name: {value:'',required:true},
  126. time1: {value:''},
  127. temp1: {value:''},
  128. time2: {value:''},
  129. temp2: {value:''},
  130. time3: {value:''},
  131. temp3: {value:''},
  132. time4: {value:''},
  133. temp4: {value:''},
  134. time5: {value:''},
  135. temp5: {value:''},
  136. time6: {value:''},
  137. temp6: {value:''},
  138. time7: {value:''},
  139. temp7: {value:''},
  140. time8: {value:''},
  141. temp8: {value:''},
  142. time9: {value:''},
  143. temp9: {value:''},
  144. time10: {value:''},
  145. temp10: {value:''},
  146. },
  147. label: function() {
  148. return this.name;
  149. }
  150. });
  151. </script>