-
-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'stable7' into wip-develop-7.2-2025
- Loading branch information
Showing
27 changed files
with
503 additions
and
267 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
{"branch": "wip-develop-7.2-2025", "version": "7.2.106"} | ||
{"branch": "wip-develop-7.2-2025", "version": "7.2.106"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
#!/usr/bin/env python3 | ||
# -*- coding: utf-8 -*- | ||
# | ||
# Implementation of Zigbee for Domoticz plugin. | ||
# | ||
# This file is part of Zigbee for Domoticz plugin. https://github.com/zigbeefordomoticz/Domoticz-Zigbee | ||
# (C) 2015-2024 | ||
# | ||
# Initial authors: zaraki673 & pipiche38 | ||
# | ||
# SPDX-License-Identifier: GPL-3.0 license | ||
|
||
import json | ||
from time import time | ||
|
||
from Classes.WebServer.headerResponse import (prepResponseMessage, | ||
setupHeadersResponse) | ||
from Modules.paramDevice import sanity_check_of_param | ||
|
||
|
||
def rest_device_param(self, verb, data, parameters): | ||
|
||
self.logging("Log", "rest_update_device_param -->Verb: %s Data: %s Parameters: %s" % (verb, data, parameters)) | ||
if verb == "GET": | ||
return rest_get_device_param(self, parameters) | ||
|
||
elif verb == "PUT": | ||
return rest_update_device_param(self, data) | ||
|
||
return prepResponseMessage(self, setupHeadersResponse()) | ||
|
||
|
||
def rest_get_device_param( self, parameters): | ||
|
||
_response = prepResponseMessage(self, setupHeadersResponse()) | ||
|
||
if len(parameters) != 1: | ||
return _log_and_return_with_error(self, "rest_get_device_param - unexpected parameter: %s", parameters, "unexpected parameter %s ", _response, ) | ||
|
||
nwkid = parameters[0] | ||
if len(nwkid) == 16: | ||
# We are assuming that is an ieee instead of nwkid | ||
nwkid = self.IEEE2NWK.get( nwkid ) | ||
|
||
if nwkid not in self.ListOfDevices: | ||
return _log_and_return_with_error(self, "rest_get_device_param - Unknown device %s ", nwkid, "unknown device %s ", _response, ) | ||
device_info = self.ListOfDevices.get( nwkid ) | ||
device_param = device_info.get("Param", "{}") | ||
|
||
_response["Data"] = json.dumps(device_param, sort_keys=False) | ||
return _response | ||
|
||
|
||
def rest_update_device_param(self, data): | ||
|
||
# curl -X PUT -d '{ | ||
# "Param": {'Disabled': 0, 'resetMotiondelay': 0, 'ConfigurationReportChunk': 3, 'ReadAttributeChunk': 4}, | ||
# "NWKID": "1234" | ||
# }' http://127.0.0.1:9441/rest-z4d/1/device-param | ||
|
||
_response = prepResponseMessage(self, setupHeadersResponse()) | ||
|
||
data = data.decode("utf8") | ||
data = eval(data) | ||
self.logging( "Log", "rest_update_device_param - Data: %s" % data) | ||
|
||
parameter = data.get("Param") | ||
nwkid = data.get("NWKID") | ||
ieee = data.get("IEEE") | ||
|
||
if nwkid is None and ieee is None: | ||
return _log_and_return_with_error(self, "rest_update_device_param - missing IEEE or NWKID", "unexpected parameter %s ", _response, ) | ||
|
||
if ieee: | ||
nwkid = self.IEEE2NWK.get( ieee ) | ||
|
||
if parameter is None or nwkid is None: | ||
return _log_and_return_with_error(self, "rest_update_device_param - unexpected parameter: %s", data, "unexpected parameter %s ", _response, ) | ||
if nwkid not in self.ListOfDevices: | ||
return _log_and_return_with_error(self, "rest_update_device_param - Unknown device %s ", nwkid, "unknown device %s ", _response, ) | ||
old_parameter = self.ListOfDevices[ nwkid ].get("Param") | ||
_response["Data"] = {"NwkId %s set Param from: %s to %s" % (nwkid, old_parameter, parameter)} | ||
|
||
self.ListOfDevices[ nwkid ]["Param"] = parameter | ||
|
||
sanity_check_of_param(self, nwkid) | ||
|
||
return _response | ||
|
||
|
||
def _log_and_return_with_error(self, arg0, arg1, arg2, _response): | ||
self.logging("Error", arg0 % arg1) | ||
_response["Data"] = {arg2 % arg1} | ||
return _response |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
#!/bin/bash | ||
|
||
# This script performs a cleanup in the local repository to allow a git pull without issues. | ||
|
||
# Ensure the script is run from the correct directory | ||
if [ ! -d ".git" ]; then | ||
echo "This script must be run from the root of the git repository." | ||
exit 1 | ||
fi | ||
|
||
# Warning message | ||
echo "WARNING: This script will remove all local changes and reset the repository." | ||
echo "If you have made any local updates, they will be removed." | ||
read -p "Do you want to continue? (YES/no): " choice | ||
|
||
if [ "$choice" != "YES" ]; then | ||
echo "Operation cancelled." | ||
exit 0 | ||
fi | ||
|
||
echo "" | ||
echo "Removing directories tracked by git, except Data, Conf, and OTAFirmware..." | ||
# Remove directories tracked by git, except Data and Conf | ||
for dir in $(git ls-tree -d --name-only HEAD); do | ||
if [ "$dir" != "Data" ] && [ "$dir" != "Conf" ] && [ "$dir" != "OTAFirmware" ]; then | ||
echo "Removing $dir..." | ||
rm -rf "$dir" | ||
fi | ||
done | ||
|
||
echo "Resetting the repository..." | ||
git reset --hard | ||
|
||
echo "Pulling the latest changes from the repository..." | ||
git pull | ||
|
||
echo "" | ||
echo "Cleanup and update process completed." | ||
|
||
echo "" | ||
echo "Repository status:" | ||
git status | ||
|
||
echo "" | ||
echo "Current branch:" | ||
git branch --show-current | ||
|
||
echo "" | ||
echo "Latest commits:" | ||
git log -n 5 --oneline |
Oops, something went wrong.