Skip to content
Edit this page

Testing

1. Validate the configuration

esphome config my-victron.yaml

A valid configuration is printed back in full. Errors point to the offending line, e.g. a misspelled entity key or a wrong option value.

2. Check the live data

Watch the logs after the upload:

esphome logs my-victron.yaml

At startup the component logs its configuration:

[C][victron:...]: Victron:
[C][victron:...]:   Throttle: 10000 ms (effective: 10000 ms per block type)
[C][victron:...]:   Validate checksum: YES

Shortly after, the entities publish their values. In Home Assistant they appear on the device page, with MQTT under the configured topic prefix.

Symptom Likely cause
No values at all RX/TX or GND not connected, wrong rx_pin, wrong baud rate
Dropping block due to checksum mismatch warnings Noise on the line, 5 V level on a 3.3 V input, long unshielded cable
Some entities stay unknown The device does not send that field, see Entities

See Troubleshooting for more.

3. Inspect the raw VE.Direct traffic

Flash the debug configuration. It logs every line received on the UART, so you can see exactly which fields your device sends:

esphome run debug-esp8266-example.yaml   # or debug-esp32-example.yaml

An example of a recorded SmartSolar MPPT session is available in docs/smartsolar-mppt-example-pdus.txt.

4. Test without a Victron device

The repository contains fake devices in tests/fake-*.yaml. Each one turns a spare ESP8266 into an emulator that sends the VE.Direct traffic of a device on its TX pin every few seconds.

flowchart LR
  F["Emulator ESP8266<br>tests/fake-*.yaml"] -- "TX (GPIO4) → RX" --> D["ESP under test<br>your configuration"]
  F -. GND .- D
  1. Flash the emulator of the device you want to simulate. The emulators read wifi_ssid and wifi_password from tests/secrets.yaml:

    cd tests
    esphome run fake-smartsolar-mppt.yaml
    
  2. Connect the emulator's GPIO4 (TX) to the RX pin of the ESP under test and connect both GND pins.

  3. Watch the logs of the ESP under test.
Emulator Device
fake-smartsolar-mppt.yaml SmartSolar MPPT 75/15 (0xA053)
fake-smartsolar-mppt-150-70-rev3.yaml SmartSolar MPPT 150/70 rev3 (0xA06C)
fake-bmv600.yaml BMV-600
fake-bmv700.yaml BMV-700
fake-bmv710.yaml BMV-710
fake-bmv712.yaml BMV-712 Smart (0xA381)
fake-multi-block.yaml Device splitting its data into three blocks per second, like the BMV-70x/712 or SmartShunt
fake-phoenix-inverter.yaml Phoenix Inverter (0xA201)
fake-bluesmart-ip22-0xa332.yaml Blue Smart IP22 Charger 24|8 (0xA332)
fake-bluesmart-ip65-0xa30a.yaml Blue Smart IP65 Charger 12|25 (0xA30A)
fake-orion-xs-0xa3f0.yaml Orion XS 12V/12V-50A (0xA3F0)
fake-multi-rs-solar.yaml Multi RS Solar 48V 6000VA 230V (0xA442)
emulator-all-keys.yaml Every supported VE.Direct field

5. Developer tests

The CI runs on every pull request. The same checks can be run locally.

echo -e "wifi_ssid: ssid\nwifi_password: password\nmqtt_host: host\nmqtt_username: username\nmqtt_password: password" > secrets.yaml
for YAML in $(grep -l '^esphome:$' *.yaml); do
  esphome -s external_components_source components config $YAML
done
pip3 install esphome pytest
pytest -v tests/

The C++ unit tests in tests/components/victron/ run inside the ESPHome source tree:

git clone --depth 1 -b dev https://github.com/esphome/esphome.git
cp -r components/* esphome/esphome/components/
mkdir -p esphome/tests/components
cp -r tests/components/* esphome/tests/components/
cd esphome
pip3 install -e . -r requirements_test.txt
script/cpp_unit_test.py victron
esphome -s external_components_source components compile smartsolar-mppt-esp8266-example.yaml