Skip to content

Commit

Permalink
Add getSerial for gateways (#354)
Browse files Browse the repository at this point in the history
* Update PyViCareGateway.py

* Update test_VitoconnectOpto1.py

* Apply suggestions from code review
  • Loading branch information
CFenner authored Feb 18, 2024
1 parent ceca745 commit 2afa501
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions PyViCare/PyViCareGateway.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@

class Gateway(Device):

@handleNotSupported
def getSerial(self):
return self.service.getProperty("gateway.devices")["gatewayId"]

@handleNotSupported
def getWifiSignalStrength(self):
return self.service.getProperty("gateway.wifi")["properties"]["strength"]["value"]
4 changes: 4 additions & 0 deletions tests/test_VitoconnectOpto1.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ def setUp(self):
self.service = ViCareServiceMock('response/VitoconnectOpto1.json')
self.device = Gateway(self.service)

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

def test_getWifiSignalStrength(self):
self.assertEqual(
self.device.getWifiSignalStrength(), -69)

0 comments on commit 2afa501

Please sign in to comment.