Skip to content

Conversation

@ndrsnhs
Copy link
Contributor

@ndrsnhs ndrsnhs commented Feb 28, 2025

No description provided.

@benderl
Copy link
Contributor

benderl commented Mar 14, 2025

Python bringt für so eine einfache Aufgabe sehr viel Overhead mit. Ein Bash Skript wäre hier besser.
Vorschlag:

#!/bin/bash

# This script is used to trigger an update of a secondary openWB
# It is intended to be run on the primary openWB
# The primary openWB will send a mqtt message to the secondary openWB
# The secondary openWB will then update itself
#
# parameters:
# 1: the ip address of the secondary openWB

# check if the ip address is given
if [ -z "$1" ]; then
  echo "Please provide the ip address of the secondary openWB"
  exit 1
fi

# get the ip address
ip=$1

# check if ip address is valid
if ! [[ $ip =~ ^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$ ]]; then
	echo "The ip address is not valid"
	exit 1
fi

# check if mosquitto is installed
if ! command -v mosquitto_pub &> /dev/null; then
  echo "mosquitto is not installed"
  exit 1
fi

# send the mqtt message
mosquitto_pub -h "$ip" -t "openWB/set/command/primary/todo" -r -m '{"command": "systemUpdate", "data": {}}'

# done
exit 0

@LKuemmel
Copy link
Contributor

Der Befehl mosquittp_pub ist ausreichend.

@LKuemmel LKuemmel closed this Apr 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants