Skip to content

Commit

Permalink
Merge pull request #17 from MTrab:Update-API-as-pr-Danfoss-request
Browse files Browse the repository at this point in the history
Update API to support new endpoints from Danfoss
  • Loading branch information
MTrab authored Feb 5, 2024
2 parents 8f9bda4 + 7a1947c commit a73009a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
13 changes: 6 additions & 7 deletions pydanfossally/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Module for handling Danfoss Ally API communication"""

from __future__ import annotations

import logging
Expand Down Expand Up @@ -105,11 +106,11 @@ def handleDeviceData(self, device: dict):
elif status["code"] in ["local_temperature", "ext_measured_rs"]:
temperature = float(status["value"]) / 100
self.devices[device["id"]][status["code"]] = temperature
elif status["code"] == "va_temperature":
elif status["code"] == "temp_current":
temperature = float(status["value"])
temperature = temperature / 10
self.devices[device["id"]]["temperature"] = temperature
elif status["code"] == "va_humidity":
elif status["code"] == "humidity_value":
humidity = float(status["value"])
humidity = humidity / 10
self.devices[device["id"]]["humidity"] = humidity
Expand All @@ -132,18 +133,16 @@ def handleDeviceData(self, device: dict):
self.devices[device["id"]]["valve_opening"] = status["value"]
elif status["code"] == "LoadRadiatorRoomMean":
self.devices[device["id"]]["load_room_mean"] = status["value"]
elif status["code"] == "sensor_avg_temp":
elif status["code"] == "ext_measured_rs":
self.devices[device["id"]]["external_sensor_temperature"] = (
float(status["value"]) / 10
)
elif status["code"] in [
"window_toggle",
"switch",
"switch_state",
"room_sensor",
"heat_supply_request",
"boiler_relay",
"factory_reset",
"mounting_mode_active",
"heat_available",
"load_balance_enable",
Expand All @@ -163,12 +162,12 @@ def handleDeviceData(self, device: dict):
"child_lock",
"mode",
"work_state",
"banner_ctrl",
"Load_estimate",
"load_balance_enable",
"fault",
"sw_error_code",
"ctrl_alg",
"adaptation_runstatus",
"SetpointChangeSource",
]:
self.devices[device["id"]][status["code"].lower()] = status["value"]

Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
requests
requests==2.31.0

0 comments on commit a73009a

Please sign in to comment.