Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove HEMS an EEBus devices and change TCU handling to gateway #364

Merged
merged 10 commits into from
Apr 2, 2024
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 2 additions & 14 deletions PyViCare/PyViCare.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,20 +52,8 @@ def __extract_devices(self):
for installation in self.installations:
for gateway in installation.gateways:
for device in gateway.devices:
if device.deviceType not in ["heating", "zigbee", "vitoconnect", "electricityStorage", "EEBus", "hems", "tcu", "ventilation"]:
continue # we are only interested in heating, photovoltaic, electricityStorage, hems and ventilation devices

if device.id == "gateway" and device.deviceType == "vitoconnect":
device.id = "0" # vitoconnect has no device id, so we use 0

if device.id == "gateway" and device.deviceType == "tcu":
device.id = "0" # tcu has no device id, so we use 0

if device.id == "HEMS" and device.deviceType == "hems":
device.id = "0" # hems has no device id, so we use 0

if device.id == "EEBUS" and device.deviceType == "EEBus":
device.id = "0" # EEBus has no device id,
if device.deviceType not in ["heating", "zigbee", "vitoconnect", "electricityStorage", "tcu", "ventilation"]:
continue # we are only interested in heating, photovoltaic, electricityStorage, and ventilation devices

accessor = ViCareDeviceAccessor(
installation.id, gateway.serial, device.id)
Expand Down
6 changes: 2 additions & 4 deletions PyViCare/PyViCareDeviceConfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,8 @@ def asAutoDetectDevice(self):
(self.asPelletsBoiler, r"Vitoligno|Ecotronic|VBC550P", []),
(self.asRadiatorActuator, r"E3_RadiatorActuator", ["type:radiator"]),
(self.asRoomSensor, r"E3_RoomSensor", ["type:climateSensor"]),
(self.asElectricalEnergySystem, r"E3_HEMS", ["type:hems"]),
(self.asElectricalEnergySystem, r"E3_TCU10_x07", ["type:tcu"]),
(self.asElectricalEnergySystem, r"E3_EEBus", ["type:eebus"]),
(self.asElectricalEnergySystem, r"E3_VitoCharge_03", ["type:energy_storage"]),
(self.asGateway, r"E3_TCU10_x07", ["type:gateway;TCU300"]),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The TCU could probably also be ignored in the HA integration, right?

https://github.com/home-assistant/core/blob/dev/homeassistant/components/vicare/const.py#L18

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, the TCU does not provide any information

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you create the PR in the Home Assistant Repo?

(self.asElectricalEnergySystem, r"E3_VitoCharge_03", ["type:ees"]),
(self.asVentilation, r"E3_ViAir", ["type:ventilation"]),
(self.asGateway, r"Heatbox1", ["type:gateway;VitoconnectOpto1"])
]
Expand Down
2 changes: 1 addition & 1 deletion PyViCare/PyViCareService.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@
return f'/features/installations/{self.accessor.id}/gateways/{self.accessor.serial}/devices/{self.accessor.device_id}/features/{property_name}'


def hasRoles(self, requested_roles) -> bool:

Check failure on line 53 in PyViCare/PyViCareService.py

View workflow job for this annotation

GitHub Actions / build (3.8)

E303 too many blank lines (2)

Check failure on line 53 in PyViCare/PyViCareService.py

View workflow job for this annotation

GitHub Actions / build (3.9)

E303 too many blank lines (2)
return hasRoles(requested_roles, self.roles)

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

def setProperty(self, property_name: str, action: str, data: Any) -> Any:
url = buildSetPropertyUrl(
Expand Down
107 changes: 107 additions & 0 deletions tests/response/TCU300_ethernet.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
{
"data": [
{
"feature": "gateway.devices",
"gatewayId": "################",
"timestamp": "2024-03-17T18:55:46.182Z",
"isEnabled": true,
"isReady": true,
"apiVersion": 1,
"uri": "https://api.viessmann.com/iot/v1/features/installations/252756/gateways/################/features/gateway.devices",
"properties": {
"devices": {
"type": "DeviceList",
"value": [
{
"id": "gateway",
"fingerprint": "####",
"modelId": "E3_TCU10_x07",
"modelVersion": "####",
"name": "TCU",
"type": "tcu",
"roles": [
"capability:hems",
"capability:zigbeeCoordinator",
"type:E3",
"type:gateway;TCU300"
],
"status": "online"
},
{
"id": "HEMS",
"fingerprint": "###",
"modelId": "E3_HEMS",
"modelVersion": "###",
"name": "Home Energy Management System",
"type": "hems",
"roles": [
"type:E3",
"type:virtual;hems"
],
"status": "online"
},
{
"id": "RoomControl-1",
"fingerprint": "###",
"modelId": "E3_RoomControl_One_525",
"modelVersion": "####",
"name": "E3_RoomControl_One_525",
"type": "roomControl",
"roles": [
"capability:monetization;FTDC",
"capability:monetization;OWD",
"capability:zigbeeCoordinator",
"type:E3",
"type:virtual;smartRoomControl"
],
"status": "online"
},
{
"id": "EEBUS",
"fingerprint": "#####",
"modelId": "E3_EEBus",
"modelVersion": "#####",
"name": "accessories",
"type": "EEBus",
"roles": [
"type:E3",
"type:accessory;eeBus"
],
"status": "online"
},
{
"id": "0",
"fingerprint": "ecu;#####",
"modelId": "E3_VitoCharge_03",
"modelVersion": "####",
"name": "E3 device",
"type": "electricityStorage",
"roles": [
"capability:hems",
"type:E3",
"type:ess",
"type:photovoltaic;Internal",
"type:product;Vitocharge"
],
"status": "online"
},
{
"id": "eebus-1",
"fingerprint": "eebus:wallbox;########",
"modelId": "E3_HEMS_VCS",
"modelVersion": "####",
"name": "Home Energy Management System",
"type": "vehicleChargingStation",
"roles": [
"type:E3",
"type:accessory;vehicleChargingStation"
],
"status": "online"
}
]
}
},
"commands": {}
}
]
}
19 changes: 19 additions & 0 deletions tests/test_E3_TCU300_ethernet.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import unittest

from PyViCare.PyViCareGateway import Gateway
from PyViCare.PyViCareUtils import PyViCareNotSupportedFeatureError
from tests.ViCareServiceMock import ViCareServiceMock


class TCU300_ethernet(unittest.TestCase):
def setUp(self):
self.service = ViCareServiceMock('response/TCU300_ethernet.json')
self.device = Gateway(self.service)

def test_getSerial(self):
self.assertEqual(
self.device.getSerial(), "################")

def test_getWifiSignalStrength(self):
with self.assertRaises(PyViCareNotSupportedFeatureError):
self.device.getWifiSignalStrength()
Loading