How babars98/smarthome works
SmartHome is a Python smart-home backend with client-side light and temperature monitoring and server-side schedule decisions. Each client samples its sensor, checks readings, sends qualifying readings and timestamps over TCP, and applies the server’s response to a GPIO-controlled light or fan. The server routes readings by sensor identifier and queries an external API for the decision. The tree also includes Blynk-related server code, but the sampled files do not establish how it is wired into the main workflow.
Main entry points: temprature_sensor_client.py Temperature client · light_sensor_client.py Light client · server_socket.py Server TCP socket · client_socket.py Client TCP socket
Components 19
Sensor clients
- Light client
src/client/light_sensor_client.py - Temperature client
src/client/temprature_sensor_client.py - DHT20 driver
src/client/DHT20.py - Light logic
src/client/light_businesslogic.py - Temperature logic
src/client/temp_businesslogic.py - GPIO control
src/client/gpio.py - Client TCP socket
src/client/client_socket.py - Client config
src/client/config.py
TCP server
- Server TCP socket
src/server/server_socket.py - Server config
src/server/config.py
Schedule decisions
- Light handler
src/server/light_sensor.py - Temperature handler
src/server/temp_sensor.py
External integrations
- HTTP API handler
src/server/api_handler.py - Blynk API module
src/server/blynk_api.py - Blynk protocol
src/server/blynk_lib.py
Other components
- Light sensor device
- Temperature sensor device
- Schedule API
- Blynk Cloud
Connections 23
- Light sensor device → Light client: sensor input
- Light client → Light logic: checks level
- Light client → Client TCP socket: sends reading
- Light client → GPIO control: reads pin
- Light client → Client config: reads settings
- Light logic → GPIO control: sets output
- Temperature sensor device → DHT20 driver: sensor input
- Temperature client → DHT20 driver: reads measurement
- Temperature client → Temperature logic: checks level
- Temperature client → Client TCP socket: sends reading
- Temperature client → GPIO control: actuator path
- Temperature logic → GPIO control: sets output
- Temperature client → Client config: reads settings
- Client TCP socket → Server TCP socket: TCP reading
- Server TCP socket → Server config: reads settings
- Server TCP socket → Light handler: dispatches light
- Server TCP socket → Temperature handler: dispatches temperature
- Light handler → HTTP API handler: requests decision
- Temperature handler → HTTP API handler: requests decision
- HTTP API handler → Schedule API: HTTP request
- Schedule API → HTTP API handler: decision response
- Server TCP socket → Client TCP socket: TCP response
- Blynk protocol → Blynk Cloud: connects