DiPlus-to-hass: интегрируем BYD в Home Assistant DiPlus-to-hass: integrate your BYD into Home Assistant

Итак, я всё-таки получил то, чего мне так долго хотелось, — а именно интеграцию своего BYD Song PRO в Home Assistant. Теперь можно настраивать автоматизации: как в доме (по событиям и состоянию авто), так и в самом авто менять настройки и автоматизировать то, о чём раньше только мечтал — пока через HA, но в будущем допилю Tasker прямо в программе-компаньоне на вашем авто. Об этом — чуть позже. I finally got what I wanted for a long time — integration of my BYD Song PRO into Home Assistant. Now I can build automations at home based on car events and state, and even change car settings remotely. For now this is done through HA; later I plan to add Tasker-like rules directly in the companion app. More on that later.

Скриншот 1: устройство BYD в Home AssistantScreenshot 1: BYD device in Home Assistant

Что мы имеем? What do you need?

  1. Неудержимое желание получить телеметрию вашего авто в умном доме. A strong desire to get your car's telemetry into your smart home.
  2. Автомобиль BYD с корректно установленным DiPlus (желательно версии 1.3.8-beta18 или новее — скачать APK) и активированным ADB. A BYD vehicle with a properly installed DiPlus app (preferably 1.3.8-beta18 or newer — download APK). ADB is only needed for advanced installation/debugging.
  3. Умный дом на базе Home Assistant и доступ к папке custom_components. A Home Assistant setup with access to the custom_components folder.
  4. Флешку и возможность установить программу на головное устройство (ГУ) авто. Соответственно, DiPlus уже должен быть установлен. A USB flash drive and the ability to install an app on the car's head unit. DiPlus must already be installed.
DiPlus — это приложение на ГУ BYD. Без него DiPlus-to-hass работать не будет. DiPlus is an app that runs on the BYD head unit. DiPlus-to-hass will not work without it.

Что умеет интеграция? What can the integration do?

Скриншот 2: пример сенсоров в HAScreenshot 2: example sensors in HA

Порядок установки Installation steps

1. Установите интеграцию Home Assistant 1. Install the Home Assistant integration

  1. Скачайте архив diplus2hass-v1.9.2.zip с сайта teplitzky.ru/diplus2hass. Download the diplus2hass-v1.9.2.zip archive from teplitzky.ru/diplus2hass.
  2. Распакуйте его. Внутри будет папка custom_components/diplus2hass. Extract it. Inside you will find custom_components/diplus2hass.
  3. Скопируйте её в конфигурацию HA:
    cp -r custom_components/diplus2hass /config/custom_components/
    Copy it into your HA configuration:
    cp -r custom_components/diplus2hass /config/custom_components/
  4. Перезапустите Home Assistant. Restart Home Assistant.
  5. Перейдите в Настройки → Устройства и службы → Добавить интеграцию и выберите DiPlus-to-hass — BYD Vehicle Telemetry. Go to Settings → Devices & Services → Add integration and select DiPlus-to-hass — BYD Vehicle Telemetry.
  6. Введите имя автомобиля, например BYDSongPRO. Это же имя позже укажете в приложении. Enter the car name, for example BYDSongPRO. Use the same name later in the Android app.
Скриншот 3: добавление интеграции в HAScreenshot 3: adding the integration in HA
Важно: имя автомобиля в интеграции HA и в Android-приложении должны совпадать. Иначе сенсоры не появятся. Important: the car name in the HA integration and in the Android app must match, or sensors will not appear.

2. Установите DiPlus-to-hass на ГУ с флешки 2. Install DiPlus-to-hass on the head unit from a USB drive

  1. Скачайте diplus2hass-v1.9.1.apk с сайта teplitzky.ru/diplus2hass на компьютер. Download diplus2hass-v1.9.1.apk from teplitzky.ru/diplus2hass to your computer.
  2. Скопируйте файл diplus2hass-v1.9.1.apk в корень USB-флешки. Copy diplus2hass-v1.9.1.apk to the root of a USB flash drive.
  3. Вставьте флешку в USB-порт головного устройства BYD. Insert the flash drive into a USB port of the BYD head unit.
  4. На ГУ откройте файловый менеджер (или приложение "Проводник" / "File Manager"). On the head unit open the file manager (or "Explorer" / "File Manager").
  5. Найдите флешку, откройте папку с APK и нажмите на файл diplus2hass-v1.9.1.apk. Find the flash drive, open the APK folder and tap diplus2hass-v1.9.1.apk.
  6. Система предложит установить приложение. Нажмите Установить. Если появится предупреждение об установке из неизвестных источников, разрешите установку для файлового менеджера. The system will offer to install the app. Tap Install. If a warning about unknown sources appears, allow installation for the file manager.
  7. После установки откройте приложение и разрешите все запрошенные разрешения (местоположение, уведомления, автозапуск). After installation open the app and grant all requested permissions (location, notifications, auto-start).
Скриншот 4: главный экран приложения (v1.9.0 — настраиваемый дашборд)Screenshot 4: main app screen (v1.9.0 — customizable dashboard)

3. Настройте подключение к Home Assistant 3. Configure the Home Assistant connection

  1. В приложении нажмите ⚙ → Настройки. In the app tap ⚙ → Settings.
  2. Укажите: Enter:
    • Адрес сервера — домен или IP Home Assistant. Server address — Home Assistant domain or IP.
    • Порт — обычно 443 для HTTPS или 8123 для HTTP. Port — usually 443 for HTTPS or 8123 for HTTP.
    • Long-Lived Access Token — токен из профиля пользователя HA. Long-Lived Access Token — token from the HA user profile.
    • Имя автомобиля — точно такое же, как в интеграции HA. Car name — exactly the same as in the HA integration.
  3. Включите HTTPS, если HA работает по HTTPS. Enable HTTPS if HA uses HTTPS.
  4. Вернитесь на главный экран и включите переключатель Отправлять в HA. Return to the main screen and enable the Send to HA switch.
  5. При необходимости включите Управление авто из HA — тогда интеграция сможет отправлять команды в DiPlus. Optionally enable Control car from HA so the integration can send commands to DiPlus.
Скриншот 5: настройки подключения к HAScreenshot 5: HA connection settings
Получение токена: в HA откройте профиль пользователя (левый нижний угол) → раздел Long-Lived Access TokensСоздать токен. Скопируйте его сразу — повторно HA не покажет. Getting a token: in HA open the user profile (bottom-left corner) → Long-Lived Access TokensCreate token. Copy it immediately — HA will not show it again.

4. Настройте автозапуск и фоновую работу 4. Configure auto-start and background work

  1. В меню приложения откройте Настройки → Автозапуск (BYD). In the app menu open Settings → Auto start (BYD).
  2. В системном окне (список запрета автозапуска приложений) уберите галочку напротив DiPlus-to-hass, чтобы разрешить ему автозапускаться. In the system window (list of apps blocked from auto-start) uncheck DiPlus-to-hass to allow it to auto-start.
  3. Откройте Фоновая работа и добавьте приложение в белый список. Open Background activity and add the app to the whitelist.

После перезагрузки ГУ приложение кратковременно появится на экране и свернётся — так оно надёжнее удерживается в фоне. After the head unit reboots the app briefly appears on screen and then minimizes, which helps it stay alive in the background.

5. Выберите сигналы для передачи 5. Choose signals to send

На главном экране в таблице телеметрии отметьте галочками те сигналы, которые нужны в HA. Чекбокс в шапке выбирает или снимает все сразу, а клик по заголовкам столбцов сортирует таблицу. Фильтр сохраняется автоматически. On the main screen check the signals you want in HA. The header checkbox selects/deselects all, and clicking column headers sorts the table. The filter is saved automatically.

6. Включите управление авто из HA (опционально) 6. Enable car control from HA (optional)

Если хотите управлять климатом, окнами и другими функциями прямо из Home Assistant, откройте ⚙ → Настройки и включите Управление авто из HA. По умолчанию эта опция выключена для безопасности. If you want to control climate, windows and other functions directly from Home Assistant, open ⚙ → Settings and enable Control car from HA. It is disabled by default for safety.

Скриншот 8: вкладка команд в приложенииScreenshot 8: Commands tab in the app

7. Логирование и диагностика 7. Logging and diagnostics

Для отладки включите Писать подробный лог в настройках. Лог хранится в памяти, автоматически ротируется при превышении 5 МБ и может быть экспортирован в Downloads с именем, содержащим дату и время. For debugging enable Write detailed log in settings. The log is kept in memory, rotated automatically at 5 MB and can be exported to Downloads with a timestamped file name.

Скриншот 6: настройка автозапускаScreenshot 6: auto-start settings

Как это выглядит в Home Assistant? What does it look like in Home Assistant?

После первой отправки данных в HA появится устройство с сенсорами, бинарными сенсорами и трекером. Можно строить автоматизации: After the first data batch arrives in HA you will see a device with sensors, binary sensors and a tracker. You can build automations such as:

Скриншот 7: карта с трекером автоScreenshot 7: map with car tracker
Скриншот 9: сущности управления авто в HAScreenshot 9: car control entities in HA

Что делать, если что-то не работает? Troubleshooting

Планы развития Roadmap

В версии v2.0.0 добавлены автоматические действия по правилам прямо в приложении. Подробнее — в отдельной статье. Version v2.0.0 introduces rule-based automatic actions directly in the app. See the dedicated article for details.

Скачать Download

Поддержка и обсуждения — в Telegram: @BYDiPlus2HASS. Support and discussions — Telegram: @BYDiPlus2HASS.

Отказ от ответственности. Все действия с программным обеспечением, настройками автомобиля и системой Home Assistant вы выполняете исключительно на свой страх и риск. Авторы не несут ответственности за возможные повреждения оборудования, изменение настроек автомобиля или потерю данных. Disclaimer. All actions with the software, vehicle settings and Home Assistant system are performed at your own risk. The authors are not responsible for possible equipment damage, vehicle setting changes or data loss.