Software zum Installieren eines Smart-Mirror Frameworks , zum Nutzen von hochschulrelevanten Informationen, auf einem Raspberry-Pi.
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.

weather_forecast.js 3.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. const _ = require("lodash");
  2. /**
  3. * @param {object} extendedData extra data to add to the default mock data
  4. * @returns {string} mocked forecast weather data
  5. */
  6. function generateWeatherForecast(extendedData = {}) {
  7. return JSON.stringify(
  8. _.merge(
  9. {},
  10. {
  11. city: {
  12. id: 2867714,
  13. name: "Munich",
  14. coord: { lon: 11.5754, lat: 48.1371 },
  15. country: "DE",
  16. population: 1260391,
  17. timezone: 7200
  18. },
  19. cod: "200",
  20. message: 0.9653487,
  21. cnt: 7,
  22. list: [
  23. {
  24. dt: 1568372400,
  25. sunrise: 1568350044,
  26. sunset: 1568395948,
  27. temp: { day: 24.44, min: 15.35, max: 24.44, night: 15.35, eve: 18, morn: 23.03 },
  28. pressure: 1031.65,
  29. humidity: 70,
  30. weather: [{ id: 801, main: "Clouds", description: "few clouds", icon: "02d" }],
  31. speed: 3.35,
  32. deg: 314,
  33. clouds: 21
  34. },
  35. {
  36. dt: 1568458800,
  37. sunrise: 1568436525,
  38. sunset: 1568482223,
  39. temp: { day: 20.81, min: 13.56, max: 21.02, night: 13.56, eve: 16.6, morn: 15.88 },
  40. pressure: 1028.81,
  41. humidity: 72,
  42. weather: [{ id: 500, main: "Rain", description: "light rain", icon: "10d" }],
  43. speed: 2.21,
  44. deg: 81,
  45. clouds: 100
  46. },
  47. {
  48. dt: 1568545200,
  49. sunrise: 1568523007,
  50. sunset: 1568568497,
  51. temp: { day: 22.65, min: 13.76, max: 22.88, night: 15.27, eve: 17.45, morn: 13.76 },
  52. pressure: 1023.75,
  53. humidity: 64,
  54. weather: [{ id: 800, main: "Clear", description: "sky is clear", icon: "01d" }],
  55. speed: 1.15,
  56. deg: 7,
  57. clouds: 0
  58. },
  59. {
  60. dt: 1568631600,
  61. sunrise: 1568609489,
  62. sunset: 1568654771,
  63. temp: { day: 23.45, min: 13.95, max: 23.45, night: 13.95, eve: 17.75, morn: 15.21 },
  64. pressure: 1020.41,
  65. humidity: 64,
  66. weather: [{ id: 800, main: "Clear", description: "sky is clear", icon: "01d" }],
  67. speed: 3.07,
  68. deg: 298,
  69. clouds: 7
  70. },
  71. {
  72. dt: 1568718000,
  73. sunrise: 1568695970,
  74. sunset: 1568741045,
  75. temp: { day: 20.55, min: 10.95, max: 20.55, night: 10.95, eve: 14.82, morn: 13.24 },
  76. pressure: 1019.4,
  77. humidity: 66,
  78. weather: [{ id: 800, main: "Clear", description: "sky is clear", icon: "01d" }],
  79. speed: 2.8,
  80. deg: 333,
  81. clouds: 2
  82. },
  83. {
  84. dt: 1568804400,
  85. sunrise: 1568782452,
  86. sunset: 1568827319,
  87. temp: { day: 18.15, min: 7.75, max: 18.15, night: 7.75, eve: 12.45, morn: 9.41 },
  88. pressure: 1017.56,
  89. humidity: 52,
  90. weather: [{ id: 800, main: "Clear", description: "sky is clear", icon: "01d" }],
  91. speed: 2.92,
  92. deg: 34,
  93. clouds: 0
  94. },
  95. {
  96. dt: 1568890800,
  97. sunrise: 1568868934,
  98. sunset: 1568913593,
  99. temp: { day: 14.85, min: 5.56, max: 15.05, night: 5.56, eve: 9.56, morn: 6.25 },
  100. pressure: 1022.7,
  101. humidity: 59,
  102. weather: [{ id: 800, main: "Clear", description: "sky is clear", icon: "01d" }],
  103. speed: 2.89,
  104. deg: 51,
  105. clouds: 1
  106. }
  107. ]
  108. },
  109. extendedData
  110. )
  111. );
  112. }
  113. module.exports = generateWeatherForecast;