↩ Deze pagina in het Nederlands
ESP32 · HomeWizard · WiFi

Live energy usage on your own display

Waveshare ESP32-S3-Touch-LCD-3.5B showing energy data
Waveshare ESP32-S3-Touch-LCD-3.5B — 3.5" touchscreen with matching plastic enclosure
Waveshare ESP32-S3 1.54 inch LCD showing energy data
Waveshare ESP32-S3 1.54" LCD (240×240) — compact board with a matching white plastic enclosure

Connect a small ESP32 module wirelessly to your smart meter via the HomeWizard P1 meter (and optionally control Energy Sockets) — no cloud, no subscription.

Your smart meter records everything, but shows nothing. This display shows it — live, no subscription. How much does the washing machine use? When are the solar panels injecting, and how much? What is the monthly peak? Optionally, the module switches up to three sockets automatically based on your power surplus.
⚡

Live usage

View your electricity consumption and solar energy generation directly from your digital meter via WiFi.

🔌

Smart sockets

Enable Energy Sockets automatically — if desired — when there is sufficient sunlight, adjustable per second.

🏠

100% local

Works even if HomeWizard's servers or your internet go down — only your home WiFi is needed.

🖥️ What does the screen show?
Display with numbered labels
  1. Socket — name of the socket (see colour legend below)
  2. Projected quarter-hour peak — expected peak if current consumption continues
  3. Current time - yellow = daytime rate, green = nighttime rate
  4. Highest monthly peak — the highest quarter-hour peak recorded this month
  5. Chart area — historical consumption and feed-in over time
  6. Current consumption or surplus — in watts; negative = feeding back to the grid
🎨 Socket colour legend and icons
  • Sockets light blue: active (shows consumption per socket)
  • Sockets dark blue: active but no consumption (e.g. thermostat on device switches off)
  • Sockets grey: socket is off (shows switch-off delay in seconds)
  • Green dots (and green lines): sockets can be switched
  • Lightning icon: yellow = day rate, green = night rate
Lilygo T-Display S3 showing sockets and values
Lilygo T-Display S3 — display layout (all values in Watts)
Lilygo T-Display with P1 data
Lilygo T-Display: at the top sockets, below them the projected quarter-hour peak on the left, time in the middle, highest monthly peak on the right. At the bottom: consumption or production.
Lilygo T-Display showing power graph
T-Display — graph view
Lilygo T-Display S3 showing power graph
T-Display S3 — graph view
🧰 Step 1 — What do you need?
Lilygo T-Display
LilyGo T-Display — small and affordable
Lilygo T-Display S3
LilyGo T-Display S3 — larger screen
Waveshare ESP32-S3 1.54 inch LCD
Waveshare 1.54" — compact, built-in enclosure
Waveshare ESP32-S3-Touch-LCD-3.5
Waveshare 3.5" Touch — largest screen, set up on the screen itself
💡 Check WiFi coverage Make sure your WiFi signal reaches your smart meter (meter cupboard). A repeater can help if the signal is weak.
🌍 Not just the Netherlands and Belgium The HomeWizard P1 Meter works with most modern smart meters across Europe — including in the Netherlands, Belgium, Luxembourg, Sweden, Denmark, Finland, Ireland, and Norway. This sketch only talks to your HomeWizard P1 Meter's local API, so as long as that works for your meter and you enable the local API, this code works wherever the HomeWizard P1 Meter is supported.
HomeWizard P1 meter
HomeWizard P1 meter connected to the smart meter
🔧 Step 2 — Physical installation
  1. Plug the HomeWizard P1 meter into the smart meter and follow HomeWizard's instructions.
  2. (Optional) Plug the HomeWizard Energy Sockets into a wall outlet and follow HomeWizard's instructions.
🔑 Step 3 — Enable the local API

Open the HomeWizard app and go to Settings → Devices → P1 Meter. Enable the local API at the bottom. Without this, the module cannot retrieve data.

(Optional) Repeat this for any sockets you want to switch or monitor with the module.

💾 Step 4 — Put the firmware on the board

First download the correct file for your board:

▸ LilyGo T-Display / T-Display S3 — How do I flash this? (step-by-step)

You need no software — this is done directly from your browser (Chrome, Edge or Opera) using espflash.app.

  1. Open the flash tool in your browser

    Go to espflash.app, connect your board via the USB data cable and click "Connect Device". Select the correct port in the pop-up.

    ESPFlash connect
  2. Choose the firmware file

    Click "Click to upload firmware" and select the .bin file you downloaded above.

    Choose firmware file File selected
  3. Start flashing

    Click "Start Flashing" and wait patiently. Do not disconnect the USB cable during this process (takes a few minutes).

    Flashing in progress
  4. Done!

    You will see "Done!" or "Flash successful". Unplug and reconnect the cable — the board starts up with the new firmware.

    Flash successful
⚠ Troubleshooting
  • No COM port visible? Install the USB driver (CP210x or CH340).
  • Process stalls? Hold the BOOT button while clicking "Program".
  • Still not working? Try a different USB cable or USB port.
▸ Waveshare ESP32-S3 1.54" / 3.5" Touch — How do I flash this? (step-by-step)

The Waveshare ESP32-S3 boards use native USB and work best with esptool-js (also directly in the browser, no installation needed). The steps and settings are identical for the 1.54" and the 3.5" Touch board — just pick the right .bin file for your board.

  1. Open the flash tool

    Go to espressif.github.io/esptool-js in Chrome, Edge or Opera. Connect your Waveshare board via the USB data cable.

  2. Connect to the board

    Click "Connect" and select the correct port in the pop-up (e.g. "USB JTAG/serial debug unit").

  3. Configure the flash settings

    Set the flash address to 0x0 or just zero 0Click "Choose File" and select the AutoSockets_154.ino.merged.bin file (or AutoSockets_S3_35_WaveShare.ino.merged.bin for the 3.5" Touch) you downloaded above.
    If a second file row is visible, click "Remove" to delete it.
    Also set: Flash Mode: keep — Flash Frequency: keep — Flash Size: 16 MB.

  4. Start flashing

    Click "Program" and wait patiently. Do not disconnect the USB cable during this process. You'll still have to wait even after “100%.” Once everything is finished, you'll see another notification, and then you can restart the device.

  5. Done!

    You will see "Leaving... Hash of data verified." at the bottom. Unplug and reconnect the cable — the board starts up with the new firmware.

⚠ Troubleshooting
  • No port visible? Use Chrome, Edge or Opera — Firefox does not support WebSerial.
  • Process stalls? Hold BOOT, briefly press RESET and release BOOT. Then click "Program" again.
  • Still not working? Try a different USB cable or USB port.
🚀 Step 5 — First-time configuration

First-time setup works differently on the Waveshare 3.5" Touch than on the other boards. Open the explanation for your board below.

▸ LilyGo T-Display / T-Display S3 / Waveshare 1.54" — setup via your smartphone

Power on the board by connecting it to a power source. If it cannot connect to WiFi, it opens its own wireless access point (AutoS, no password required).

  1. Turn off mobile data on your smartphone and connect to the AutoS network.
  2. Open your browser at 192.168.4.1.
  3. Enter only your WiFi credentials (SSID and password) — the board will then automatically scan your network for HomeWizard devices, save them, and restart.
✅ Automatic detection If no P1 meter has been configured yet, the board scans the network automatically and stores found devices.
Setup page when no WiFi
Configuration page at 192.168.4.1
Scan in progress Scan results
Setup part 1 Setup part 2
💡 The board saves found devices by hostname automatically when it scans. E.g. p1meter-123abc.local instead of 192.168.1.x. If the IP address ever changes, you won't need to update anything.
Settings saved confirmation
After configuring, you can save a screenshot for future reference
▸ Waveshare 3.5" Touch — setup on the screen itself

This board no longer has a hotspot or a setup page: everything is done on the touchscreen, so you don't need a smartphone or browser. Power on the board; the first start begins with two short questions.

  1. Choose the screen language: Nederlands or English. Then choose the keyboard: QWERTY (Netherlands and most other countries) or AZERTY (Belgium, France). You can change both later in the menu.
  2. Language choice Nederlands or English Keyboard choice AZERTY or QWERTY

    First the language, then the keyboard

  3. In the list Choose a WiFi network, tap your network. The bars show signal strength, a padlock means a password is required. Network not listed? Rescan scans again, Other lets you type the name of a hidden network.
  4. List of WiFi networks
    The network selection, with signal strength and padlock
  5. Type the password on the on-screen keyboard and tap OK. Shift once gives one capital letter, twice quickly locks capitals.
  6. Typing the password on the keyboard
    Typing the password on the QWERTY keyboard; the eye shows or hides the password
  7. The board connects. The WiFi credentials are only saved once the connection succeeds; if the password is wrong, the screen says so and you choose again.
  8. The board then finds your HomeWizard devices by itself (P1 meter and up to three sockets), saves them and restarts.
  9. Scan result with P1 meter and sockets
    The P1 meter (yellow) and sockets that were found, saved by hostname
✅ Automatic detection As on the other boards, found devices are saved by hostname, e.g. p1meter-123abc.local. If the IP address ever changes, you won't need to update anything.
💡 No P1 meter found? Then you choose on the screen: Search (search again), Type IP (type the P1 meter's address yourself) or Network (choose another WiFi network). If you don't tap anything, the board searches again by itself after 5 minutes.
📶 WiFi briefly gone later on? If the board can't find the saved network (e.g. the router starts up more slowly after a power cut), it shows the network selection and tries again by itself after 3 minutes without a touch.
🎬 Demo The network selection on first start also has a Demo button: the screen then shows the normal view with made-up data, handy for showing the board without a P1 meter. Tap the screen to stop the demo.
⚡ Faster than the HomeWizard app The app switches sockets with a minimum delay of 1 minute. This module works per second — useful on cloudy days when sun and cloud alternate rapidly.
🔄 Step 6 — Changing settings later

How you open the settings differs per board. What you can set, and how the switch-on threshold adjusts itself, is the same everywhere.

▸ LilyGo T-Display / T-Display S3 / Waveshare 1.54" — via the setup page

Press the top button for 5 seconds. Turn off mobile data, reconnect to AutoS (no password) and open 192.168.4.1. You can then:

  • Set the switch-off delay per socket and enter the name of the connected device.
  • Set the switch-off threshold (value 0 = requires zero consumption; or higher if e.g. 100W base consumption is acceptable to you).
  • Set the switch-on threshold (recommended starting value: 150W). The module then adjusts it by itself (see below).
  • SSID and password of your WiFi, name or IP of the P1 meter and sockets, and update intervals (in milliseconds).

You can also press and hold the bottom button for 5 seconds to reset all thresholds to 150 W right away.

▸ Waveshare 3.5" Touch — via the on-screen menu

Tap the lightning symbol at the bottom left, next to the large power figure. The Settings menu opens; tap a row to change it. Numbers are entered on a numeric keypad, names and addresses on the keyboard (QWERTY or AZERTY).

  • Socket 1, 2, 3 — per socket: name, auto control on/off, switch-on threshold (recommended starting value: 150 W), switch-off threshold, switch-off delay, address, and Remove socket. An empty slot is filled in with Type address.
  • Auto control — automatic switching by the board on/off.
  • Brightness of the screen.
  • Blink peak warning — the quarter-hour projection blinks when a higher monthly peak can still be avoided.
  • WiFi — choose another network (same network selection as on first start).
  • P1 meter — hostname or IP address of the P1 meter.
  • Find devices — searches for the P1 meter again and fills empty slots with found sockets; existing sockets stay.
  • Info — version, IP address, WiFi signal and uptime.
  • Read P1 meter every … ms and Read sockets every … ms — the update intervals.
  • UDP forwarding and Max. UDP receivers — for the sender/receiver setup.
  • Language — a tap switches between English and Nederlands; the menu changes right away.
  • Keyboard — QWERTY or AZERTY.
  • Factory reset — erases WiFi, P1 meter, sockets, thresholds, intervals, language and keyboard; the first-start questions then follow again.
✅ Effective immediately Changes take effect right away. Only a new address or another WiFi network needs a restart, and the board does that itself. The menu closes by itself after 60 seconds without a touch. Meanwhile, measuring and automatic switching simply carry on.

Also on the screen and with the BOOT button:

  • Tap a socket: on → off, off → on (only when the socket is reachable). The border briefly turns yellow. Auto control then leaves that socket alone for 10 seconds.
  • BOOT short: show uptime and switch-on thresholds for 5 seconds.
  • BOOT double click: automatic switching on/off (saved).
  • BOOT long (5 s): clear WiFi credentials; the board restarts into the network selection. Language and keyboard are kept.

There is no separate button to reset all thresholds to 150 W: change the switch-on threshold per socket in the menu.

Self-learning switch-on threshold (all boards)

After setup, the module adjusts the switch-on threshold by itself, both upward and downward:

  • Up: if the device draws more than the threshold, the threshold moves to 102% of the measured power. If the module has to switch a socket off again shortly after switching it on because the surplus isn't enough, it learns right away what the device needs — even with a short switch-off delay of a few seconds.
  • Down: if you connect a lighter device, switch it on by hand once (button on the socket, HomeWizard app, or on the 3.5" Touch a tap on the socket on screen). The module leaves it on for at most 15 seconds, even without surplus, and measures the power. If that is below 95% of the threshold, the threshold drops to that power. When the module switches the socket on itself, it also decides within 15 seconds.
  • Forget: if the socket hasn't been on for a week with a power close to the threshold, the threshold is halved (never below 150 W). That way a lighter device gets a chance again on its own, even if nobody switches it on by hand.
🔘 Button overview

LilyGo T-Display & T-Display S3

Two buttons. A short press on the bottom button also displays the full button overview directly on the screen for 8 seconds, with a countdown in the bottom right.

Button hints on the LilyGo T-Display
Button hints on the LilyGo T-Display — shown after a short press on the bottom button
Button Action Function
Top button (FLASH / BOOT)
▲ Top Long (5 sec) Clear WiFi credentials and restart. The board opens its own access point (name: AutoS) so you can enter new credentials via 192.168.4.1.
▲ Top Short Toggle monthly peak display on/off. Also shows uptime and the current switch-on threshold per socket for 5 seconds.
▲ Top Double click Rotate display 180° — useful when the USB connector is on the other side. Note: after rotating, top and bottom buttons swap positions in this table.
Bottom button
▼ Bottom Long (5 sec) Reset all switch-on thresholds to 150 W. The display briefly confirms with a message. Rarely needed now: the thresholds adjust by themselves, downward too (see step 6). This just does it instantly.
▼ Bottom Short Shows the button overview on the display for 8 seconds, with an arrow pointing at the button concerned and the corresponding actions in colour (orange = long press, green = short press, cyan = double click). A countdown runs in the bottom right.
▼ Bottom Double click Switch display mode: sockets + peaks → 3-hour chart → 6-hour chart → 12-hour chart → 24-hour chart → quarter-hour projection → back to sockets. On the T-Display S3 the cycle runs through the same steps without the separate quarter-hour projection. The selection is saved and persists after a restart.

Waveshare ESP32-S3 1.54″

Three buttons. A short press on the middle button (PWR) displays the button overview on the screen for 8 seconds, with a countdown on the right.

Button hints on the Waveshare 1.54"
Button hints on the Waveshare ESP32-S3 1.54″ — shown after a short press on the PWR button
Button Action Function
Top button (FLASH / BOOT)
▲ Top Long (5 sec) Clear WiFi credentials and restart. The board opens its own access point (name: AutoS) so you can enter new credentials via 192.168.4.1.
▲ Top Short Shows uptime and the current switch-on threshold per socket for 5 seconds.
▲ Top Double click Rotate display 180° — useful when the USB connector is on the other side. Note: after rotating, top and bottom buttons swap positions in this table.
Middle button (PWR)
⏻ PWR Long (5 sec) Toggle automatic socket switching on/off. The current status is shown as a coloured line at the top of the display (green = enabled). On the TTGO and T-Display S3 this setting can only be changed via the web page.
⏻ PWR Short Shows the button overview on the display for 8 seconds, with an arrow pointing at the button concerned and the corresponding actions in colour (orange = long press, green = short press, cyan = double click). A countdown runs on the right.
⏻ PWR Double click Shows the chart of the last hour for 8 seconds, after which the display returns to the previous view. This 1-hour window is not part of the regular chart cycle.
Bottom button (KEY)
▼ Bottom Long (5 sec) Reset all switch-on thresholds to 150 W. The display briefly confirms with a message.
▼ Bottom Short Switch display mode: sockets + peaks → 3-hour chart → 6-hour chart → 12-hour chart → 24-hour chart → back to sockets.
▼ Bottom Double click Toggle the monthly peak display on/off. When enabled, the forward-looking quarter-hour projection appears on the left and the highest quarter-hour value of the month on the right.
🛡️ Technical — Built-in safety mechanisms & nerd stuff
  • 📡 No connection to the P1 meter? All sockets (controlled by this module) switch off automatically.
  • 🔎 Wrong device at an address, e.g. after a network glitch? The board checks every address first (type and serial number) and shows an error, never another device's values.
  • ⚠️ Invalid sensor data? Socket stays off until valid data is available again.
  • 🔋 Consumption too high? Lowest-priority sockets are switched off first.
  • ☁️ Not enough solar? Sockets stay off until the surplus rises above the threshold again.
  • 📡 Please note: if your local WiFi suddenly goes down completely, sockets that are currently on cannot be turned off by the device. Be aware that such outages may occur; the author of this page is not responsible for unexpected power consumption in this case.
  • 💡
    Power consumption of the board itself:
    • Waveshare 0.76 W
    • LilyGo T-Display 0.92 W
    • LilyGo T-Display S3 0.95 W
⚙️ Technical LilyGO modules run on the powerful ESP32 chip and operate on standard 5V via USB‑C. No computer required after flashing — they work fully stand‑alone. Thanks to FreeRTOS, network scanning and socket polling run in parallel, delivering fast and rock‑solid performance.
🏠 Several displays in one home? Every module queries the P1‑meter itself with an HTTP GET. One such round trip — request plus response — takes a few tens of milliseconds. The more modules you run in a single home, the greater the chance they get in each other's way at the meter. You notice this as a board that occasionally skips a reading or briefly shows Conn ERR. That is why there is also a sender/receiver setup: only the LilyGo T‑Display S3 queries the P1‑meter and the sockets, and forwards everything that belongs on screen to the other boards. Those only receive and display — they do not scan, they do not switch anything, and there is nothing to configure. Forwarding uses one small UDP packet of just over 200 bytes per second, sent straight to the boards that registered. Other devices in the house never see it. Want to know more? Click Client-Server.
🤓 Nerd stuff:
  • Written in modern C++ and optimized with FreeRTOS tasks for maximum speed and responsiveness.
  • Scanning the network for sockets and the P1 meter (first use) is blazing fast (1 ~ 3 seconds): a single mDNS query returns every HomeWizard device at once, after which only those addresses are queried for their type and serial number. If your router blocks multicast, the board falls back to a parallel scan of all 254 addresses.
  • The hostnames of the sockets and the P1 meter are resolved to their IP address once and then reused, so no time is lost on name resolution while polling (every 1 ~ 3 seconds). A new lookup only happens after a failed poll — that way a DHCP address change is picked up automatically.
  • Every socket has its own network connection: they are polled truly in parallel, and one slow or absent device never blocks the others.
  • The priority‑driven switching logic ensures smart, predictable and stable control.
  • The off‑delay doubles as the priority ranking: the longest delay marks the most important device — first on, last off. One setting doing two jobs.
  • When solar production increases gradually (sunrise, cloud moves away), the socket with the lowest switch‑on threshold comes on first — in practice the lowest‑power consumer, because that threshold calibrates itself to 102% of the measured power.
  • Self-learning switch‑on threshold: the threshold follows the device that is connected now, not the heaviest one ever.
    • Up: when the power is above the threshold for two readings in a row. The first 3 seconds don't count (inrush current).
    • Failed switch‑on: if the board has to switch a socket off again within 15 seconds, the threshold was too low. The measured power becomes the new threshold.
    • No endless toggling: if the reading doesn't explain it (e.g. a device that starts up slowly) and it happens again within 10 minutes, the threshold goes above the surplus that was available at switch‑on.
    • Quick reading: after 1.5 seconds the board asks the socket for its power. It only switches off once that reading is in (5 seconds at most).
    • Why measure at the socket? The P1 meter sees the whole house. If something else switches on at the same time, the reading is wrong.
    • Down: when the power stays below 95% of the threshold. The board decides within 15 seconds of switching on, automatically or by hand.
    • Standby: below 50 W (thermostat off) the board learns nothing.
    • Forget: not confirmed for a week? The threshold is halved, never below 150 W. This survives a restart.
    • Never changed: a threshold of 0 (never switch on) or above 6000 W.
  • When there's a sudden surplus, the socket with the longest off‑delay gets priority.
  • At most one socket is switched per cycle, and switching off always takes precedence over switching on. Consecutive switch‑ons are at least ten seconds apart: no simultaneous inrush currents, no oscillation.
  • Decisions run on a rolling average of five readings rather than the instantaneous value. Switching off additionally requires both the average and the instantaneous value to exceed the threshold — so a single kettle spike never turns anything off.
  • If two sockets share the same off‑delay, a round‑robin breaks the tie, spreading the wear across both.
  • Manual control via the HomeWizard app, curl or the physical button is always possible — the board polls the real state and continues without any hiccups.
  • If you manually turn on a socket while there isn't enough surplus, the board switches it off again — after at most 15 seconds, so the switch‑on threshold can be learned first. A socket that is on but draws nothing is switched off too — but only after the actual consumers have had their turn, since switching those off is what really lowers the draw.