-
Notifications
You must be signed in to change notification settings - Fork 91
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
Add floor heating device class #362
Closed
Closed
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
feb1fea
Create zigbee_fht.json
CFenner 3375c99
add floorheating
CFenner 6c02930
add tests
CFenner f66068f
Update PyViCareFloorHeatingDevice.py
CFenner fad98d8
Update test_zigbee_fht.py
CFenner f5d362a
Update PyViCareFloorHeatingDevice.py
CFenner f21a145
Update zigbee_fht.json
CFenner File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
from PyViCare.PyViCareHeatingDevice import HeatingDevice | ||
from PyViCare.PyViCareUtils import handleNotSupported | ||
|
||
|
||
class RadiatorActuator(HeatingDevice): | ||
|
||
@handleNotSupported | ||
def getSerial(self): | ||
return self.service.getProperty("device.name")["deviceId"] | ||
|
||
@handleNotSupported | ||
def getSupplyTemperature(self): | ||
return self.service.getProperty("fht.sensors.temperature.supply")["properties"]["value"]["value"] | ||
|
||
@handleNotSupported | ||
def getModes(self): | ||
return self.service.getProperty("fht.operating.modes.active")["commands"]["setMode"]["params"]["mode"]["constraints"]["enum"] | ||
|
||
@handleNotSupported | ||
def getActiveMode(self): | ||
return self.service.getProperty("fht.operating.modes.active")["properties"]["value"]["value"] | ||
|
||
def setMode(self, mode): | ||
""" Set the active mode | ||
Parameters | ||
---------- | ||
mode : str | ||
Valid mode can be obtained using getModes() | ||
|
||
Returns | ||
------- | ||
result: json | ||
json representation of the answer | ||
""" | ||
return self.service.setProperty("fht.operating.modes.active", "setMode", {'mode': mode}) |
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,130 @@ | ||
{ | ||
"data": [ | ||
{ | ||
"apiVersion": 1, | ||
"commands": {}, | ||
"deviceId": "zigbee-1a1a1a1a1a1a1a1a", | ||
"feature": "device.messages.errors.raw", | ||
"gatewayId": "################", | ||
"isEnabled": false, | ||
"isReady": true, | ||
"properties": {}, | ||
"timestamp": "2024-03-01T04:40:59.911Z", | ||
"uri": "https://api.viessmann.com/iot/v1/features/installations/#######/gateways/################/devices/zigbee-1a1a1a1a1a1a1a1a/features/device.messages.errors.raw" | ||
}, | ||
{ | ||
"apiVersion": 1, | ||
"commands": { | ||
"setName": { | ||
"isExecutable": true, | ||
"name": "setName", | ||
"params": { | ||
"name": { | ||
"constraints": { | ||
"maxLength": 40, | ||
"minLength": 1, | ||
"regEx": "^[\\p{L}0-9]+( [\\p{L}0-9]+)*$" | ||
}, | ||
"required": true, | ||
"type": "string" | ||
} | ||
}, | ||
"uri": "https://api.viessmann.com/iot/v1/features/installations/#######/gateways/################/devices/zigbee-1a1a1a1a1a1a1a1a/features/device.name/commands/setName" | ||
} | ||
}, | ||
"deviceId": "zigbee-1a1a1a1a1a1a1a1a", | ||
"feature": "device.name", | ||
"gatewayId": "################", | ||
"isEnabled": true, | ||
"isReady": true, | ||
"properties": { | ||
"name": { | ||
"type": "string", | ||
"value": "" | ||
} | ||
}, | ||
"timestamp": "2024-03-01T04:40:59.911Z", | ||
"uri": "https://api.viessmann.com/iot/v1/features/installations/#######/gateways/################/devices/zigbee-1a1a1a1a1a1a1a1a/features/device.name" | ||
}, | ||
{ | ||
"apiVersion": 1, | ||
"commands": {}, | ||
"deviceId": "zigbee-1a1a1a1a1a1a1a1a", | ||
"feature": "fht.operating.modes.active", | ||
"gatewayId": "################", | ||
"isEnabled": true, | ||
"isReady": true, | ||
"properties": { | ||
"value": { | ||
"type": "string", | ||
"value": "standby" | ||
} | ||
}, | ||
"timestamp": "2024-03-01T04:40:59.911Z", | ||
"uri": "https://api.viessmann.com/iot/v1/features/installations/#######/gateways/################/devices/zigbee-1a1a1a1a1a1a1a1a/features/fht.operating.modes.active" | ||
}, | ||
{ | ||
"apiVersion": 1, | ||
"commands": {}, | ||
"deviceId": "zigbee-1a1a1a1a1a1a1a1a", | ||
"feature": "fht.operating.modes.cooling", | ||
"gatewayId": "################", | ||
"isEnabled": true, | ||
"isReady": true, | ||
"properties": { | ||
"active": { | ||
"type": "boolean", | ||
"value": false | ||
} | ||
}, | ||
"timestamp": "2024-03-01T04:40:59.911Z", | ||
"uri": "https://api.viessmann.com/iot/v1/features/installations/#######/gateways/################/devices/zigbee-1a1a1a1a1a1a1a1a/features/fht.operating.modes.cooling" | ||
}, | ||
{ | ||
"apiVersion": 1, | ||
"commands": {}, | ||
"deviceId": "zigbee-1a1a1a1a1a1a1a1a", | ||
"feature": "fht.operating.modes.heating", | ||
"gatewayId": "################", | ||
"isEnabled": true, | ||
"isReady": true, | ||
"properties": { | ||
"active": { | ||
"type": "boolean", | ||
"value": false | ||
} | ||
}, | ||
"timestamp": "2024-03-01T04:40:59.911Z", | ||
"uri": "https://api.viessmann.com/iot/v1/features/installations/#######/gateways/################/devices/zigbee-1a1a1a1a1a1a1a1a/features/fht.operating.modes.heating" | ||
}, | ||
{ | ||
"apiVersion": 1, | ||
"commands": {}, | ||
"deviceId": "zigbee-1a1a1a1a1a1a1a1a", | ||
"feature": "fht.operating.modes.standby", | ||
"gatewayId": "################", | ||
"isEnabled": true, | ||
"isReady": true, | ||
"properties": { | ||
"active": { | ||
"type": "boolean", | ||
"value": true | ||
} | ||
}, | ||
"timestamp": "2024-03-01T04:40:59.911Z", | ||
"uri": "https://api.viessmann.com/iot/v1/features/installations/#######/gateways/################/devices/zigbee-1a1a1a1a1a1a1a1a/features/fht.operating.modes.standby" | ||
}, | ||
{ | ||
"apiVersion": 1, | ||
"commands": {}, | ||
"deviceId": "zigbee-1a1a1a1a1a1a1a1a", | ||
"feature": "fht.sensors.temperature.supply", | ||
"gatewayId": "################", | ||
"isEnabled": false, | ||
"isReady": true, | ||
"properties": {}, | ||
"timestamp": "2024-03-01T04:40:59.911Z", | ||
"uri": "https://api.viessmann.com/iot/v1/features/installations/#######/gateways/################/devices/zigbee-1a1a1a1a1a1a1a1a/features/fht.sensors.temperature.supply" | ||
} | ||
] | ||
} |
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,32 @@ | ||
import unittest | ||
|
||
from PyViCare.PyViCareRadiatorActuator import RadiatorActuator | ||
from tests.ViCareServiceMock import ViCareServiceMock | ||
|
||
|
||
class ZK03840(unittest.TestCase): | ||
def setUp(self): | ||
self.service = ViCareServiceMock('response/zigbee_fht.json') | ||
self.device = RadiatorActuator(self.service) | ||
|
||
def test_getSerial(self): | ||
self.assertEqual( | ||
self.device.getSerial(), "zigbee-1a1a1a1a1a1a1a1a") | ||
|
||
def test_getTemperature(self): | ||
self.assertEqual( | ||
self.device.getTemperature(), 18.5) | ||
|
||
def test_getTargetTemperature(self): | ||
self.assertEqual( | ||
self.device.getTargetTemperature(), 18) | ||
|
||
def test_setTargetTemperature(self): | ||
self.device.setTargetTemperature(22) | ||
self.assertEqual(len(self.service.setPropertyData), 1) | ||
self.assertEqual( | ||
self.service.setPropertyData[0]['property_name'], 'trv.temperature') | ||
self.assertEqual( | ||
self.service.setPropertyData[0]['action'], 'setTargetTemperature') | ||
self.assertEqual(self.service.setPropertyData[0]['data'], { | ||
'temperature': 22}) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Get via
device.name
as long as nodevice.serial
is provided by Viessmann.