ESP32 WROOM - ANKER 767 F2000 (None Wifi version)

I’m using my battery to power my home office setup, but I keep running into the same issue - I never know when it’s about to die unless I constantly check the app/front of the device. It’s really annoying losing power because I didn’t realise the battery was draining so fast.

I needed a way to see exactly how much power is left to create an automation if its running low up until the overnight charge kicks in.

Using data from a post over on reddit to get id’s

Reddit Post

Ive managed to hack together a working YAML script to open the F2000 up to Home Assistant via ESP32 WROOM device + Nice of Anker to supply a USB socket to self power the device :wink:

Getting my MAC is a challenge I found it using one of the android Bluetooth Scanners as I couldn’t find it using Nrf Connector

The YAML

Create a new device in ESPHOME and that will generate the upper section needed then paste the code after ‘captive_portal:’ (this also will allow you to rename the device in your setup)

esphome:
  name: esp32-anker
  friendly_name: ESP32 ANKER

esp32:
  board: esp32dev
  framework:
    type: arduino

logger:

api:
  # Letting ESPHome auto-generate the encryption key


ota:
  - platform: esphome  # <-- Fix: Added platform
    password: "Paste In Your Password"

wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password
  ap:
    ssid: "Esp32-Anker Fallback Hotspot"
    password: "Paste in Your Password"

captive_portal:

# Bluetooth Client - The only part you need to modify 
ble_client:
  - mac_address: # Put Your Devices MAC address here
    id: solix_ble

sensor:
  # Time remaining
  - platform: ble_client
    ble_client_id: solix_ble
    type: characteristic
    name: "Anker Hours Remaining"
    service_uuid: '014BF5DA-0000-1000-8000-00805F9B34FB'
    characteristic_uuid: '8888'
    id: hours_remaining
    unit_of_measurement: "h"
    accuracy_decimals: 1
    lambda: |-
      if (x.size() > 17) {
        return static_cast<float>(x[17]) / 10.0;
      }
      return NAN;

  - platform: ble_client
    ble_client_id: solix_ble
    type: characteristic
    name: "Anker Days Remaining"
    service_uuid: '014BF5DA-0000-1000-8000-00805F9B34FB'
    characteristic_uuid: '8888'
    id: days_remaining
    unit_of_measurement: "days"
    lambda: |-
      if (x.size() > 18) {
        return static_cast<float>(x[18]);
      }
      return NAN;

  # Power Inputs
  - platform: ble_client
    ble_client_id: solix_ble
    type: characteristic
    name: "Anker Mains Charging Watts"
    service_uuid: '014BF5DA-0000-1000-8000-00805F9B34FB'
    characteristic_uuid: '8888'
    id: mains_charging_w
    unit_of_measurement: "W"
    lambda: |-
      if (x.size() >= 20) {
        return (x[19] << 8) | x[20];
      }
      return NAN;

  - platform: ble_client
    ble_client_id: solix_ble
    type: characteristic
    name: "Anker 12V Charging Watts"
    service_uuid: '014BF5DA-0000-1000-8000-00805F9B34FB'
    characteristic_uuid: '8888'
    id: twelvev_charging_w
    unit_of_measurement: "W"
    lambda: |-
      if (x.size() >= 38) {
        return (x[37] << 8) | x[38];
      }
      return NAN;

  - platform: ble_client
    ble_client_id: solix_ble
    type: characteristic
    name: "Anker Total Charging Watts"
    service_uuid: '014BF5DA-0000-1000-8000-00805F9B34FB'
    characteristic_uuid: '8888'
    id: total_charging_w
    unit_of_measurement: "W"
    lambda: |-
      if (x.size() >= 40) {
        return (x[39] << 8) | x[40];
      }
      return NAN;

  # Power Outputs
  - platform: ble_client
    ble_client_id: solix_ble
    type: characteristic
    name: "Anker 240V Output Watts"
    service_uuid: '014BF5DA-0000-1000-8000-00805F9B34FB'
    characteristic_uuid: '8888'
    id: ac_output_w
    unit_of_measurement: "W"
    lambda: |-
      if (x.size() >= 22) {
        return (x[21] << 8) | x[22];
      }
      return NAN;

  - platform: ble_client
    ble_client_id: solix_ble
    type: characteristic
    name: "Anker USB-A Port 1 Watts"
    service_uuid: '014BF5DA-0000-1000-8000-00805F9B34FB'
    characteristic_uuid: '8888'
    id: usba1_w
    unit_of_measurement: "W"
    lambda: |-
      if (x.size() >= 32) {
        return (x[31] << 8) | x[32];
      }
      return NAN;

  - platform: ble_client
    ble_client_id: solix_ble
    type: characteristic
    name: "Anker USB-A Port 2 Watts"
    service_uuid: '014BF5DA-0000-1000-8000-00805F9B34FB'
    characteristic_uuid: '8888'
    id: usba2_w
    unit_of_measurement: "W"
    lambda: |-
      if (x.size() >= 34) {
        return (x[33] << 8) | x[34];
      }
      return NAN;

  - platform: ble_client
    ble_client_id: solix_ble
    type: characteristic
    name: "Anker Total Output Watts"
    service_uuid: '014BF5DA-0000-1000-8000-00805F9B34FB'
    characteristic_uuid: '8888'
    id: total_output_w
    unit_of_measurement: "W"
    lambda: |-
      if (x.size() >= 42) {
        return (x[41] << 8) | x[42];
      }
      return NAN;

  # Status Sensors
  - platform: ble_client
    ble_client_id: solix_ble
    type: characteristic
    name: "Anker Battery Temperature"
    service_uuid: '014BF5DA-0000-1000-8000-00805F9B34FB'
    characteristic_uuid: '8888'
    id: battery_temp
    unit_of_measurement: "°C"
    lambda: |-
      if (x.size() > 66) {
        return static_cast<float>(x[66]);
      }
      return NAN;

  - platform: ble_client
    ble_client_id: solix_ble
    type: characteristic
    name: "Anker Battery Level"
    service_uuid: '014BF5DA-0000-1000-8000-00805F9B34FB'
    characteristic_uuid: '8888'
    id: battery_level
    unit_of_measurement: "%"
    lambda: |-
      if (x.size() > 70) {
        return static_cast<float>(x[70]);
      }
      return NAN;

      return false;