Skip to content

Commit

Permalink
Merge branch 'master' into fht
Browse files Browse the repository at this point in the history
  • Loading branch information
CFenner authored Nov 19, 2024
2 parents a703810 + 3b7103a commit 28b58f5
Show file tree
Hide file tree
Showing 36 changed files with 10,027 additions and 1,918 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: ⤵️ Check out code from GitHub
uses: actions/[email protected].0
uses: actions/[email protected].2
- name: 🚀 Sort test response data
run: |
find './tests/response' \
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: ⤵️ Check out code from GitHub
uses: actions/[email protected].0
uses: actions/[email protected].2
- name: 🏗 Set up Poetry
run: pipx install poetry
- name: 🏗 Set up Python ${{ env.DEFAULT_PYTHON }}
id: python
uses: actions/setup-python@v5.2.0
uses: actions/setup-python@v5.3.0
with:
python-version: ${{ env.DEFAULT_PYTHON }}
cache: "poetry"
Expand All @@ -38,12 +38,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: ⤵️ Check out code from GitHub
uses: actions/[email protected].0
uses: actions/[email protected].2
- name: 🏗 Set up Poetry
run: pipx install poetry
- name: 🏗 Set up Python ${{ env.DEFAULT_PYTHON }}
id: python
uses: actions/setup-python@v5.2.0
uses: actions/setup-python@v5.3.0
with:
python-version: ${{ env.DEFAULT_PYTHON }}
cache: "poetry"
Expand All @@ -63,12 +63,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: ⤵️ Check out code from GitHub
uses: actions/[email protected].0
uses: actions/[email protected].2
- name: 🏗 Set up Poetry
run: pipx install poetry
- name: 🏗 Set up Python ${{ env.DEFAULT_PYTHON }}
id: python
uses: actions/setup-python@v5.2.0
uses: actions/setup-python@v5.3.0
with:
python-version: ${{ env.DEFAULT_PYTHON }}
cache: "poetry"
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ jobs:
id-token: write
steps:
- name: ⤵️ Check out code from GitHub
uses: actions/[email protected].0
uses: actions/[email protected].2
- name: 🏗 Set up Poetry
run: pipx install poetry
- name: 🏗 Set up Python ${{ env.DEFAULT_PYTHON }}
id: python
uses: actions/setup-python@v5.2.0
uses: actions/setup-python@v5.3.0
with:
python-version: ${{ env.DEFAULT_PYTHON }}
cache: "poetry"
Expand All @@ -45,7 +45,7 @@ jobs:
- name: 🏗 Build package
run: poetry build --no-interaction
- name: 🚀 Publish to PyPi
uses: pypa/gh-action-pypi-publish@v1.10.2
uses: pypa/gh-action-pypi-publish@v1.12.2
with:
verbose: true
print-hash: true
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python: ["3.8", "3.9", "3.10", "3.11", "3.12"]
python: ["3.9", "3.10", "3.11", "3.12"]
steps:
- name: ⤵️ Check out code from GitHub
uses: actions/[email protected].0
uses: actions/[email protected].2
- name: 🏗 Set up Poetry
run: pipx install poetry
- name: 🏗 Set up Python ${{ matrix.python }}
id: python
uses: actions/setup-python@v5.2.0
uses: actions/setup-python@v5.3.0
with:
python-version: ${{ matrix.python }}
cache: "poetry"
Expand All @@ -39,7 +39,7 @@ jobs:
- name: 🚀 Run pytest
run: poetry run pytest --cov PyViCare
- name: ⬆️ Upload coverage artifact
uses: actions/[email protected].0
uses: actions/[email protected].3
with:
name: coverage-${{ matrix.python }}
path: .coverage
4 changes: 2 additions & 2 deletions .github/workflows/type.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: ⤵️ Check out code from GitHub
uses: actions/[email protected].0
uses: actions/[email protected].2
- name: 🏗 Set up Poetry
run: pipx install poetry
- name: 🏗 Set up Python ${{ env.DEFAULT_PYTHON }}
id: python
uses: actions/setup-python@v5.2.0
uses: actions/setup-python@v5.3.0
with:
python-version: ${{ env.DEFAULT_PYTHON }}
cache: "poetry"
Expand Down
23 changes: 22 additions & 1 deletion PyViCare/PyViCareDevice.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from PyViCare.PyViCareService import ViCareService
from PyViCare.PyViCareUtils import handleNotSupported
from PyViCare.PyViCareUtils import PyViCareNotSupportedFeatureError, handleNotSupported


class Device:
Expand All @@ -15,3 +15,24 @@ def __init__(self, service: ViCareService) -> None:
@handleNotSupported
def getSerial(self):
return self.service.getProperty("device.serial")["properties"]["value"]["value"]

def isLegacyDevice(self) -> bool:
return self.service.hasRoles(["type:legacy"])

def isE3Device(self) -> bool:
return self.service.hasRoles(["type:E3"])

def isDomesticHotWaterDevice(self):
return self._isTypeDevice("heating.dhw")

def isSolarThermalDevice(self):
return self._isTypeDevice("heating.solar")

def isVentilationDevice(self):
return self._isTypeDevice("ventilation")

def _isTypeDevice(self, deviceType: str):
try:
return self.service.getProperty(deviceType)["isEnabled"] and self.service.getProperty(deviceType)["properties"]["active"]["value"]
except PyViCareNotSupportedFeatureError:
return False
3 changes: 3 additions & 0 deletions PyViCare/PyViCareDeviceConfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,12 @@ def asAutoDetectDevice(self):
(self.asPelletsBoiler, r"Vitoligno|Ecotronic|VBC550P", []),
(self.asElectricalEnergySystem, r"E3_VitoCharge_03", ["type:ees"]),
(self.asVentilation, r"E3_ViAir", ["type:ventilation"]),
(self.asVentilation, r"E3_ViAir", ["type:ventilation;central"]),
(self.asVentilation, r"E3_VitoPure", ["type:ventilation;purifier"]),
(self.asRadiatorActuator, r"E3_RadiatorActuator", ["type:radiator"]),
(self.asFloorHeating, r"E3_FloorHeatingCircuitDistributorBox", ["type:fhtMain"]),
(self.asRoomSensor, r"E3_RoomSensor", ["type:climateSensor"]),
(self.asGateway, r"E3_TCU41_x04", ["type:gateway;TCU100"]),
(self.asGateway, r"E3_TCU19_x05", ["type:gateway;TCU200"]),
(self.asGateway, r"E3_TCU10_x07", ["type:gateway;TCU300"]),
(self.asGateway, r"Heatbox1", ["type:gateway;VitoconnectOpto1"]),
Expand Down
25 changes: 17 additions & 8 deletions PyViCare/PyViCareHeatingDevice.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,16 +66,30 @@ def getOutsideTemperature(self):
def getDomesticHotWaterConfiguredTemperature(self):
return self.service.getProperty("heating.dhw.temperature.main")["properties"]["value"]["value"]

@handleNotSupported
def getDomesticHotWaterStorageTemperature(self):
return self.service.getProperty("heating.dhw.sensors.temperature.dhwCylinder")["properties"]["value"][
"value"]

@handleNotSupported
def getHotWaterStorageTemperatureTop(self):
return self.service.getProperty("heating.dhw.sensors.temperature.dhwCylinder.top")["properties"]["value"][
"value"]

@handleNotSupported
def getDomesticHotWaterStorageTemperatureMiddle(self):
return self.service.getProperty("heating.dhw.sensors.temperature.dhwCylinder.middle")["properties"]["value"][
"value"]

@handleNotSupported
def getDomesticHotWaterStorageTemperatureMidBottom(self):
return self.service.getProperty("heating.dhw.sensors.temperature.dhwCylinder.midBottom")["properties"]["value"][
"value"]

@handleNotSupported
def getHotWaterStorageTemperatureBottom(self):
return \
self.service.getProperty("heating.dhw.sensors.temperature.dhwCylinder.bottom")["properties"]["value"][
"value"]
return self.service.getProperty("heating.dhw.sensors.temperature.dhwCylinder.bottom")["properties"]["value"][
"value"]

@handleNotSupported
def getDomesticHotWaterConfiguredTemperature2(self):
Expand Down Expand Up @@ -113,11 +127,6 @@ def getDomesticHotWaterDesiredTemperature(self):

return None

@handleNotSupported
def getDomesticHotWaterStorageTemperature(self):
return self.service.getProperty("heating.dhw.sensors.temperature.dhwCylinder")["properties"]["value"][
"value"]

@handleNotSupported
def getDomesticHotWaterOutletTemperature(self):
return self.service.getProperty("heating.dhw.sensors.temperature.outlet")["properties"]["value"]["value"]
Expand Down
4 changes: 2 additions & 2 deletions PyViCare/PyViCareRadiatorActuator.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from PyViCare.PyViCareHeatingDevice import HeatingDevice
from PyViCare.PyViCareDevice import Device
from PyViCare.PyViCareUtils import handleAPICommandErrors, handleNotSupported


class RadiatorActuator(HeatingDevice):
class RadiatorActuator(Device):

@handleNotSupported
def getTemperature(self):
Expand Down
2 changes: 1 addition & 1 deletion PyViCare/PyViCareService.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def hasRoles(self, requested_roles) -> bool:
return hasRoles(requested_roles, self.roles)

def _isGateway(self) -> bool:
return self.hasRoles(["type:gateway;VitoconnectOpto1"]) or self.hasRoles(["type:gateway;VitoconnectOpto2/OT2"]) or self.hasRoles(["type:gateway;TCU300"])
return self.hasRoles(["type:gateway;VitoconnectOpto1"]) or self.hasRoles(["type:gateway;VitoconnectOpto2/OT2"]) or self.hasRoles(["type:gateway;TCU100"]) or self.hasRoles(["type:gateway;TCU200"]) or self.hasRoles(["type:gateway;TCU300"])

def setProperty(self, property_name: str, action: str, data: Any) -> Any:
url = buildSetPropertyUrl(
Expand Down
Loading

0 comments on commit 28b58f5

Please sign in to comment.