Skip to content

Commit

Permalink
Plugin wip-develop version 7.2.007
Browse files Browse the repository at this point in the history
  • Loading branch information
pipiche38 committed Feb 25, 2024
2 parents 8ca87a8 + bf83c44 commit bc02218
Show file tree
Hide file tree
Showing 32 changed files with 1,464 additions and 926 deletions.
2 changes: 1 addition & 1 deletion .hidden/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"branch": "wip-develop", "version": "7.2.006"}
{"branch": "wip-develop", "version": "7.2.007"}
224 changes: 111 additions & 113 deletions Classes/PluginConf.py

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Classes/WebServer/WebServer.py
Original file line number Diff line number Diff line change
Expand Up @@ -1295,7 +1295,7 @@ def rest_raw_zigbee(self, verb, data, parameters):
'timestamp': time.time()
}

self.logging( "Log","Sending request to coordinator %s" % ( data))
self.logging( "Log","Sending request to coordinator %s for target %s" % ( data, target_address))
self.ControllerLink.sendData( "RAW-COMMAND", data, NwkId=int(target_address,16), sqn=int(sqn,16), ackIsDisabled=ack_Is_Disabled )

return _response
Expand Down
33 changes: 15 additions & 18 deletions Classes/WebServer/rest_Topology.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def rest_netTopologie(self, verb, data, parameters):

if not os.path.isfile(_filename):
_response["Data"] = json.dumps({}, sort_keys=True)
self.logging("Log", "Filename: %s not found !!" % _filename)
self.logging("Debug", "Filename: %s not found !!" % _filename)
return _response

# Read the file, as we have anyway to do it
Expand Down Expand Up @@ -402,21 +402,11 @@ def collect_routing_table(self, time_stamp=None):
_topo = []
self.logging( "Debug", "collect_routing_table - TimeStamp: %s" %time_stamp)
for father in self.ListOfDevices:
for child in extract_routes(self, father, time_stamp):
if child not in self.ListOfDevices:
continue
_relation = {
"Father": get_node_name( self, father),
"Child": get_node_name( self, child),
"_lnkqty": get_lqi_from_neighbours(self, father, child),
"DeviceType": find_device_type(self, child)
}
self.logging( "Log", "Relationship - %15.15s (%s) - %15.15s (%s) %3s %s" % (
_relation["Father"], father, _relation["Child"], child, _relation["_lnkqty"], _relation["DeviceType"]),)
_topo.append( _relation )

for child in collect_associated_devices( self, father, time_stamp):
self.logging( "Debug", f"check {father} child from routing table")
for child in set( extract_routes(self, father, time_stamp) + collect_associated_devices( self, father, time_stamp) + collect_neighbours_devices( self, father, time_stamp) ):
self.logging( "Debug", f"Found child {child}")
if child not in self.ListOfDevices:
self.logging( "Debug", f"Found child {child} but not found in ListOfDevices")
continue
_relation = {
"Father": get_node_name( self, father),
Expand All @@ -426,16 +416,23 @@ def collect_routing_table(self, time_stamp=None):
}
self.logging( "Debug", "Relationship - %15.15s (%s) - %15.15s (%s) %3s %s" % (
_relation["Father"], father, _relation["Child"], child, _relation["_lnkqty"], _relation["DeviceType"]),)
if _relation not in _topo:
_topo.append( _relation )
_topo.append( _relation )

return _topo


def collect_associated_devices( self, node, time_stamp=None):
last_associated_devices = get_device_table_entry(self, node, "AssociatedDevices", time_stamp)
self.logging( "Debug", "collect_associated_devices %s -> %s" %(node, str(last_associated_devices)))
return list(last_associated_devices)



def collect_neighbours_devices( self, node, time_stamp=None):
last_neighbours_devices = get_device_table_entry(self, node, "Neighbours", time_stamp)
self.logging( "Debug", "collect_neighbours_devices %s -> %s" %(node, str(last_neighbours_devices)))
keys_with_child_relation = [key for item in last_neighbours_devices for key, value in item.items() if value.get('_relationshp') == 'Child']
return list(keys_with_child_relation)


def extract_routes( self, node, time_stamp=None):
node_routes = []
Expand Down
92 changes: 0 additions & 92 deletions Conf/Certified/Danfoss/eT093WRG.json

This file was deleted.

45 changes: 0 additions & 45 deletions Conf/Local-Devices/AQSZB-110.json

This file was deleted.

38 changes: 0 additions & 38 deletions Conf/Local-Devices/TS0601-SmartAirHouseKeeper.json

This file was deleted.

55 changes: 0 additions & 55 deletions Conf/Local-Devices/lumi.curtain.acn002.json

This file was deleted.

23 changes: 15 additions & 8 deletions DevicesModules/custom_sonoff.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,30 @@
#
# SPDX-License-Identifier: GPL-3.0 license

from Modules.zigateConsts import ZIGATE_EP
from Modules.basicOutputs import write_attribute
from Modules.readAttributes import ReadAttributeRequest_0406_0022
from Modules.zigateConsts import ZIGATE_EP

SONOFF_MAUFACTURER_NAME = "SONOFF"
SONOFF_MANUFACTURER_ID = "1286"
SONOFF_CLUSTER_ID = "fc11"
SONOFF_MANUF_ID = "1286"
SONOFF_ILLUMINATION_ATTRIBUTE = "2001"


def is_sonoff_device(self, nwkid):
return self.ListOfDevices[nwkid]["Manufacturer"] == SONOFF_MANUFACTURER_ID or self.ListOfDevices[nwkid]["Manufacturer Name"] == SONOFF_MAUFACTURER_NAME


def sonoff_child_lock(self, nwkid, lock_mode):
self.log.logging("Sonoff", "Debug", "sonoff_child_lock - Nwkid: %s Mode: %s" % (nwkid, lock_mode))
write_attribute(self, nwkid, ZIGATE_EP, "01", SONOFF_CLUSTER_ID, SONOFF_MANUF_ID, "01", "0000", "10", "%02x" %lock_mode, ackIsDisabled=False)
write_attribute(self, nwkid, ZIGATE_EP, "01", SONOFF_CLUSTER_ID, SONOFF_MANUFACTURER_ID, "01", "0000", "10", "%02x" %lock_mode, ackIsDisabled=False)



def sonoff_open_window_detection(self, nwkid, detection):
self.log.logging("Sonoff", "Debug", "sonoff_child_lock - Nwkid: %s Mode: %s" %(nwkid, detection))
write_attribute(self, nwkid, ZIGATE_EP, "01", SONOFF_CLUSTER_ID, SONOFF_MANUF_ID, "01", "6000", "10", "%02x" %detection, ackIsDisabled=False)

write_attribute(self, nwkid, ZIGATE_EP, "01", SONOFF_CLUSTER_ID, SONOFF_MANUFACTURER_ID, "01", "6000", "10", "%02x" %detection, ackIsDisabled=False)

SONOFF_DEVICE_PARAMETERS = {
"SonOffTRVChildLock": sonoff_child_lock,
"SonOffTRVWindowDectection": sonoff_open_window_detection

"SonOffTRVWindowDectection": sonoff_open_window_detection,
}
32 changes: 0 additions & 32 deletions Modules/basicOutputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -602,38 +602,6 @@ def identifyEffect(self, nwkid, ep, effect="Blink"):
return zcl_identify_trigger_effect(self, nwkid, ep, "%02x" %effect_command[effect], "%02x" % 0)



def set_PIROccupiedToUnoccupiedDelay(self, key, delay, ListOfEp=None):

cluster_id = "0406"
attribute = "0010"
data_type = "21"
manuf_id = "0000"
manuf_spec = "00"
if ListOfEp is None:
ListOfEp = getListOfEpForCluster(self, key, cluster_id)
for EPout in ListOfEp:
data = "%04x" % delay
self.log.logging(
"BasicOutput", "Log", "set_PIROccupiedToUnoccupiedDelay for %s/%s - delay: %s" % (key, EPout, delay), key
)
if attribute in self.ListOfDevices[key]["Ep"][EPout][cluster_id]:
del self.ListOfDevices[key]["Ep"][EPout][cluster_id][attribute]
return write_attribute(
self,
key,
ZIGATE_EP,
EPout,
cluster_id,
manuf_id,
manuf_spec,
attribute,
data_type,
data,
ackIsDisabled=False,
)


def set_poweron_afteroffon(self, key, OnOffMode=0xFF):
# OSRAM/LEDVANCE
# 0xfc0f --> Command 0x01
Expand Down
Loading

0 comments on commit bc02218

Please sign in to comment.