Skip to content

Commit

Permalink
removed unused 'id' field in dev description
Browse files Browse the repository at this point in the history
  • Loading branch information
modrisb committed Aug 11, 2023
1 parent 4a32a81 commit 1594482
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 13 deletions.
1 change: 0 additions & 1 deletion custom_components/pijups/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@ def configure_device(self, hass: HomeAssistant, entry: ConfigEntry):
raise BlockingIOError

self.piju_device_info = DeviceInfo(
id=entry.unique_id,
identifiers={(DOMAIN, entry.unique_id)},
name=DEFAULT_NAME,
sw_version=self.fw_version,
Expand Down
2 changes: 1 addition & 1 deletion custom_components/pijups/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"documentation": "https://github.com/modrisb/pijups/",
"issue_tracker": "https://github.com/modrisb/pijups/issues",
"requirements": ["smbus2==0.4.1"],
"version": "1.2.3",
"version": "1.2.4",
"dependencies": [],
"codeowners": ["@modrisb"],
"config_flow": true,
Expand Down
7 changes: 7 additions & 0 deletions custom_components/pijups/pijuice.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import sys
import threading
import time
import logging

from smbus2 import SMBus

Expand All @@ -23,6 +24,7 @@
"USER_FUNC" + str(i + 1) for i in range(0, 15)
]

_LOGGER = logging.getLogger(__name__)

class PiJuiceInterface(object):
def __init__(self, bus=1, address=0x14):
Expand Down Expand Up @@ -82,13 +84,15 @@ def _Write(self):

def _DoTransfer(self, oper):
self.force = True if (self.t is not None and self.t.is_alive()) else None
#_LOGGER.debug(f"_DoTransfer force={self.force}")
self.t = threading.Thread(target=oper, args=())
self.t.start()

# wait for transfer to finish or timeout
self.t.join(timeout=0.1)

r_code = not (self.comError or self.t.is_alive())
#_LOGGER.debug(f"_DoTransfer return code={r_code}")
return r_code

def ReadData(self, cmd, length):
Expand All @@ -101,6 +105,7 @@ def ReadData(self, cmd, length):
return {"error": "COMMUNICATION_ERROR"}

d = self.d
_LOGGER.info("ReadData cmd 0x%x= %s %x (%x)", cmd, d, d[-1], self._GetChecksum(d[0:-1]))
if self._GetChecksum(d[0:-1]) != d[-1]:
# With n+1 byte data (n data bytes and 1 checksum byte) sometimes the
# MSbit of the first received data byte is 0 while it should be 1. So we
Expand All @@ -109,6 +114,8 @@ def ReadData(self, cmd, length):
if self._GetChecksum(d[0:-1]) == d[-1]:
del d[-1]
return {"data": d, "error": "NO_ERROR"}
_LOGGER.info(
"ReadData cmd 0x%x= %x (%x)", cmd, d, self._GetChecksum(d[0:-1]))
return {"error": "DATA_CORRUPTED"}
del d[-1]
return {"data": d, "error": "NO_ERROR"}
Expand Down
22 changes: 11 additions & 11 deletions custom_components/pijups/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,27 +86,27 @@
},
"selector": {
"battery_profile_status": {
"options" : {
"PJZERO_1000": "PJZERO 1000",
"options": {
"BP6X_1400": "BP6X 1400",
"BP7X_1820": "BP7X 1820",
"SNN5843_2300": "SNN5843 2300",
"PJBP7X_1600": "PJBP7X 1600",
"PJLIPO_12000": "PJLIPO 12000",
"PJLIPO_2500": "PJLIPO 2500",
"PJLIPO_500": "PJLIPO 500",
"PJLIPO_5000": "PJLIPO 5000",
"PJBP7X_1600": "PJBP7X 1600",
"PJLIPO_600": "PJLIPO 600",
"PJSNN5843_1300": "PJSNN5843 1300",
"PJZERO_1000": "PJZERO 1000",
"PJZERO_1200": "PJZERO 1200",
"BP6X_1400": "BP6X 1400",
"PJLIPO_600": "PJLIPO 600",
"PJLIPO_500": "PJLIPO 500",
"PJLIPO_2500": "PJLIPO 2500"
"SNN5843_2300": "SNN5843 2300"
}
},
"battery_temp_sense_config": {
"options": {
"AUTO_DETECT": "HAT to select sensor",
"NOT_USED": "temperature not measured",
"NTC": "use battery sensor",
"ON_BOARD": "use on board sensor",
"AUTO_DETECT": "HAT to select sensor"
"ON_BOARD": "use on board sensor"
}
},
"diag_log_config": {
Expand All @@ -121,4 +121,4 @@
}
}
}
}
}

0 comments on commit 1594482

Please sign in to comment.