vejvik

ESPhome fve + bms

Mar 30th, 2023 (edited)
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 13.51 KB | None | 0 0
  1. substitutions:
  2. name: jbd-bms-ble
  3. device_description: "Monitor and control a Xiaoxiang Battery Management System (JBD-BMS) via BLE"
  4. external_components_source: github://syssi/esphome-jbd-bms@main
  5. mac_address: A4:C1:37:50:75:C6
  6. esphome:
  7. name: fve
  8. friendly_name: FVE
  9.  
  10. esp32:
  11. board: esp32dev
  12. framework:
  13. type: esp-idf
  14.  
  15. external_components:
  16. - source: ${external_components_source}
  17. refresh: 0s
  18.  
  19. # Enable logging
  20. logger:
  21.  
  22.  
  23. # Enable Home Assistant API
  24. api:
  25. encryption:
  26. key: "BU0whyQh53j42Ve3q3iVoF0iKdaR8A0xFkg+6BUQSXk="
  27.  
  28. ota:
  29. password: "b94a5f5ca6b60706d3dfa93d65e1e2bc"
  30.  
  31. wifi:
  32. ssid: !secret wifi_ssid
  33. password: !secret wifi_password
  34.  
  35. # Enable fallback hotspot (captive portal) in case wifi connection fails
  36. ap:
  37. ssid: "Fve Fallback Hotspot"
  38. password: "ZdCryXqsJvGW"
  39.  
  40. uart:
  41. id: mod_bus
  42. tx_pin: GPIO19
  43. rx_pin: GPIO23
  44. baud_rate: 19200
  45. stop_bits: 1
  46. parity: NONE
  47. data_bits: 8
  48.  
  49. modbus:
  50. id: mod_bus_must
  51. send_wait_time: 1250ms
  52.  
  53. modbus_controller:
  54. - id: must
  55. address: 0x4
  56. modbus_id: mod_bus_must
  57. setup_priority: -10
  58. update_interval: 2s
  59.  
  60.  
  61. esp32_ble_tracker:
  62. on_ble_advertise:
  63. then:
  64. - lambda: |-
  65. if (x.get_name().rfind("xiaoxiang", 0) == 0) {
  66. ESP_LOGI("ble_adv", "New JBD-BMS found");
  67. ESP_LOGI("ble_adv", " Name: %s", x.get_name().c_str());
  68. ESP_LOGI("ble_adv", " MAC address: %s", x.address_str().c_str());
  69. ESP_LOGD("ble_adv", " Advertised service UUIDs:");
  70. for (auto uuid : x.get_service_uuids()) {
  71. ESP_LOGD("ble_adv", " - %s", uuid.to_string().c_str());
  72. }
  73. }
  74. ble_client:
  75. - id: client0
  76. mac_address: ${mac_address}
  77.  
  78. jbd_bms_ble:
  79. - id: bms0
  80. ble_client_id: client0
  81. update_interval: 2s
  82.  
  83. binary_sensor:
  84. - platform: jbd_bms_ble
  85. jbd_bms_ble_id: bms0
  86. balancing:
  87. name: "${name} balancing"
  88. charging:
  89. name: "${name} charging"
  90. discharging:
  91. name: "${name} discharging"
  92. online_status:
  93. name: "${name} online status"
  94.  
  95. switch:
  96. - platform: restart
  97. name: "ESPhome PV18 Restart"
  98.  
  99. - platform: ble_client
  100. ble_client_id: client0
  101. name: "${name} enable bluetooth connection"
  102.  
  103. - platform: jbd_bms_ble
  104. jbd_bms_ble_id: bms0
  105. charging:
  106. name: "${name} charging"
  107. discharging:
  108. name: "${name} discharging"
  109. balancer:
  110. name: "${name} balancer"
  111.  
  112. sensor:
  113. - platform: uptime
  114. name: Uptime Sensor
  115. # charger sensors
  116. - platform: modbus_controller
  117. address: 15201
  118. name: "Charger workstate"
  119. register_type: holding
  120. - platform: modbus_controller
  121. address: 15202
  122. name: "MPPT state"
  123. register_type: holding
  124. - platform: modbus_controller
  125. address: 15203
  126. name: "Charging state"
  127. register_type: holding
  128. - platform: modbus_controller
  129. address: 15205
  130. name: "PV voltage"
  131. register_type: holding
  132. unit_of_measurement: "V"
  133. accuracy_decimals: 1
  134. icon: mdi:sine-wave
  135. filters:
  136. multiply: 0.1
  137. - platform: modbus_controller
  138. address: 15206
  139. name: "Battery voltage (charger side)"
  140. register_type: holding
  141. unit_of_measurement: "V"
  142. accuracy_decimals: 1
  143. icon: mdi:sine-wave
  144. filters:
  145. multiply: 0.1
  146. - platform: modbus_controller
  147. address: 15207
  148. name: "Charger Current"
  149. register_type: holding
  150. unit_of_measurement: "A"
  151. accuracy_decimals: 1
  152. icon: mdi:current-dc
  153. filters:
  154. multiply: 0.1
  155. - platform: modbus_controller
  156. address: 15208
  157. register_type: holding
  158. name: "Charger power"
  159. unit_of_measurement: "W"
  160. accuracy_decimals: 1
  161. icon: mdi:flash
  162. - platform: modbus_controller
  163. address: 15211
  164. register_type: holding
  165. name: "Battery Relay"
  166. - platform: modbus_controller
  167. address: 15212
  168. register_type: holding
  169. name: "PV Relay"
  170. icon: mdi:electric-switch
  171. - platform: modbus_controller
  172. address: 15218
  173. register_type: holding
  174. name: "Accumulated charger power"
  175. unit_of_measurement: "kWh"
  176. accuracy_decimals: 1
  177. icon: mdi:flash
  178. filters:
  179. multiply: 0.1
  180. # 15217 RO Accumulated power high 1000KWH
  181.  
  182. # inverter sensors
  183. - platform: modbus_controller
  184. address: 25201
  185. register_type: holding
  186. name: "Inverter Work state"
  187. - platform: modbus_controller
  188. address: 25205
  189. name: "Battery voltage"
  190. register_type: holding
  191. unit_of_measurement: "V"
  192. accuracy_decimals: 1
  193. icon: mdi:sine-wave
  194. filters:
  195. multiply: 0.1
  196. - platform: modbus_controller
  197. address: 25206
  198. name: "Inverter voltage"
  199. register_type: holding
  200. unit_of_measurement: "V"
  201. accuracy_decimals: 1
  202. icon: mdi:sine-wave
  203. filters:
  204. multiply: 0.1
  205. - platform: modbus_controller
  206. address: 25207
  207. name: "Grid voltage"
  208. register_type: holding
  209. unit_of_measurement: "V"
  210. accuracy_decimals: 1
  211. icon: mdi:sine-wave
  212. filters:
  213. multiply: 0.1
  214. - platform: modbus_controller
  215. address: 25208
  216. name: "Bus voltage"
  217. register_type: holding
  218. unit_of_measurement: "V"
  219. accuracy_decimals: 1
  220. icon: mdi:sine-wave
  221. filters:
  222. multiply: 0.1
  223. - platform: modbus_controller
  224. address: 25209
  225. name: "Control current"
  226. register_type: holding
  227. unit_of_measurement: "A"
  228. accuracy_decimals: 1
  229. icon: mdi:current-dc
  230. filters:
  231. multiply: 0.1
  232. - platform: modbus_controller
  233. address: 25210
  234. name: "Inverter current"
  235. register_type: holding
  236. unit_of_measurement: "A"
  237. accuracy_decimals: 1
  238. icon: mdi:current-dc
  239. filters:
  240. multiply: 0.1
  241. - platform: modbus_controller
  242. address: 25211
  243. name: "Grid current"
  244. register_type: holding
  245. unit_of_measurement: "A"
  246. accuracy_decimals: 1
  247. icon: mdi:current-dc
  248. filters:
  249. multiply: 0.1
  250. - platform: modbus_controller
  251. address: 25212
  252. name: "Load current"
  253. register_type: holding
  254. unit_of_measurement: "A"
  255. accuracy_decimals: 1
  256. icon: mdi:current-dc
  257. filters:
  258. multiply: 0.1
  259. - platform: modbus_controller
  260. address: 25213
  261. name: "Inverter power"
  262. register_type: holding
  263. unit_of_measurement: "W"
  264. accuracy_decimals: 1
  265. icon: mdi:flash
  266. - platform: modbus_controller
  267. address: 25214
  268. name: "Grid power"
  269. register_type: holding
  270. unit_of_measurement: "W"
  271. accuracy_decimals: 1
  272. value_type: S_WORD
  273. icon: mdi:flash
  274. - platform: modbus_controller
  275. address: 25215
  276. name: "Load power"
  277. register_type: holding
  278. unit_of_measurement: "W"
  279. accuracy_decimals: 1
  280. icon: mdi:flash
  281. - platform: modbus_controller
  282. address: 25216
  283. name: "System load"
  284. register_type: holding
  285. unit_of_measurement: "%"
  286. accuracy_decimals: 1
  287. icon: mdi:flash
  288.  
  289. # 25217 Inverter complex power(S) 1 VA
  290. # 25218 Grid complex power(S) 1 VA
  291. # 25219 Load complex power(S) 1 VA
  292. # 25221 Inverter reactive power(Q) 1 var
  293. # 25222 Grid reactive power(Q) 1 var
  294. # 25223 Load reactive power(Q) 1 var
  295. # 25225 Inverter frequency 0.01 Hz
  296. # 25226 Grid frequency 0.01 Hz
  297.  
  298. - platform: modbus_controller
  299. address: 25233
  300. register_type: holding
  301. name: "AC radiator temp"
  302. accuracy_decimals: 1
  303. unit_of_measurement: "°C"
  304. - platform: modbus_controller
  305. address: 25234
  306. register_type: holding
  307. name: "Transformer temp"
  308. unit_of_measurement: "°C"
  309. accuracy_decimals: 1
  310. - platform: modbus_controller
  311. address: 25235
  312. register_type: holding
  313. name: "DC Radiator temp"
  314. unit_of_measurement: "°C"
  315. accuracy_decimals: 1
  316. - platform: modbus_controller
  317. address: 25237
  318. register_type: holding
  319. name: "Inverter Relay"
  320. icon: mdi:electric-switch
  321. - platform: modbus_controller
  322. address: 25238
  323. register_type: holding
  324. name: "Grid Relay"
  325. icon: mdi:electric-switch
  326. - platform: modbus_controller
  327. address: 25239
  328. register_type: holding
  329. name: "Load Relay"
  330. icon: mdi:electric-switch
  331. - platform: modbus_controller
  332. address: 25240
  333. register_type: holding
  334. name: "N_Line Relay"
  335. icon: mdi:electric-switch
  336. - platform: modbus_controller
  337. address: 25241
  338. register_type: holding
  339. name: "DC Relay"
  340. icon: mdi:electric-switch
  341. - platform: modbus_controller
  342. address: 25242
  343. register_type: holding
  344. name: "Earth Relay"
  345. icon: mdi:electric-switch
  346.  
  347. # statistics sensors
  348. # - platform: modbus_controller
  349. # address: 25246
  350. # register_type: holding
  351. # name: "Accumulated charger power"
  352. # unit_of_measurement: "kW"
  353. # accuracy_decimals: 1
  354. # icon: mdi:flash
  355. # filters:
  356. # multiply: 0.1
  357. - platform: modbus_controller
  358. address: 25248
  359. register_type: holding
  360. name: "Accumulated discharger power"
  361. unit_of_measurement: "kWh"
  362. accuracy_decimals: 1
  363. icon: mdi:flash
  364. filters:
  365. multiply: 0.1
  366. - platform: modbus_controller
  367. address: 25250
  368. register_type: holding
  369. name: "Accumulated buy power"
  370. unit_of_measurement: "kWh"
  371. accuracy_decimals: 1
  372. icon: mdi:flash
  373. filters:
  374. multiply: 0.1
  375. - platform: modbus_controller
  376. address: 25252
  377. register_type: holding
  378. name: "Accumulated sell power"
  379. unit_of_measurement: "kWh"
  380. accuracy_decimals: 1
  381. icon: mdi:flash
  382. filters:
  383. multiply: 0.1
  384. - platform: modbus_controller
  385. address: 25254
  386. register_type: holding
  387. name: "Accumulated load power"
  388. unit_of_measurement: "kWh"
  389. accuracy_decimals: 1
  390. icon: mdi:flash
  391. filters:
  392. multiply: 0.1
  393. - platform: modbus_controller
  394. address: 25256
  395. register_type: holding
  396. name: "Accumulated self_use power"
  397. unit_of_measurement: "kWh"
  398. accuracy_decimals: 1
  399. icon: mdi:flash
  400. filters:
  401. multiply: 0.1
  402. - platform: modbus_controller
  403. address: 25258
  404. register_type: holding
  405. name: "Accumulated PV_sell power"
  406. unit_of_measurement: "kWh"
  407. accuracy_decimals: 1
  408. icon: mdi:flash
  409. filters:
  410. multiply: 0.1
  411. - platform: modbus_controller
  412. address: 25260
  413. register_type: holding
  414. name: "Accumulated grid_charger power"
  415. unit_of_measurement: "kWh"
  416. accuracy_decimals: 1
  417. icon: mdi:flash
  418. filters:
  419. multiply: 0.1
  420. - platform: modbus_controller
  421. address: 25273
  422. register_type: holding
  423. value_type: S_WORD
  424. name: "Battery power"
  425. unit_of_measurement: "W"
  426. accuracy_decimals: 1
  427. icon: mdi:flash
  428. - platform: modbus_controller
  429. address: 25274
  430. register_type: holding
  431. value_type: S_WORD
  432. name: "Battery current"
  433. unit_of_measurement: "A"
  434. accuracy_decimals: 1
  435. icon: mdi:current-dc
  436.  
  437. - platform: jbd_bms_ble
  438. jbd_bms_ble_id: bms0
  439. battery_strings:
  440. name: "${name} battery strings"
  441. current:
  442. name: "${name} current"
  443. power:
  444. name: "${name} power"
  445. charging_power:
  446. name: "${name} charging power"
  447. discharging_power:
  448. name: "${name} discharging power"
  449. state_of_charge:
  450. name: "${name} state of charge"
  451. nominal_capacity:
  452. name: "${name} nominal capacity"
  453. charging_cycles:
  454. name: "${name} charging cycles"
  455. capacity_remaining:
  456. name: "${name} capacity remaining"
  457. battery_cycle_capacity:
  458. name: "${name} battery cycle capacity"
  459. total_voltage:
  460. name: "${name} total voltage"
  461. average_cell_voltage:
  462. name: "${name} average cell voltage"
  463. delta_cell_voltage:
  464. name: "${name} delta cell voltage"
  465. min_cell_voltage:
  466. name: "${name} min cell voltage"
  467. max_cell_voltage:
  468. name: "${name} max cell voltage"
  469. min_voltage_cell:
  470. name: "${name} min voltage cell"
  471. max_voltage_cell:
  472. name: "${name} max voltage cell"
  473. temperature_1:
  474. name: "${name} temperature 1"
  475. temperature_2:
  476. name: "${name} temperature 2"
  477. temperature_3:
  478. name: "${name} temperature 3"
  479. cell_voltage_1:
  480. name: "${name} cell voltage 01"
  481. cell_voltage_2:
  482. name: "${name} cell voltage 02"
  483. cell_voltage_3:
  484. name: "${name} cell voltage 03"
  485. cell_voltage_4:
  486. name: "${name} cell voltage 04"
  487. cell_voltage_5:
  488. name: "${name} cell voltage 05"
  489. cell_voltage_6:
  490. name: "${name} cell voltage 06"
  491. cell_voltage_7:
  492. name: "${name} cell voltage 07"
  493. cell_voltage_8:
  494. name: "${name} cell voltage 08"
  495. cell_voltage_9:
  496. name: "${name} cell voltage 09"
  497. cell_voltage_10:
  498. name: "${name} cell voltage 10"
  499. cell_voltage_11:
  500. name: "${name} cell voltage 11"
  501. cell_voltage_12:
  502. name: "${name} cell voltage 12"
  503. cell_voltage_13:
  504. name: "${name} cell voltage 13"
  505. cell_voltage_14:
  506. name: "${name} cell voltage 14"
  507. operation_status_bitmask:
  508. name: "${name} operation status bitmask"
  509. errors_bitmask:
  510. name: "${name} errors bitmask"
  511. balancer_status_bitmask:
  512. name: "${name} balancer status bitmask"
  513. software_version:
  514. name: "${name} software version"
  515. # RSSI based on MAC address
  516. - platform: ble_rssi
  517. mac_address: A4:C1:37:50:75:C6
  518. name: "rssi jbd"
  519. - platform: wifi_signal
  520. name: "WiFi FVE"
  521. update_interval: 60s
  522. text_sensor:
  523. - platform: jbd_bms_ble
  524. jbd_bms_ble_id: bms0
  525. errors:
  526. name: "${name} errors"
  527. operation_status:
  528. name: "${name} operation status"
  529. device_model:
  530. name: "${name} device model"
  531.  
  532.  
  533.  
  534.  
Advertisement
Add Comment
Please, Sign In to add comment