Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
christianh17 committed Feb 4, 2024
2 parents 05e7565 + 8f22563 commit 7eccca5
Show file tree
Hide file tree
Showing 10 changed files with 1,685 additions and 8,130 deletions.
46 changes: 46 additions & 0 deletions .gitea/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
# For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages

name: Development Deployment

on:
push:
branches:
- onprem

jobs:
build:
runs-on: docker
steps:
- uses: http://gitea.com/actions/checkout@v3
- run: npm ci
- run: npm test

deploy-npm:
needs: build
runs-on: docker
steps:
- uses: http://gitea.com/actions/checkout@v3
- run: npm i
name: Build
- run: |
npm pack --json | jq -r '.[0] | "filename=" + .filename + "\nid=" + .id + "\nversion=" + .version' | sed 's/\\n/\n/g' >> "$GITHUB_OUTPUT"
name: Pack NPM File
id: npmpack
- name: List files in the repository
run: |
ls ${{ gitea.workspace }}
- name: Output information
run: echo "Filename = ${{ steps.npmpack.outputs.filename }}" && echo "ID = ${{ steps.npmpack.outputs.id }}" && echo "Version = ${{ steps.npmpack.outputs.version }}" && if [ -z "${{ steps.npmpack.outputs.filename }}" ]; then echo "Filename wrong!" && exit 1; else echo "filename fine"; fi && if [ -z "${{ steps.npmpack.outputs.version }}" ]; then echo "Version wrong!" && exit 1; else echo "Version fine"; fi
- name: Move files
run: |
cp -f ${{ gitea.workspace }}/${{ steps.npmpack.outputs.filename }} /deploy/iobroker/data/install/
- name: Install on ioBroker
run: |
docker exec -it iobroker /bin/bash -c "iobroker url /opt/iobroker/install/${{ steps.npmpack.outputs.filename }}"
- name: Upload new Admin files
run : |
docker exec -it iobroker /bin/bash -c "iobroker upload bydhvs"
- name: Restart the adapter
run: |
docker exec -it iobroker /bin/bash -c "iobroker restart bydhvs.0"
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,6 @@ Thumbs.db

# i18n intermediate files
admin/i18n/flat.txt
admin/i18n/*/flat.txt
admin/i18n/*/flat.txt

# package-lock.json
12 changes: 8 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ BYD HVS Battery poll data

## Introduction

This Adapter takes data from a byd PV battery ( https://www.bydbatterybox.com/ ) and puts them into datapoints in the adapter. Unfortunately there is no official API and no documentation, so I used wireshark and a byd-hvs-simulator to try to understand the communication. My adapter simulates the byd-app, sends similar packets to the device and analyses the responses.
This Adapter takes data from a byd PV battery ( https://www.bydbatterybox.com/ ) and puts them into datapoints in the adapter. Unfortunately there is no official API and no documentation, so I used wireshark and a byd-hvs-simulator to try to understand the communication. My adapter simulates the byd-app, sends similar packets to the device and analyses the responses.

## be careful

Expand All @@ -19,10 +19,10 @@ Up to 5 HVS Modules are now supported.
## settings

Interval: That's easy: how often (s) shall the data be polled
IP-Adress: Thats self explaining. Either you use the standard address ( 192.168.16.254 ) and change the routing at home, e.g.: https://www.photovoltaikforum.com/thread/150898-byd-hvs-firmware-update/?postID=2215343#post2215343 . The advantage is: The beConnect app works, too. Other possibility: You change the IP-Adress of the box. But: Be warned: the text on the webpage is confusing and if you are not absolutely shure about the things you do: PLEASE do not touch the settings. In the German forums I read from people who were locked out of their system and there is no way back, either byd sends you a replacement HVU or you have to buy a new one.
IP-Adress: Thats self explaining. Either you use the standard address ( 192.168.16.254 ) and change the routing at home, e.g.: https://www.photovoltaikforum.com/thread/150898-byd-hvs-firmware-update/?postID=2215343#post2215343 . The advantage is: The beConnect app works, too. Other possibility: You change the IP-Adress of the box. But: Be warned: the text on the webpage is confusing and if you are not absolutely shure about the things you do: PLEASE do not touch the settings. In the German forums I read from people who were locked out of their system and there is no way back, either byd sends you a replacement HVU or you have to buy a new one.
Battery-details: As explained above: Do you need the details of the battery? If so: set the checkobx.
Battery-details - every ... cycles :Also like above, should be clear
Test Mode - show data in error log: If you check this box: the sent and recieved data are displayed in the error-log, so you can easily download the data and send it to me in case of errors.
Test Mode - show data in error log: If you check this box: the sent and recieved data are displayed in the error-log, so you can easily download the data and send it to me in case of errors.
Copy and Paste does not work - the data is cut at the end. You will have to download it before you send it to me.

[Link zur nativen deutschen Readme:](README-German.md)
Expand All @@ -32,8 +32,12 @@ Copy and Paste does not work - the data is cut at the end. You will have to down
Placeholder for the next version (at the beginning of the line):
### __WORK IN PROGRESS__
-->
### 1.5.1 (2024-01-15)
* Enable the possibility to get informations from a two tower setup
* BREAKING CHANGE of Structure.

### 1.5.0 (2023-11-04)
* Breaking change: nodejs 16 minimum required
* Breaking change: nodejs 16 minimum required
* automated checks and release-script repaired (thanks to mcm1957, he did the work)
* nothing else changed in code

Expand Down
15 changes: 14 additions & 1 deletion admin/index_m.html
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,26 @@
<input type="checkbox" class="value" id="ConfTestMode" />
<label for="ConfTestMode" class="translate">Test Mode - show data in error log</label>
</div>
</div>
</div>
<div class="row">
<div class="col s6 input-field">
<input type="text" class="value" id="ConfDetailshowoften" />
<label for="ConfDetailshowoften" class="translate">Battery-details - every ... cycles</label>
</div>
</div>
<div class="row">
<div class="col s6 input-field">
<select name="ConfBydTowerCont" id="ConfBydTowerCount" class="value">
<option>1</option>
<option>2</option>
</select>
<label for="ConfBydTowerCount" class="translate">ConfBydTowerCount</label>
</div>
<div class="col s6 input-field">
<input type="checkbox" class="value" id="ConfStoreRawMessages" />
<label for="ConfStoreRawMessages" class="translate">ConfStoreRawMessages</label>
</div>
</div>
</div>

</div>
Expand Down
18 changes: 17 additions & 1 deletion admin/words.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,5 +77,21 @@ systemDictionary = {
"es": "Modo de prueba: muestra datos en el registro de errores",
"pl": "Tryb testowy - pokaż dane w dzienniku błędów",
"zh-cn": "测试模式-在错误日志中显示数据"
}
},
"ConfBydTowerCount": {
"en": "Count of towers",
"de": "Anzahl der Türme",
"ru": "Количество башен",
"pt": "Contagem de torres",
"nl": "Aantal torens",
"fr": "Nombre de tours",
"it": "Conte di torri",
"es": "Conde de torres",
"pl": "Liczba wież",
"uk": "Кількість веж",
"zh-cn": "塔数"
},
"ConfStoreRawMessages": {
"en": "Enable to store the raw messages"
}
};
78 changes: 78 additions & 0 deletions docs/byd-hexstructure.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# Structure of BYD HVS Messages

## Captureing of messages
These messages and decrypted by capturing the communication between the software Be Connect and the hardware. The position and information of each information is interpreted by the community and may be incorrect. Please take only valid information from BYD or its sub-companies.


## Messages

After a TCP Connection is estalished the communication requires to send a command to receive data or execute a measurement. The project of smarthomeNG describe it as a similarity for ModBus that we read and write registers with the TCP connection.
https://github.com/lgb-this/plugins/blob/develop/byd_bat/user_doc.rst
All Messages have a Header in Byte 1 and 2.

### Message 0 - Initiate connection and Basic data
The send out message is ```010300000066c5e0```

| Byte | Type | Description |
|:-- |:--:|:--|
| 3 to 21 | string | This is the serialnumber. On the 2. character you can identify the hardwaretype (HVS, HVM, ...) |
| 27 + 28 | character | Version in format V(27).(28) for the first BMU |
| 29 + 30 | character | Version in format V(29).(30) for the 2nd BMU |
| 33 | integer | used tower BMU |
| 36 | 2 seperate byte integer | 1 byte - towers; 2 byte - modules (23 => 2 towers & 3 modules) |
| 38 | enum | 0: OffGrid; 1: OnGrid; 2: Backup |

### Message 1 - System diagnosis
The send out message is ```01030500001984cc```

| Byte | Type | Descriptio |
|:-- |:--:|:--|
| 3 | int16 signed | SOC of the whole system |
| 5 | int16 signed | System max volts |
| 7 | int16 signed | System min volts |
| 9 | int16 signed | System SOH |
| 11 | int16 signed | System amperes |
| 13 | int16 unsigned | Battery volts with SF 100 |
| 15 | int16 signed | max Temperature |
| 17 | int16 signed | min Temperature |
| 19 | int16 signed | Battery Temperature |
| 29 | int16 signed | Error Number |
| 31 + 32 | characters | Param T |
| 35 | int16 unsigned | Ouput voltage with SF 100 |
| 37 | int16 unsigned | Total charge of the system |
| 41 | int16 unsinged | Total discharge of the system |

### Message 2 - System diagnosis
the send command is ```010300100003040e```

| Byte | Type | Descriptio |
|:-- |:--:|:--|
| 3 | enum | inverter type |
| 5 | enum | Battery type: 0: HVL; 1: HVM; 2: HVS |

### Message 5 - Tower basic information

| Byte | Type | Descriptio |
|:-- |:--:|:--|
| 5 | int16 signed | Tower max Volt |
| 7 | int16 singed | Tower min Volt |
| 9 | int | max volt cell number |
| 10 | int | min volt cell number |
| 11 | int16 signed | max temperature |
| 13 | int 16 signed | min temperature |
| 15 | int | max temperature cell |
| 16 | int | min temperature cell number |
| 17 - 32 | MSB, LSB | Balancing Flags |
| 33 | int32 Unsigned | tower charge total with SF 1000 |
| 37 | int32 Unsigned | tower discharge total with SF 1000 |
| 45 | int16 signed | tower battery voltage SF 10 |
| 51 | int16 singed | tower volt out |
| 53 | int16 signed | SOC Percentage |
| 55 | int16 signed | SOH percentage |
| 57 | int16 signed | Currentamperes |
| 59 + 60 | hex | state |

## Glossary
| Short | Description |
|:--:|:-- |
| SF | Scale Factor (Value 1234 & SF 100 => Real Value: 12.34) |
51 changes: 50 additions & 1 deletion io-package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
{
"common": {
"name": "bydhvs",
"version": "1.5.0",
"version": "1.5.1",
"news": {
"1.5.1": {
"en": "Working with parallel towers. you can setup it in admin page."
},
"1.5.0": {
"en": "Breaking change: nodejs 16 minimum required \nautomated checks and release-script repaired (thanks to mcm1957, he did the work)\nnothing else changed in code",
"de": "Breaking change: nodejs 16 minimum erforderlich\nautomatisierte kontrollen und release-script repariert (dank mcm1957, er tat die arbeit)\nnichts anders geändert in code",
Expand Down Expand Up @@ -136,6 +139,50 @@
"compact": true,
"connectionType": "local",
"dataSource": "poll",
"messages": [
{
"condition": {
"operand": "and",
"rules": [
"oldVersion<1.5.1",
"newVersion>=1.5.1"
]
},
"title": {
"en": "Changed structure of Diagnosis and CellDetails.",
"de": "Geänderte Struktur der Diagnose und CellDetails.",
"ru": "Изменение структуры диагностики и клеточных деталей.",
"pt": "Estrutura alterada de Diagnóstico e CellDetails.",
"nl": "Veranderde structuur van Diagnose en CellDetails.",
"fr": "Structure modifiée du diagnostic et des détails cellulaires.",
"it": "Struttura modificata di Diagnosi e CellDetails.",
"es": "Estructura modificada de Diagnóstico y Detalles Celulares.",
"pl": "Zmieniona struktura diagnostyki i cellDetails.",
"uk": "Змінена структура діагностики та клітинних деталей.",
"zh-cn": "已改变的诊断和细胞分类的结构."
},
"text": {
"en": "Changed structure of Diagnosis and CellDetails. We introduced an additional level for each tower. Example: Old Structure: bydhvs.0.Diagnosis.SOC; New Structure: bydhvs.0.Diagnosis.Tower_1.SOC; You should check your Database/Influx/... subscriptions.",
"de": "Geänderte Struktur der Diagnose und CellDetails. Wir haben für jeden Turm ein zusätzliches Niveau eingeführt. Beispiel: Alte Struktur: bydhvs.0.Diagnosis.SOC; Neue Struktur: bydhvs.0.Diagnosis.Tower_1.SOC; Sie sollten Ihre Datenbank/Influx/... Abonnements überprüfen.",
"ru": "Изменение структуры диагностики и клеточных деталей. Мы ввели дополнительный уровень для каждой башни. Пример: Старая структура: bydhvs.0.Diagnosis.SOC; Новая структура: bydhvs.0.Diagnosis.Tower_1.SOC; Вы должны проверить свою базу данных / Influx /... подписки.",
"pt": "Estrutura alterada de Diagnóstico e CellDetails. Introduzimos um nível adicional para cada torre. Exemplo: Old Structure: bydhvs.0.Diagnosis.SOC; New Structure: bydhvs.0.Diagnosis.Tower_1.SOC; Você deve verificar seu banco de dados / Influx /... assinaturas.",
"nl": "Veranderde structuur van Diagnose en CellDetails. We hebben een extra niveau voor elke toren ingevoerd. Voorbeeld: Oude structuur: bydhvs.0.Diagnose.SOC; Nieuwe structuur: bydhvs.0.Diagnose.Tower_1.SOC; Controleer uw Database/Influx/... abonnementen.",
"fr": "Structure modifiée du diagnostic et des détails cellulaires. Nous avons introduit un niveau supplémentaire pour chaque tour. Exemple: Ancienne structure: bydhvs.0.Diagnosis.SOC; Nouvelle structure: bydhvs.0.Diagnosis.Tower_1.SOC; Vous devriez vérifier vos abonnements Database/Influx/...",
"it": "Struttura modificata di Diagnosi e CellDetails. Abbiamo introdotto un livello aggiuntivo per ogni torre. Esempio: Struttura vecchia: bydhvs.0.Diagnosis.SOC; Nuova struttura: bydhvs.0.Diagnosis.Tower_1.SOC; Si consiglia di controllare il database/Influx/... abbonamenti.",
"es": "Estructura modificada de Diagnóstico y Detalles Celulares. Presentamos un nivel adicional para cada torre. Ejemplo: Old Structure: bydhvs.0.Diagnosis.SOC; New Structure: bydhvs.0.Diagnosis.Tower_1.SOC; Usted debe comprobar sus suscripciones de Base de Datos/Influjo/...",
"pl": "Zmieniona struktura diagnostyki i cellDetails. Wprowadziliśmy dodatkowy poziom dla każdej wieży. Przykład: Stara struktura: bydhvs.0.Diagnosis.SOC; Nowa struktura: bydhvs.0.Diagnosis.Tower _ 1.SOC; Powinieneś sprawdzić swoją bazę danych / Influm /... subskrypcje.",
"uk": "Змінена структура діагностики та клітинних деталей. Ми ввели додатковий рівень для кожної вежі. Приклад: Стара структура: bydhvs.0.Diagnosis.SOC; Нова структура: bydhvs.0.Diagnosis.Tower_1.SOC; Ви повинні перевірити вашу базу даних/Influx/... підписки.",
"zh-cn": "已改变的诊断和细胞分类的结构。 我们为每座塔增加了一层 例:旧结构:bydhvs.0.Diagnosis.SOC;新结构:bydhvs.0.Diagnosis.Tower_1.SOC; 您应该检查您的数据库/ Influx/... 订阅 ."
},
"link": "https://github.com/christianh17/ioBroker.bydhvs/pull/262",
"linkText": "Reiew SourceCode of that change or report an issue",
"level":"warn",
"buttons": [
"agree",
"cancel"
]
}
],
"materialize": true,
"dependencies": [
{
Expand All @@ -147,6 +194,8 @@
"ConfPollInterval": "60",
"ConfIPAdress": "192.168.16.254",
"ConfDetailshowoften": 60,
"ConfBydTowerCount": 1,
"ConfStoreRawMessages": false,
"pingInterval": 15000
},
"objects": [],
Expand Down
Loading

0 comments on commit 7eccca5

Please sign in to comment.