Skip to content

Commit

Permalink
Merge remote-tracking branch 'refs/remotes/origin/wip-stable-7.1.6' i…
Browse files Browse the repository at this point in the history
…nto wip-stable-7.1.6
  • Loading branch information
pipiche38 committed Nov 21, 2023
2 parents 9a1a3d2 + d448ee1 commit 4dcb9f7
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 6 deletions.
11 changes: 9 additions & 2 deletions Modules/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
tuya_lidl_set_mode, tuya_trv_brt100_set_mode,
tuya_trv_mode, tuya_trv_onoff,
tuya_trv_switch_onoff)
from Modules.danfoss import danfoss_on_off
from Modules.tuyaTS0601 import ts0601_actuator, ts0601_extract_data_point_infos
from Modules.zigateConsts import (THERMOSTAT_LEVEL_2_MODE,
THERMOSTAT_LEVEL_3_MODE, ZIGATE_EP)
Expand Down Expand Up @@ -504,7 +505,10 @@ def mgtCommand(self, Devices, Unit, Command, Level, Color):

elif DeviceType == "ThermoOnOff":
self.log.logging("Command", "Debug", "ThermoOnOff - requested Off", NWKID)
tuya_trv_onoff(self, NWKID, 0x00)
if "Model" in self.ListOfDevices[NWKID] and self.ListOfDevices[NWKID]["Model"] in ("eTRV0100"):
danfoss_on_off(self, NWKID, 0x00)
else:
tuya_trv_onoff(self, NWKID, 0x00)
UpdateDevice_v2(self, Devices, Unit, 0, "Off", BatteryLevel, SignalLevel, ForceUpdate_=forceUpdateDev)

elif DeviceType == "ShutterCalibration":
Expand Down Expand Up @@ -689,7 +693,10 @@ def mgtCommand(self, Devices, Unit, Command, Level, Color):
thermostat_Mode(self, NWKID, "Heat")

elif DeviceType == "ThermoOnOff":
tuya_trv_onoff(self, NWKID, 0x01)
if "Model" in self.ListOfDevices[NWKID] and self.ListOfDevices[NWKID]["Model"] in ("eTRV0100"):
danfoss_on_off(self, NWKID, 0x01)
else:
tuya_trv_onoff(self, NWKID, 0x01)
UpdateDevice_v2(self, Devices, Unit, 1, "On", BatteryLevel, SignalLevel, ForceUpdate_=forceUpdateDev)

elif DeviceType == "ShutterCalibration":
Expand Down
36 changes: 36 additions & 0 deletions Modules/danfoss.py
Original file line number Diff line number Diff line change
Expand Up @@ -387,3 +387,39 @@ def danfoss_viewdirection(self, NwkId, viewdirection):

write_attribute(self, NwkId, ZIGATE_EP, EPout, cluster_id, manuf_id, manuf_spec, Hattribute, data_type, Hdata, ackIsDisabled=False)
read_attribute(self, NwkId, ZIGATE_EP, EPout, cluster_id, "00", manuf_spec, manuf_id, 1, Hattribute, ackIsDisabled=False)


def danfoss_on_off(self, NwkId, on):
# 0 = window closed 1 = window opened
if on == 0:
window_opened = 1
elif on == 1:
window_opened = 0
else:
return

manuf_id = "1246"
manuf_spec = "01"
cluster_id = "%04x" % 0x0201

EPout = "01"
for tmpEp in self.ListOfDevices[NwkId]["Ep"]:
if "0201" in self.ListOfDevices[NwkId]["Ep"][tmpEp]:
EPout = tmpEp

Hattribute = "%04x" % 0x4003
data_type = "10" # boolean
self.log.logging("Danfoss", "Debug", "danfoss_on_off: %s" % window_opened, nwkid=NwkId)

Hdata = "%02x" % window_opened

self.log.logging(
"Danfoss",
"Debug",
"danfoss_on_onff for %s with value %s / cluster: %s, attribute: %s type: %s" % (NwkId, Hdata, cluster_id, Hattribute, data_type),
nwkid=NwkId,
)

write_attribute(self, NwkId, ZIGATE_EP, EPout, cluster_id, manuf_id, manuf_spec, Hattribute, data_type, Hdata, ackIsDisabled=False)
read_attribute(self, NwkId, ZIGATE_EP, EPout, cluster_id, "00", manuf_spec, manuf_id, 1, Hattribute, ackIsDisabled=False)

6 changes: 4 additions & 2 deletions Modules/input.py
Original file line number Diff line number Diff line change
Expand Up @@ -492,14 +492,16 @@ def Decode0110(self, Devices, MsgData, MsgLQI): # Write Attribute request
timeStamped(self, MsgSrcAddr, 0x0110)
lastSeenUpdate(self, Devices, NwkId=MsgSrcAddr)

for idx in range(24, len(MsgData), 4):
idx = 24
while idx < len(MsgData):
Attribute = MsgData[idx : idx + 4]
idx += 4
DataType = MsgData[idx : idx + 2]
idx += 2
lendata = MsgData[idx : idx + 4]
idx += 4
DataValue = MsgData[idx : idx + int(lendata,16) * 2]
idx += int(lendata, 16) * 2

self.log.logging( "Input", "Debug", "Decode0110 - Sqn: %s NwkId: %s Ep: %s Cluster: %s Manuf: %s Attribute: %s Type: %s Value: %s" % (
MsgSqn, MsgSrcAddr, MsgSrcEp, MsgClusterId, MsgManufCode, Attribute, DataType, DataValue), )
Expand Down Expand Up @@ -4144,7 +4146,7 @@ def Decode8095(self, Devices, MsgData, MsgLQI):
MajDomoDevice(self, Devices, MsgSrcAddr, "02", "0006", "01")

else:
MajDomoDevice(self, Devices, MsgSrcAddr, MsgEP, "0006", str(int(MsgCmd, 16)))
MajDomoDevice(self, Devices, MsgSrcAddr, MsgEP, "0006", MsgCmd)
self.ListOfDevices[MsgSrcAddr]["Ep"][MsgEP][MsgClusterId]["0000"] = "Cmd: %s, %s" % (MsgCmd, unknown_)
self.log.logging( "Input", "Log", "Decode8095 - Model: %s SQN: %s, Addr: %s, Ep: %s, Cluster: %s, Cmd: %s, Unknown: %s " % (
_ModelName, MsgSQN, MsgSrcAddr, MsgEP, MsgClusterId, MsgCmd, unknown_), MsgSrcAddr, )
Expand Down
2 changes: 1 addition & 1 deletion Modules/pluginModels.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def check_found_plugin_model( self, model, manufacturer_name=None, manufacturer_
'_TZ3000_amdymr7l', '_TZ3000_z1pnpsdo', '_TZ3000_ksw8qtmt', '_TZ3000_nzkqcvvs',
'_TZ3000_1h2x4akh', '_TZ3000_9vo5icau', '_TZ3000_cehuw1lw', '_TZ3000_ko6v90pg',
'_TZ3000_f1bapcit', '_TZ3000_cjrngdr3', '_TZ3000_zloso4jk', '_TZ3000_r6buo8ba',
'_TZ3000_iksasdbv', '_TZ3000_dd8wwzcy', '_TZ3000_hdopuwv6'],
'_TZ3000_iksasdbv', '_TZ3000_dd8wwzcy', '_TZ3000_hdopuwv6', '_TZ3000_ynmowqk2'],
"ManufId": [],
"PluginModelName": "TS011F-plug" },

Expand Down
9 changes: 8 additions & 1 deletion Modules/readClusters.py
Original file line number Diff line number Diff line change
Expand Up @@ -1379,8 +1379,15 @@ def Cluster0201(self, Devices, MsgSQN, MsgSrcAddr, MsgSrcEp, MsgClusterId, MsgAt
elif MsgAttrID in ("4000", "4003", "4010", "4011", "4012", "4013", "4014", "4015", "4020", "4030", "4031") and danfoss:
checkAndStoreAttributeValue(self, MsgSrcAddr, MsgSrcEp, MsgClusterId, MsgAttrID, MsgClusterData)

if MsgAttrID == "4003" and self.ListOfDevices[MsgSrcAddr]["Model"] in ("eTRV0100", "eT093WRO"):
if MsgAttrID == "4000" and self.ListOfDevices[MsgSrcAddr]["Model"] in ("eTRV0100"):
# Open Window Detection for Danfoss eTRV
if value in [ 3, 4 ]:
value = "01"
else:
value = "00"
MajDomoDevice(self, Devices, MsgSrcAddr, MsgSrcEp, "0500", value)
if MsgAttrID == "4003" and self.ListOfDevices[MsgSrcAddr]["Model"] in ("eTRV0100", "eT093WRO"):
# External Open Window Detection for Danfoss eTRV
MajDomoDevice(self, Devices, MsgSrcAddr, MsgSrcEp, "0500", value)

elif MsgAttrID in ("e010", "e011", "e012", "e013", "e014", "e030", "e031", "e020"):
Expand Down

0 comments on commit 4dcb9f7

Please sign in to comment.