Skip to content

Commit

Permalink
fine tune Moes Curtain calibration ( zigbeefordomoticz/z4d-certified-…
Browse files Browse the repository at this point in the history
  • Loading branch information
pipiche38 committed Oct 18, 2024
1 parent af8fed7 commit 7b853ae
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Modules/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
from Modules.tuyaTRV import (tuya_coil_fan_thermostat, tuya_fan_speed,
tuya_lidl_set_mode, tuya_trv_brt100_set_mode,
tuya_trv_mode, tuya_trv_onoff)
from Modules.tuyaTS0601 import ts0601_actuator, ts0601_extract_data_point_infos, ts0601_curtain_calibration_cmd
from Modules.tuyaTS0601 import ts0601_actuator, ts0601_extract_data_point_infos, ts0601_curtain_quick_calibration_cmd, ts0601_curtain_calibration_cmd, ts0601_curtain_accurate_calibration_cmd
from Modules.zigateConsts import (THERMOSTAT_LEVEL_2_MODE,
THERMOSTAT_LEVEL_3_MODE)

Expand Down Expand Up @@ -277,10 +277,10 @@ def handle_command_off(self,Devices, DeviceID, Unit, Level, Nwkid, EPout, Device
return

if DeviceType == "SwitchCalibration" and model_name == "TS0601-Moes-Curtain":
# Switch Off alibration
# Switch Off Calibration
self.log.logging("Command", "Status", "mgtCommand : Switch Off Calibration on %s/%s" % (Nwkid,EPout))
update_domoticz_widget(self, Devices, DeviceID, Unit, 0, "Off", BatteryLevel, SignalLevel, ForceUpdate_=forceUpdateDev)
ts0601_curtain_calibration_cmd( self, Nwkid, EPout, 0x07, mode=0)
ts0601_curtain_accurate_calibration_cmd( self, Nwkid, EPout, 0x07, mode=1)
return

if DeviceType == "SwitchAlarm" and model_name == "TS0601-_TZE200_t1blo2bj":
Expand Down Expand Up @@ -525,7 +525,7 @@ def handle_command_on(self,Devices, DeviceID, Unit, Level, Nwkid, EPout, DeviceT
# Switch On calibration
self.log.logging("Command", "Status", "mgtCommand : Switch ON Calibration on %s/%s" % (Nwkid,EPout))
update_domoticz_widget(self, Devices, DeviceID, Unit, 1, "On", BatteryLevel, SignalLevel, ForceUpdate_=forceUpdateDev)
ts0601_curtain_calibration_cmd( self, Nwkid, EPout, 0x07, mode=1)
ts0601_curtain_accurate_calibration_cmd( self, Nwkid, EPout, 0x07, mode=0)
return

if DeviceType == "SwitchAlarm" and model_name == "TS0601-_TZE200_t1blo2bj":
Expand Down
34 changes: 34 additions & 0 deletions Modules/tuyaTS0601.py
Original file line number Diff line number Diff line change
Expand Up @@ -1107,6 +1107,7 @@ def ts0601_curtain_level_cmd( self, NwkId, Ep, dp, percent=None):


def ts0601_curtain_calibration_cmd( self, NwkId, Ep, dp, mode=None):

if mode is None:
return
self.log.logging("Tuya0601", "Debug", "ts0601_curtain_calibration_cmd - %ss dp:%s value: %s" % (
Expand All @@ -1128,7 +1129,25 @@ def ts0601_curtain_motor_steering_cmd( self, NwkId, Ep, dp, mode=None):
ts0601_tuya_cmd(self, NwkId, Ep, action, data)


def ts0601_curtain_accurate_calibration_cmd( self, NwkId, Ep, dp, mode=None):
# 0014/03/04/0001/00 - start the Prepare Calibration
# User to fully open the curtains
#
# Close button to make the curtain rull to full close
#
# 00150/3/04/0001/01 - close the calibration

if mode is None:
return
self.log.logging("Tuya0601", "Debug", "ts0601_curtain_quick_calibration_cmd - %s Quick Calibration: dp:%s value: %s" % (
NwkId, dp, mode))
action = "%02x04" % dp # I
data = "%02x" % (mode)
ts0601_tuya_cmd(self, NwkId, Ep, action, data)


def ts0601_curtain_quick_calibration_cmd( self, NwkId, Ep, dp, duration=None):

if duration is None:
return
self.log.logging("Tuya0601", "Debug", "ts0601_curtain_quick_calibration_cmd - %s Quick Calibration: dp:%s value: %s" % (
Expand All @@ -1138,11 +1157,26 @@ def ts0601_curtain_quick_calibration_cmd( self, NwkId, Ep, dp, duration=None):
ts0601_tuya_cmd(self, NwkId, Ep, action, data)


def ts0601_curtain_indicator_status(self, NwkId, Ep, dp, mode=None):
# mode = 0x00 - On/off Status
# mode = 0x01 - Switch Position
# mode = 0x02 - Off
if mode is None:
return
self.log.logging("Tuya0601", "Debug", "ts0601_curtain_indicator_status - %s Quick Calibration: dp:%s value: %s" % (
NwkId, dp, mode))
action = "%02x04" % dp # I
data = "%02x" % (mode)
ts0601_tuya_cmd(self, NwkId, Ep, action, data)


TS0601_COMMANDS = {
"IndicatorStatus": ts0601_curtain_indicator_status,
"CurtainState": ts0601_curtain_state_cmd,
"CurtainLevel": ts0601_curtain_level_cmd,
"CurtainCalibration": ts0601_curtain_calibration_cmd,
"CurtainQuickCalibration": ts0601_curtain_quick_calibration_cmd,
"CurtainAccurateCalibration": ts0601_curtain_accurate_calibration_cmd,
"CurtainMotorSteering": ts0601_curtain_motor_steering_cmd,
"TuyaPresenceSensitivity": ( None, "04"),
"TuyaRadarSensitivity": (None, "04"),
Expand Down

0 comments on commit 7b853ae

Please sign in to comment.