Skip to content

Commit

Permalink
fixing Remote Switch with toggle mode
Browse files Browse the repository at this point in the history
  • Loading branch information
pipiche38 committed Dec 8, 2023
1 parent 6e26442 commit 9d3ac47
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 10 deletions.
37 changes: 37 additions & 0 deletions Conf/Local-Devices/Remote switch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"_comment": "Legrand Netatmo Remote Single Switch",
"_versionn": "1.0",
"Ep": {
"01": {
"0000": { "Attributes": { "f000": { "Enabled": true, "Name": "Legrand Operating time", "EvalFunc": "legrand_operating_time", "SpecifStoragelvl1": "Legrand", "SpecifStoragelvl2": "OperatingTime", "ActionList": [ "store_specif_attribute", "check_store_raw_value"] }}},
"0001": "",
"0003": "",
"0006": "",
"0008": "",
"000f": { "Attributes": {
"0055": { "Enabled": true, "Name": "PresentValue", "DataType": "10", "UpdDomoDeviceWithCluster": "0006", "ActionList": [ "check_store_value", "upd_domo_device"] },
"f000": { "Enabled": true, "Name": "LegrandOnOff", "DataType": "21", "UpdDomoDeviceWithCluster": "0006", "UpdDomoDeviceWithAttribute": "0000", "DomoDeviceFormat": "str_2digits", "ActionList": [ "check_store_value", "upd_domo_device"] }}
},
"0019": "",
"0020": "",
"fc01": "",
"Type": "LegrandSelector"
}
},
"Type": "",
"ClusterToBind": [ "0001", "000f", "0003", "0008" ],
"ConfigureReporting": {},
"ReadAttributes": {
"0000": [ "0000", "0004", "0005", "4000", "f000" ],
"0001": [ "0020" ],
"0006": [],
"0008": [],
"000f": [ "0051" ],
"fc01": [ "0000", "0001" ],
"0019": []
},
"BatteryDevice": 1,
"Param": {
"netatmoReleaseButton": 0
}
}
23 changes: 13 additions & 10 deletions Modules/domoMaj.py
Original file line number Diff line number Diff line change
Expand Up @@ -1169,17 +1169,20 @@ def MajDomoDevice(self, Devices, NWKID, Ep, clusterID, value, Attribute_="", Col
self.log.logging("Widget", "Debug", "------> Switch off as System Mode is Off")
UpdateDevice_v2(self, Devices, DeviceUnit, 0, "00", BatteryLevel, SignalLevel)

elif WidgetType in SWITCH_SELECTORS and value in SWITCH_SELECTORS[WidgetType]:
self.log.logging("Widget", "Debug", "------> Auto Update %s" % str(SWITCH_SELECTORS[WidgetType][value]))
if len(SWITCH_SELECTORS[WidgetType][value]) == 2:
nValue, sValue = SWITCH_SELECTORS[WidgetType][value]
_ForceUpdate = SWITCH_SELECTORS[WidgetType]["ForceUpdate"]
self.log.logging( "Widget", "Debug", "------> Switch update WidgetType: %s with %s" % (
WidgetType, str(SWITCH_SELECTORS[WidgetType])), NWKID, )
UpdateDevice_v2(self, Devices, DeviceUnit, nValue, sValue, BatteryLevel, SignalLevel, ForceUpdate_=_ForceUpdate)
else:
if WidgetType in SWITCH_SELECTORS and value in SWITCH_SELECTORS[WidgetType]:
self.log.logging("Widget", "Debug", "------> Auto Update %s" % str(SWITCH_SELECTORS[WidgetType][value]))
if len(SWITCH_SELECTORS[WidgetType][value]) == 2:
nValue, sValue = SWITCH_SELECTORS[WidgetType][value]
_ForceUpdate = SWITCH_SELECTORS[WidgetType]["ForceUpdate"]
self.log.logging( "Widget", "Debug", "------> Switch update WidgetType: %s with %s" % (
WidgetType, str(SWITCH_SELECTORS[WidgetType])), NWKID, )
UpdateDevice_v2(self, Devices, DeviceUnit, nValue, sValue, BatteryLevel, SignalLevel, ForceUpdate_=_ForceUpdate)
else:
self.log.logging( "Widget", "Error", "------> len(SWITCH_SELECTORS[ %s ][ %s ]) == %s" % (
WidgetType, value, len(SWITCH_SELECTORS[WidgetType])), NWKID, )
else:
self.log.logging( "Widget", "Error", "------> len(SWITCH_SELECTORS[ %s ][ %s ]) == %s" % (
WidgetType, value, len(SWITCH_SELECTORS[WidgetType])), NWKID, )
self.log.logging("Widget", "Error", "------> Auto Update (%s %s) not found in SWITCH_SELECTORS" % ( WidgetType, value))

if "WindowCovering" in ClusterType: # 0x0102
if WidgetType in ("VenetianInverted", "Venetian", "Vanne", "VanneInverted", "WindowCovering", "Curtain", "CurtainInverted", "Blind"):
Expand Down
4 changes: 4 additions & 0 deletions Modules/readZclClusters.py
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,10 @@ def action_majdomodevice( self, Devices, MsgSrcAddr, MsgSrcEp, MsgClusterId, Msg
if _majdomo_formater:
if _majdomo_formater == "str":
majValue = str( value )

elif _majdomo_formater == "str_2digit":
majValue = "%02s" %int(value)

elif _majdomo_formater == "strhex":
majValue = "%x" %value

Expand Down

0 comments on commit 9d3ac47

Please sign in to comment.