Node-Red configuration
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Heatfunction.js 1.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. // name: Heatfunction
  2. // outputs: 3
  3. // initialize: DEBUG = false;\n\nkey_user_setpoint = "user_setpoint_sleep_madi"
  4. // finalize: // Der Code hier wird ausgeführt,\n// wenn der Node gestoppt wird\n
  5. // info:
  6. if (DEBUG)
  7. {
  8. node.warn(msg)
  9. }
  10. out_1 = null;
  11. out_2 = null;
  12. out_3 = null;
  13. user_setpoint = flow.get(key_user_setpoint)
  14. if (msg.topic == "valve_setpoint")
  15. {
  16. if (user_setpoint == undefined)
  17. {
  18. flow.set(key_user_setpoint, msg.payload)
  19. }
  20. }
  21. else if (msg.topic == "user_setpoint")
  22. {
  23. flow.set(key_user_setpoint, msg.payload)
  24. out_1 = {topic: "new_setpoint", payload: {"current_heating_setpoint": msg.payload}};
  25. out_2 = {topic: "trigger", reset: true};
  26. }
  27. else if (msg.topic == "boost")
  28. {
  29. if (user_setpoint != undefined)
  30. {
  31. out_1 = {topic: "boost_setpoint", payload: {"current_heating_setpoint": user_setpoint + 5}};
  32. out_2 = {topic: "trigger", payload: null};
  33. out_3 = {topic: "boost_state", payload: true};
  34. }
  35. }
  36. else if (msg.topic == "trigger")
  37. {
  38. out_1 = {topic: "user_setpoint", payload: {"current_heating_setpoint": user_setpoint}};
  39. out_3 = {topic: "boost_state", payload: false};
  40. }
  41. return [out_1, out_2, out_3];