Guest User

ISGFunctions

a guest
Nov 15th, 2017
206
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. function setFAN_Day(fanLevel)
  3. {
  4.     log("setze Tag Lüftung auf Stufe " + fanLevel);
  5.  
  6.     sendRequest2ISG('data=[{"name":"val82","value":"' + parseInt(fanLevel) + '"}]');
  7. }
  8. function setFAN_Night(fanLevel)
  9. {
  10.     log("setze Nacht Lüftung auf Stufe " + fanLevel);
  11.    
  12.     sendRequest2ISG('data=[{"name":"val83","value":"' + parseInt(fanLevel) + '"}]');
  13. }
  14.  
  15. function setHystereseAndFussPunkt(hysterese1, asymHysterese, fussPunkt)
  16. {
  17.     sendRequest2ISG('data=[{"name":"val162","value":"' + parseFloat(hysterese1) + '"},{"name":"val167","value":"' + parseFloat(asymHysterese) + '"},{"name":"val16","value":"' + parseFloat(fussPunkt) + '"}]');
  18. }
  19.  
  20. function sendRequest2ISG(data)
  21. {
  22.     var request = require('request');
  23.             request.post(
  24.                 {
  25.                     url:     'http://192.168.10.4/save.php',
  26.                     form: data
  27.                 },
  28.                 function(error, response, body)
  29.                 {
  30.                 if (!error && response.statusCode === 200) {
  31.                     log("ISG response: " + JSON.stringify(body));
  32.                 }
  33.                 else
  34.                 {
  35.                     log("error during ISG request: " + error);
  36.                     log("response.statusCode: " + response.statusCode);
  37.                     log("response.statusText: " + response.statusText);
  38.                 }
  39.             });
  40.        
  41. }
Advertisement
Add Comment
Please, Sign In to add comment