-
-
Notifications
You must be signed in to change notification settings - Fork 169
/
esp8266-jk-pb-modbus-example.yaml
102 lines (89 loc) · 2.42 KB
/
esp8266-jk-pb-modbus-example.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
substitutions:
name: jk-bms
device_description: "Monitor a JK-BMS (JK-PB series) via Modbus"
external_components_source: github://syssi/esphome-jk-bms@main
tx_pin: GPIO1
rx_pin: GPIO3
esphome:
name: ${name}
comment: ${device_description}
min_version: 2024.6.0
project:
name: "syssi.esphome-jk-bms"
version: 1.5.0
esp8266:
board: d1_mini
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
ota:
platform: esphome
logger:
level: DEBUG
baud_rate: 0
# If you use Home Assistant please remove this `mqtt` section and uncomment the `api` component!
# The native API has many advantages over MQTT: https://esphome.io/components/api.html#advantages-over-mqtt
mqtt:
broker: !secret mqtt_host
username: !secret mqtt_username
password: !secret mqtt_password
id: mqtt_client
# api:
uart:
- id: uart_0
baud_rate: 115200
rx_buffer_size: 384
tx_pin: ${tx_pin}
rx_pin: ${rx_pin}
modbus:
- id: modbus0
uart_id: uart_0
flow_control_pin: GPIO12
modbus_controller:
- id: bms0
# Dip switch configuration of a single pack setup / address 0x01
# 1 2 4 5
# on, off, off, off (0x01)
#
# Don't turn off all dip switches / don't use device address 0x00.
# This is the Modbus Master mode. You must select a device address
# between 0x01 and 0x0f so the BMS acts as Modbus Slave.
address: 0x01
modbus_id: modbus0
setup_priority: -10
update_interval: 5s
command_throttle: 50ms
sensor:
# 0x128A 138 INT16 2 R TempMos 0.1 °C
- platform: modbus_controller
modbus_controller_id: bms0
name: "${name} mosfet temperature"
address: 0x128A
register_type: holding
value_type: S_WORD
unit_of_measurement: "°C"
state_class: measurement
accuracy_decimals: 3
filters:
- multiply: 0.1
# 0x1290 144 UINT32 4 R BatVol mV
- platform: modbus_controller
modbus_controller_id: bms0
name: "${name} total voltage"
address: 0x1290
register_type: holding
value_type: U_DWORD_R
unit_of_measurement: "V"
device_class: voltage
state_class: measurement
accuracy_decimals: 3
filters:
- multiply: 0.001
- platform: modbus_controller
modbus_controller_id: bms0
name: "${name} total runtime in seconds"
address: 0x12BC
register_type: holding
value_type: U_DWORD
state_class: measurement
accuracy_decimals: 0