summaryrefslogtreecommitdiff
path: root/README.md
blob: 3f405cd8e58ab3f0cc43a1fb3d760ac5e1493341 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# hello-t-energy-s3

T-Energy-S3 MQTT battery monitor. Connects to WiFi and publishes battery voltage over MQTT/TLS.

## Setup (one-time)

```bash
# Add ESP32 board manager
arduino-cli config init
arduino-cli config add board_manager.additional_urls https://espressif.github.io/arduino-esp32/package_esp32_index.json

# Install ESP32 core
arduino-cli core update-index
arduino-cli core install esp32:esp32

# Install PubSubClient library
arduino-cli lib install "PubSubClient"
```

## Configuration

Copy `config.example.h` to `config.h` and fill in your values:

```bash
cp config.example.h config.h
```

Then edit `config.h` with your WiFi and MQTT settings.

## Build & Upload

```bash
make compile    # compile only
make upload     # upload only
make monitor    # serial monitor
make flash      # compile + upload
make all        # compile + upload + monitor
```

If your port differs from `/dev/ttyACM0`, override it:

```bash
make flash PORT=/dev/ttyUSB0
```

## Expected Output

```
=== T-Energy-S3 MQTT Monitor ===

MAC Address: AA:BB:CC:DD:EE:FF
Scanning WiFi...
Found 5 networks:
  1: MyNetwork (-45 dBm)
  ...

Connecting to MyNetwork...
Connected! IP: 192.168.1.100
Connecting to MQTT mqtt.example.com:8883...
MQTT connected!
Battery: 4200 mV
Published to my/topic: 4200
...
```