# eshaalk505/smart-meter-application architecture

> Architecture diagram of the GitHub repository eshaalk505/smart-meter-application, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-10). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/eshaalk505/smart-meter-application
- Repository: https://github.com/eshaalk505/smart-meter-application

## Overview

The product is a desktop smart-meter application: a user opens the PyQt dashboard, whose worker checks grid availability, connects and authenticates to the server, then sends generated consumption readings while the dashboard displays usage, cost, connection status and monthly-bill data. The server accepts concurrent socket clients, authenticates them and serves stored bill data while receiving readings. The README also documents key generation and YAML grid control. Relationships below follow excerpts or explicit README statements; some client receive/display details are only partially sampled.

Main entry points: [`client/socketClient.py`](https://github.com/eshaalk505/smart-meter-application/blob/main/client/socketClient.py) (Client worker), [`server/socketServer.py`](https://github.com/eshaalk505/smart-meter-application/blob/main/server/socketServer.py) (Client handler), [`client/main.py`](https://github.com/eshaalk505/smart-meter-application/blob/main/client/main.py) (Dashboard app), [`Generate_Keys.py`](https://github.com/eshaalk505/smart-meter-application/blob/main/Generate_Keys.py) (Key generation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_dashboard["Dashboard"]
  node_app["Dashboard app<br/>[main.py]"]
  node_gui["Dashboard UI"]
end

subgraph group_client_runtime["Client runtime"]
  node_worker["Client worker<br/>[socketClient.py]"]
  node_readings["Reading generator<br/>[socketClient.py]"]
  node_client_auth["Client authentication<br/>[socketClient.py]"]
  node_client_log["Client logging<br/>[loggingConfig.py]"]
end

subgraph group_server_runtime["Server runtime"]
  node_server["Socket server<br/>[socketServer.py]"]
  node_handler["Client handler<br/>[socketServer.py]"]
  node_server_auth["Server authentication<br/>[socketServer.py]"]
  node_server_log["Server logging<br/>[loggingConfig.py]"]
end

subgraph group_configuration_data["Configuration and data"]
  node_grid_config["Grid setting<br/>[config.yaml]"]
  node_bill_data[("Monthly bills")]
  node_keygen["Key generation<br/>[Generate_Keys.py]"]
  node_client_key["Client public key"]
  node_server_key["Server private key"]
end

node_user(("Resident"))

node_user -->|"opens"| node_app
node_app -->|"sets up"| node_gui
node_app -->|"starts"| node_worker
node_worker -->|"emits updates"| node_gui
node_worker -->|"reads setting"| node_grid_config
node_worker -->|"authenticates"| node_client_auth
node_client_auth -->|"loads key"| node_client_key
node_worker -->|"generates"| node_readings
node_readings -->|"sends readings"| node_server
node_worker -->|"connects socket"| node_server
node_server -->|"dispatches clients"| node_handler
node_handler -->|"authenticates"| node_server_auth
node_server_auth -->|"loads key"| node_server_key
node_handler -->|"reads bills"| node_bill_data
node_handler -->|"sends bill data"| node_worker
node_readings -->|"logs errors"| node_client_log
node_handler -->|"logs errors"| node_server_log
node_keygen -->|"creates keypair"| node_client_key
node_keygen -->|"creates keypair"| node_server_key

click node_app "https://github.com/eshaalk505/smart-meter-application/blob/main/client/main.py"
click node_gui "https://github.com/eshaalk505/smart-meter-application/blob/main/client/smartMeterApplicationGUI.py"
click node_worker "https://github.com/eshaalk505/smart-meter-application/blob/main/client/socketClient.py"
click node_readings "https://github.com/eshaalk505/smart-meter-application/blob/main/client/socketClient.py"
click node_client_auth "https://github.com/eshaalk505/smart-meter-application/blob/main/client/socketClient.py"
click node_client_log "https://github.com/eshaalk505/smart-meter-application/blob/main/client/loggingConfig.py"
click node_server "https://github.com/eshaalk505/smart-meter-application/blob/main/server/socketServer.py"
click node_handler "https://github.com/eshaalk505/smart-meter-application/blob/main/server/socketServer.py"
click node_server_auth "https://github.com/eshaalk505/smart-meter-application/blob/main/server/socketServer.py"
click node_server_log "https://github.com/eshaalk505/smart-meter-application/blob/main/server/loggingConfig.py"
click node_grid_config "https://github.com/eshaalk505/smart-meter-application/blob/main/client/config.yaml"
click node_bill_data "https://github.com/eshaalk505/smart-meter-application/blob/main/server/Previous_Months_Bills.json"
click node_keygen "https://github.com/eshaalk505/smart-meter-application/blob/main/Generate_Keys.py"
click node_client_key "https://github.com/eshaalk505/smart-meter-application/blob/main/client/server_public_key.pem"
click node_server_key "https://github.com/eshaalk505/smart-meter-application/blob/main/server/server_private_key.pem"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_app,node_gui toneBlue
class node_worker,node_readings,node_client_auth,node_client_log toneAmber
class node_server,node_handler,node_server_auth,node_server_log toneMint
class node_grid_config,node_bill_data,node_keygen,node_client_key,node_server_key toneRose
class node_user toneIndigo
```

## Components

### Dashboard

- [Dashboard app](https://github.com/eshaalk505/smart-meter-application/blob/main/client/main.py): `client/main.py`
- [Dashboard UI](https://github.com/eshaalk505/smart-meter-application/blob/main/client/smartMeterApplicationGUI.py): `client/smartMeterApplicationGUI.py`

### Client runtime

- [Client worker](https://github.com/eshaalk505/smart-meter-application/blob/main/client/socketClient.py): `client/socketClient.py`
- [Reading generator](https://github.com/eshaalk505/smart-meter-application/blob/main/client/socketClient.py): `client/socketClient.py`
- [Client authentication](https://github.com/eshaalk505/smart-meter-application/blob/main/client/socketClient.py): `client/socketClient.py`
- [Client logging](https://github.com/eshaalk505/smart-meter-application/blob/main/client/loggingConfig.py): `client/loggingConfig.py`

### Server runtime

- [Socket server](https://github.com/eshaalk505/smart-meter-application/blob/main/server/socketServer.py): `server/socketServer.py`
- [Client handler](https://github.com/eshaalk505/smart-meter-application/blob/main/server/socketServer.py): `server/socketServer.py`
- [Server authentication](https://github.com/eshaalk505/smart-meter-application/blob/main/server/socketServer.py): `server/socketServer.py`
- [Server logging](https://github.com/eshaalk505/smart-meter-application/blob/main/server/loggingConfig.py): `server/loggingConfig.py`

### Configuration and data

- [Grid setting](https://github.com/eshaalk505/smart-meter-application/blob/main/client/config.yaml): `client/config.yaml`
- [Monthly bills](https://github.com/eshaalk505/smart-meter-application/blob/main/server/Previous_Months_Bills.json): `server/Previous_Months_Bills.json`
- [Key generation](https://github.com/eshaalk505/smart-meter-application/blob/main/Generate_Keys.py): `Generate_Keys.py`
- [Client public key](https://github.com/eshaalk505/smart-meter-application/blob/main/client/server_public_key.pem): `client/server_public_key.pem`
- [Server private key](https://github.com/eshaalk505/smart-meter-application/blob/main/server/server_private_key.pem): `server/server_private_key.pem`

### Other components

- **Resident**

## Connections

- Resident → Dashboard app: opens (evidence: `README.md`)
- Dashboard app → Dashboard UI: sets up (evidence: `client/main.py`)
- Dashboard app → Client worker: starts (evidence: `client/main.py`)
- Client worker → Dashboard UI: emits updates (evidence: `client/main.py`)
- Client worker → Grid setting: reads setting (evidence: `client/socketClient.py`)
- Client worker → Client authentication: authenticates (evidence: `client/socketClient.py`)
- Client authentication → Client public key: loads key (evidence: `README.md`)
- Client worker → Reading generator: generates (evidence: `client/socketClient.py`)
- Reading generator → Socket server: sends readings (evidence: `client/socketClient.py`)
- Client worker → Socket server: connects socket (evidence: `client/socketClient.py`)
- Socket server → Client handler: dispatches clients (evidence: `server/socketServer.py`)
- Client handler → Server authentication: authenticates (evidence: `server/socketServer.py`)
- Server authentication → Server private key: loads key (evidence: `server/socketServer.py`)
- Client handler → Monthly bills: reads bills (evidence: `server/socketServer.py`)
- Client handler → Client worker: sends bill data (evidence: `server/socketServer.py`)
- Reading generator → Client logging: logs errors (evidence: `client/socketClient.py`)
- Client handler → Server logging: logs errors (evidence: `server/socketServer.py`)
- Key generation → Client public key: creates keypair (evidence: `README.md`)
- Key generation → Server private key: creates keypair (evidence: `README.md`)
