Home / Projects / Power station to Home Assistant

Get your AFERIY or FOSSiBOT power station into Home Assistant with an ESP32

My AFERIY P210 power station only talked to its phone app, so Home Assistant had to guess how full it was, and the guesses drifted. A cheap ESP32 sitting next to it now reads the battery's own figures over Bluetooth and hands them to Home Assistant. There's no wiring at all: you flash the board and plug it into a USB charger.

Parts
About £5 to £10
Skill
Beginner
Time
About an hour
Needs
A BrightEMS-app power station

What you get

In Home Assistant you get the real state of charge from the battery's own management system, input and output power, and time remaining. You also get switches for the AC, DC, USB and light outputs, and controls for the maximum charge and minimum discharge levels. Your automations can work from true figures instead of estimates.

It works with power stations that use the BrightEMS app. The project lists the AFERIY P210 and P310, FOSSiBOT F2400 and F3600 Pro, and SYDPOWER N052 and N066. I built it for an AFERIY P210.

The software is the free ESP-FBot component for ESPHome by Ylianst (Apache 2.0 licence). This page is my build of it.

No wiring, and don't open the battery. The ESP32 talks to the power station by Bluetooth. There is no reason to open a power station, and the high-power parts inside are dangerous.

Parts list

PartWhy you need it
ESP32-WROOM-32 development boardThe classic ESP32 with both Wi-Fi and Bluetooth. Avoid the C3, C6 and H2 versions for this.Check price
Micro-USB data cable and USB plugPowers the board and flashes it the first time. A charge-only cable will not work.Check price
AFERIY P210 power stationIf you don't have one yet. Any BrightEMS-app model on the list above should work.Check price

ESP32 boards often come in packs of three, which leaves spares for the Bluetooth proxy project.

Wiring

None. Place the ESP32 within Bluetooth range of the power station (roughly 3 to 10 metres, closer is better) and somewhere with good Wi-Fi, then power it from any USB plug.

Setting it up

  1. In Home Assistant, install the ESPHome add-on if you haven't already.
  2. Find the power station's Bluetooth address. Use a Bluetooth scanner app on your phone and look for a device whose name starts with FOSSIBOT or POWER. The address looks like A1:B2:C3:D4:E5:F6.
  3. In ESPHome, create a new ESP32 device and replace its settings with the example from the ESP-FBot project, putting in your Bluetooth address. The key parts are shown below.
  4. Flash the board over USB the first time. Home Assistant will find it, and the battery sensors and switches appear.
esp32:
  board: esp32dev
  framework:
    type: esp-idf

external_components:
  - source: github://ylianst/esp-fbot

ble_client:
  - mac_address: "A1:B2:C3:D4:E5:F6"   # your power station

fbot:
  id: my_fbot
  polling_interval: 5s

sensor:
  - platform: fbot
    fbot_id: my_fbot
    battery_level:
      name: "SOC"
    input_power:
      name: "Input Power"
    output_power:
      name: "Output Power"

switch:
  - platform: fbot
    fbot_id: my_fbot
    ac:
      name: "AC Inverter"

Shortened for reading. Use the full example in the project, which adds Wi-Fi, the API key and the other sensors.

What I learned building it

The battery's own Wi-Fi doesn't matter

The Wi-Fi on my P210 had stopped working, which turned out not to matter. The battery only needs Bluetooth; the ESP32 provides the Wi-Fi link to Home Assistant.

Use the classic ESP32

Buy an ESP32-WROOM-32 board. Some newer ESP32 chips have no Wi-Fi or a different Bluetooth setup, and the project is written for the classic one.

Include the switch section

My first build would not compile until the switch: section was in the config. Even if you only want readings, include it.

Use the esp-idf framework

Set the framework to esp-idf as in the example. It is lighter on memory and recommended for Bluetooth on the ESP32.

Check it before you trust it

Watch the readings for a few days next to the battery's own display or app before you let automations depend on them.

Please read before you build. This page is for educational purposes and shares a hobby project I built for my own home. You build and use it at your own risk. It is not made, supported or endorsed by AFERIY, FOSSiBOT or SYDPOWER, whose names are used only to say which products it works with. Adding home-made equipment may affect a product's warranty, so check with the manufacturer if that matters to you. The boards run on low-voltage USB power and nothing here involves mains wiring. Gadgets Galore accepts no responsibility for damage, loss or injury from following this guide.

Common questions

Do I need to connect the power station to Wi-Fi?

No. The ESP32 talks to it by Bluetooth and provides the Wi-Fi link itself.

Which power stations does it work with?

Those that use the BrightEMS app. The project lists the AFERIY P210 and P310, FOSSiBOT F2400 and F3600 Pro, and SYDPOWER N052 and N066.

Can I switch the outputs from Home Assistant?

Yes. You get switches for the AC inverter, DC, USB and light, plus charge and discharge limits.

Is it made by AFERIY or FOSSiBOT?

No. It is an independent hobby project using free open-source software.

Choosing a power station? See our portable power station guide.

More projects