-
Notifications
You must be signed in to change notification settings - Fork 91
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add PyViCareGateway class (#334)
- Loading branch information
Showing
8 changed files
with
134 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
from PyViCare.PyViCareDevice import Device | ||
from PyViCare.PyViCareUtils import handleNotSupported | ||
|
||
|
||
class Gateway(Device): | ||
|
||
@handleNotSupported | ||
def getWifiSignalStrength(self): | ||
return self.service.getProperty("gateway.wifi")["properties"]["strength"]["value"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
{ | ||
"data": [ | ||
{ | ||
"apiVersion": 1, | ||
"commands": {}, | ||
"feature": "gateway.devices", | ||
"gatewayId": "################", | ||
"isEnabled": true, | ||
"isReady": true, | ||
"properties": { | ||
"devices": { | ||
"type": "DeviceList", | ||
"value": [ | ||
{ | ||
"fingerprint": "xxx", | ||
"id": "gateway", | ||
"modelId": "Heatbox1", | ||
"modelVersion": "xxx", | ||
"name": "Heatbox 1, Vitoconnect", | ||
"roles": [ | ||
"type:gateway;VitoconnectOpto1", | ||
"type:legacy" | ||
], | ||
"status": "online", | ||
"type": "vitoconnect" | ||
}, | ||
{ | ||
"fingerprint": "xxx", | ||
"id": "0", | ||
"modelId": "VScotHO1_40", | ||
"modelVersion": "xxx", | ||
"name": "VT 200 (HO1A / HO1B)", | ||
"roles": [ | ||
"type:boiler", | ||
"type:legacy", | ||
"type:product;VScotHO1" | ||
], | ||
"status": "online", | ||
"type": "heating" | ||
} | ||
] | ||
} | ||
}, | ||
"timestamp": "2023-12-25T04:01:00.448Z", | ||
"uri": "https://api.viessmann.com/iot/v1/features/installations/#######/gateways/################/features/gateway.devices" | ||
}, | ||
{ | ||
"apiVersion": 1, | ||
"commands": {}, | ||
"feature": "gateway.wifi", | ||
"gatewayId": "################", | ||
"isEnabled": true, | ||
"isReady": true, | ||
"properties": { | ||
"strength": { | ||
"type": "number", | ||
"unit": "", | ||
"value": -69 | ||
} | ||
}, | ||
"timestamp": "2023-12-26T20:44:41.417Z", | ||
"uri": "https://api.viessmann.com/iot/v1/features/installations/#######/gateways/################/features/gateway.wifi" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import unittest | ||
|
||
from PyViCare.PyViCareGateway import Gateway | ||
from tests.ViCareServiceMock import ViCareServiceMock | ||
|
||
|
||
class VitoconnectOpto1(unittest.TestCase): | ||
def setUp(self): | ||
self.service = ViCareServiceMock('response/VitoconnectOpto1.json') | ||
self.device = Gateway(self.service) | ||
|
||
def test_getWifiSignalStrength(self): | ||
self.assertEqual( | ||
self.device.getWifiSignalStrength(), -69) |