diff --git a/.github/workflows/make_wheel.yml b/.github/workflows/make_wheel.yml index 8d6d5a1..1d592c1 100644 --- a/.github/workflows/make_wheel.yml +++ b/.github/workflows/make_wheel.yml @@ -13,7 +13,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Prepare python - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: '3.10' diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index 14a84fd..b9be234 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -11,7 +11,7 @@ jobs: steps: - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - name: Install dependencies diff --git a/e3dc/_e3dc.py b/e3dc/_e3dc.py index 6c86a5d..8831470 100644 --- a/e3dc/_e3dc.py +++ b/e3dc/_e3dc.py @@ -318,9 +318,7 @@ def poll(self, keepAlive: bool = False): "production": {"solar": solar, "add": -add, "grid": grid}, "selfConsumption": sc, "stateOfCharge": soc, - "time": datetime.datetime.utcfromtimestamp(ts).replace( - tzinfo=datetime.timezone.utc - ), + "time": datetime.datetime.fromtimestamp(ts, tz=datetime.timezone.utc), } self.lastRequest = outObj @@ -1247,9 +1245,9 @@ def get_battery_data( (RscpTag.BAT_REQ_DCB_INFO, RscpType.Uint16, dcb), ], ), - keepAlive=True - if dcb != dcbs[-1] - else keepAlive, # last request should honor keepAlive + keepAlive=( + True if dcb != dcbs[-1] else keepAlive + ), # last request should honor keepAlive ) info = rscpFindTag(req, RscpTag.BAT_DCB_INFO) @@ -1381,9 +1379,11 @@ def get_batteries_data( self.get_battery_data( batIndex=battery["index"], dcbs=dcbs, - keepAlive=True - if battery["index"] != batteries[-1]["index"] - else keepAlive, # last request should honor keepAlive + keepAlive=( + True + if battery["index"] != batteries[-1]["index"] + else keepAlive + ), # last request should honor keepAlive ) ) @@ -1716,9 +1716,9 @@ def get_pvi_data( ), ], ), - keepAlive=True - if string != strings[-1] - else keepAlive, # last request should honor keepAlive + keepAlive=( + True if string != strings[-1] else keepAlive + ), # last request should honor keepAlive ) stringobj = { "power": rscpFindTagIndex( @@ -1771,9 +1771,9 @@ def get_pvis_data( pviIndex=pvi["index"], strings=strings, phases=phases, - keepAlive=True - if pvi["index"] != pvis[-1]["index"] - else keepAlive, # last request should honor keepAlive + keepAlive=( + True if pvi["index"] != pvis[-1]["index"] else keepAlive + ), # last request should honor keepAlive ) ) @@ -1931,9 +1931,11 @@ def get_powermeters_data( outObj.append( self.get_powermeter_data( pmIndex=powermeter["index"], - keepAlive=True - if powermeter["index"] != powermeters[-1]["index"] - else keepAlive, # last request should honor keepAlive + keepAlive=( + True + if powermeter["index"] != powermeters[-1]["index"] + else keepAlive + ), # last request should honor keepAlive ) ) diff --git a/e3dc/_e3dc_rscp_web.py b/e3dc/_e3dc_rscp_web.py index 5f0ab5f..768607e 100644 --- a/e3dc/_e3dc_rscp_web.py +++ b/e3dc/_e3dc_rscp_web.py @@ -354,10 +354,10 @@ def sendCommand( def _sendRequest_internal( self, innerFrame: bytes | Tuple[str | int | RscpTag, str | int | RscpType, Any], - callback: Callable[ - [Tuple[str | int | RscpTag, str | int | RscpType, Any]], None - ] - | None = None, + callback: ( + Callable[[Tuple[str | int | RscpTag, str | int | RscpType, Any]], None] + | None + ) = None, ): """Internal send request method. diff --git a/e3dc/_rscpLib.py b/e3dc/_rscpLib.py index aa37180..4dde4fa 100644 --- a/e3dc/_rscpLib.py +++ b/e3dc/_rscpLib.py @@ -85,9 +85,9 @@ def rscpFindTag( if decodedMsg[0] == tagStr: return decodedMsg if isinstance(decodedMsg[2], list): - msgList: List[ - Tuple[str | int | RscpTag, str | int | RscpType, Any] - ] = decodedMsg[2] + msgList: List[Tuple[str | int | RscpTag, str | int | RscpType, Any]] = ( + decodedMsg[2] + ) for msg in msgList: msgValue = rscpFindTag(msg, tag) if msgValue is not None: