How iot-projects/iot-home-temp-tracking works
Main Components
• ESP8266 Device: This is the hardware component that measures temperature using the DHT22 sensor. It sends a GET request with the measurement data.
• Central Server (API): The server side includes PHP files (api.php in both the root and “src” directories) that handle the incoming GET requests from the sensors. The README also mentions the use of PHP and SQLite for storing the data.
• Web Application Frontend:
• The “src” folder contains HTML (index.html, setup.html), JavaScript (including get-temp.js, main.js, and React components in the “src/react” folder) and style files (LESS and SCSS).
• The “dist” folder is the built output (compiled HTML, CSS, and JavaScript).
• External Service Integration: The README suggests integrating with openweathermap.org to fetch local weather data, which can be shown as an additional data source or external dependency.
Understand the Flow and Relationships
• Backend Data Processing: Illustrate how the API (PHP scripts) receives the data and then (presumably) writes it to a database (e.g., SQLite) even if the database isn’t explicitly seen in the file tree; it’s mentioned in the README.
Architectural Patterns and Design Principles
• Separation of Concerns: Distinguish clearly between hardware (ESP8266), backend (PHP API server), and the frontend (React and traditional JavaScript UI).
• Build Process: Indicate the transformation from the “src” directory to the “dist” distribution directory via build tools (grunt, as indicated by gruntfile.js, and package.json). This shows the build/deployment pipeline.
• Modularity: Point out how the code is organized (e.g., separating React components, libraries under src/js/lib, and style components in src/less and src/scss), emphasizing extensibility and clarity.