Skip to content

Commit

Permalink
Fix CI
Browse files Browse the repository at this point in the history
  • Loading branch information
jvitkauskas committed Dec 19, 2023
1 parent b7924d4 commit df641f4
Show file tree
Hide file tree
Showing 9 changed files with 68 additions and 78 deletions.
10 changes: 2 additions & 8 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.12"]
python-version: ["3.7"]

steps:
- uses: actions/checkout@v3
Expand All @@ -27,14 +27,8 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install flake8 pytest
python -m pip install pytest
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
run: |
pytest
Empty file removed __init__.py
Empty file.
2 changes: 1 addition & 1 deletion demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import logging
import sys

from pybls21 import S21Client
from pybls21.client import S21Client


def help():
Expand Down
1 change: 0 additions & 1 deletion pybls21/__init__.py
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
from pybls21.client import S21Client
8 changes: 4 additions & 4 deletions pybls21/client.py
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

from .constants import *
from .exceptions import *
from .models import ClimateDevice, HVACMode, HVACAction, TEMP_CELSIUS, ClimateEntityFeature
from .models import ClimateDevice, ClimateEntityFeature, HVACAction, HVACMode, TEMP_CELSIUS

from typing import Callable, Optional
from typing import Callable, List, Optional
from threading import Lock


def _parse_firmware_version(firmware_info: list[int]) -> str:
def _parse_firmware_version(firmware_info: List[int]) -> str:
major_minor = firmware_info[0]
major = (major_minor & 0xff00) >> 8
minor = major_minor & 0xff
Expand Down Expand Up @@ -82,7 +82,7 @@ def _poll(self) -> ClimateDevice:
current_fan_level: int = holding_registers[HR_SPEED_MODE] # 255 - manual
temp_before_heating_x10: int = input_registers[IR_CurTEMP_SuAirIn]
temp_after_heating_x10: int = input_registers[IR_CurTEMP_SuAirOut]
firmware_info: list[int] = input_registers[IR_VerMAIN_FMW_start:IR_VerMAIN_FMW_end+1]
firmware_info: List[int] = input_registers[IR_VerMAIN_FMW_start:IR_VerMAIN_FMW_end+1]
operation_mode: int = holding_registers[HR_OPERATION_MODE]
manual_fan_speed_percent: int = holding_registers[HR_ManualSPEED]

Expand Down
112 changes: 56 additions & 56 deletions pybls21/models.py
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,56 +1,56 @@
from typing import List, NamedTuple, Optional

from enum import Enum


TEMP_CELSIUS: str = "°C"


class ClimateEntityFeature(int, Enum):
TARGET_TEMPERATURE = 1
FAN_MODE = 8


class HVACMode(str, Enum):
OFF = "off"
HEAT = "heat"
COOL = "cool"
AUTO = "auto"
FAN_ONLY = "fan_only"


class HVACAction(str, Enum):
COOLING = "cooling"
FAN = "fan"
HEATING = "heating"
IDLE = "idle"
OFF = "off"


class ClimateDevice(NamedTuple):
available: bool
name: str
unique_id: str
temperature_unit: str
precision: float
current_temperature: float
target_temperature: float
target_temperature_step: float
max_temp: float
min_temp: float
current_humidity: Optional[float]
hvac_mode: str
hvac_action: str
hvac_modes: List[str]
fan_mode: Optional[int]
fan_modes: Optional[List[int]]
supported_features: int
manufacturer: str
model: Optional[str]
sw_version: Optional[str]
is_boosting: bool
current_intake_temperature: float
manual_fan_speed_percent: int
max_fan_level: int
filter_state: int
alarm_state: int
from typing import List, NamedTuple, Optional

from enum import Enum


TEMP_CELSIUS: str = "°C"


class ClimateEntityFeature(int, Enum):
TARGET_TEMPERATURE = 1
FAN_MODE = 8


class HVACMode(str, Enum):
OFF = "off"
HEAT = "heat"
COOL = "cool"
AUTO = "auto"
FAN_ONLY = "fan_only"


class HVACAction(str, Enum):
COOLING = "cooling"
FAN = "fan"
HEATING = "heating"
IDLE = "idle"
OFF = "off"


class ClimateDevice(NamedTuple):
available: bool
name: str
unique_id: str
temperature_unit: str
precision: float
current_temperature: float
target_temperature: float
target_temperature_step: float
max_temp: float
min_temp: float
current_humidity: Optional[float]
hvac_mode: str
hvac_action: str
hvac_modes: List[str]
fan_mode: Optional[int]
fan_modes: Optional[List[int]]
supported_features: int
manufacturer: str
model: Optional[str]
sw_version: Optional[str]
is_boosting: bool
current_intake_temperature: float
manual_fan_speed_percent: int
max_fan_level: int
filter_state: int
alarm_state: int
4 changes: 0 additions & 4 deletions pyproject.toml

This file was deleted.

4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@

setuptools.setup(
name="pybls21",
version="3.0.1",
version="3.0.2",
author="Julius Vitkauskas",
author_email="[email protected]",
description="An api allowing control of AC state (temperature, on/off, speed) of an Blauberg S21 device locally over TCP",
long_description=long_description,
long_description_content_type="text/markdown",
url="https://github.com/jvitkauskas/pybls21",
packages=setuptools.find_packages(),
packages=setuptools.find_packages(exclude=["tests"]),
install_requires=['pyModbusTCP>=0.2.1,<1.0'],
classifiers=[
"Programming Language :: Python :: 3",
Expand Down
5 changes: 3 additions & 2 deletions tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@

from pyModbusTCP.server import ModbusServer, DataBank

from pybls21.constants import *
from pybls21.exceptions import *
from pybls21.client import S21Client
from pybls21.constants import *
from pybls21.models import HVACAction, HVACMode, ClimateDevice, ClimateEntityFeature


Expand Down Expand Up @@ -304,6 +303,8 @@ def test_set_temperature(self):


class TestDataBank(DataBank):
__test__ = False

def __init__(self):
super().__init__(coils_size=25, d_inputs_size=72, h_regs_size=182, i_regs_size=51)
self.reset()
Expand Down

0 comments on commit df641f4

Please sign in to comment.