Skip to content

Commit

Permalink
ensure port is closed when integration unloaded
Browse files Browse the repository at this point in the history
  • Loading branch information
ElD4n1 committed Feb 13, 2022
1 parent c709d77 commit 6849c80
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ This integration is based on the BMS Tools project by Eric Poulsen: https://gitl
A config flow is available that allows selecting the serial port of the connected BMS and assigning a serial number to connect multiple BMS.<br>
Bluetooth is not supported (yet) by the underlying library.

Installable via HACS as custom repository ([Guide](https://codingcyclist.medium.com/how-to-install-any-custom-component-from-github-in-less-than-5-minutes-ad84e6dc56ff)).

# Currently supported BMS
- JBD / Overkill Solar

Expand Down
4 changes: 4 additions & 0 deletions custom_components/bmstools/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,10 @@ async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:

unload_ok = await hass.config_entries.async_unload_platforms(entry, PLATFORMS)

# Ensure that client is closed
client: JBD = hass.data[DOMAIN][entry.entry_id][HASS_DATA_CLIENT]
client.close()

if unload_ok:
hass.data[DOMAIN].pop(entry.entry_id)

Expand Down
2 changes: 1 addition & 1 deletion custom_components/bmstools/manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"domain": "bmstools",
"name": "BMS Tools",
"version": "1.0.0-rc2",
"version": "1.0.0-rc3",
"config_flow": true,
"documentation": "https://github.com/ElD4n1/home-assistant-bms-tools-integration",
"issue_tracker": "https://github.com/ElD4n1/home-assistant-bms-tools-integration/issues",
Expand Down

0 comments on commit 6849c80

Please sign in to comment.