summaryrefslogtreecommitdiff
path: root/README.md
blob: 01d2c858d8cbf2025e674909dba1d5d764083f1b (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
# Find your port
arduino-cli board list

# Compile
arduino-cli compile --fqbn "esp32:esp32:esp32s3:CDCOnBoot=cdc,FlashSize=16M,PSRAM=opi" .

# Upload (replace /dev/ttyACM0 with your port)
arduino-cli upload --fqbn "esp32:esp32:esp32s3:CDCOnBoot=cdc,FlashSize=16M,PSRAM=opi" --port /dev/ttyACM0 .

# Monitor
arduino-cli monitor --port /dev/ttyACM0 --config baudrate=115200
```

## 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
...
```