Smart-Home am Beispiel der Präsenzerkennung im Raum Projektarbeit Lennart Heimbs, Johannes Krug, Sebastian Dohle und Kevin Holzschuh bei Prof. Oliver Hofmann SS2019
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.

sensor2_l-output.js 1.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. var newMsg;
  2. if(Array.isArray(msg.payload))
  3. {
  4. if(msg.payload[0].topic === "UltraschallSensor_Output" /* && msg.payload[1].topic === "DoorSensor" */)
  5. {
  6. if(msg.payload[0].state === true /* && msg.payload[1].state === true */)
  7. {
  8. newMsg = { topic: "Output",
  9. val: 1,
  10. state: true }
  11. return newMsg;
  12. } else {
  13. newMsg = { topic: "Output",
  14. val: 0,
  15. state: false }
  16. return 0;
  17. }
  18. } else if(msg.payload[1].topic === "UltraschallSensor_Output" /* && msg.payload[1].topic === "DoorSensor" */)
  19. {
  20. if(msg.payload[0].state === true /* && msg.payload[1].state === true */)
  21. {
  22. newMsg = { topic: "Output",
  23. val: 1,
  24. state: true }
  25. return newMsg;
  26. } else {
  27. newMsg = { topic: "Output",
  28. val: 0,
  29. state: false }
  30. return 0;
  31. }
  32. } else {
  33. newMsg = { topic: "Output", val: 0, state: false }
  34. return 0;
  35. }
  36. }