Improve IP resolution and add retry mechanism
- Modified the IP resolution process to allow for multiple attempts with a specified interval. - Added a retry mechanism to check the IP address multiple times before considering it unsuccessful. - If the target IP cannot be found after the specified number of attempts, an error message is displayed. - Updated the SSH command to run the alarm script in the background.
This commit is contained in:
parent
5f7abef59d
commit
dde161ae61
@ -42,7 +42,7 @@ delete_expired_at_jobs
|
||||
# Die IP-Adresse von Lisas-IPhone holen und Ping-Test durchführen
|
||||
check_ip() {
|
||||
mac_address="e4:cd:d1" # Ersetze dies durch die MAC-Adresse
|
||||
A72_ip=$(arp-scan --localnet | grep "$mac_address" | awk '{print $1}')
|
||||
A72_ip=$(arp-scan -r 5 -v --localnet | grep "$mac_address" | awk '{print $1}')
|
||||
|
||||
if [ -z "$A72_ip" ]; then
|
||||
echo "IP nicht gefunden. Ziel ist nicht erreichbar."
|
||||
|
||||
@ -27,6 +27,7 @@ set_brightness() {
|
||||
iobroker state set zigbee.0.04cd15fffee03198.brightness "$brightness_value"
|
||||
}
|
||||
|
||||
|
||||
set_colortemp() {
|
||||
local colortemp_value=$1
|
||||
# Ersetze 'zigbee.0.04cd15fffee03198.colortemp' durch die tatsächliche ioBroker-Adresse für die Farbtemperatur
|
||||
@ -42,11 +43,11 @@ set_color() {
|
||||
# Die IP-Adresse von Lisas-IPhone holen und Ping-Test durchführen
|
||||
check_ip() {
|
||||
mac_address="e4:cd:d1" # Ersetze dies durch die MAC-Adresse
|
||||
attempts=20
|
||||
interval=10
|
||||
attempts=10
|
||||
interval=5
|
||||
|
||||
for ((i = 1; i <= $attempts; i++)); do
|
||||
A72_ip=$(arp-scan --localnet | grep "$mac_address" | awk '{print $1}')
|
||||
or ((i = 1; i <= $attempts; i++)); do
|
||||
A72_ip=$(arp-scan -r 5 -v --localnet | grep "$mac_address" | awk '{print $1}')
|
||||
|
||||
if [ -n "$A72_ip" ]; then
|
||||
echo "Gefundene IP: $A72_ip"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user