Zitat von: byterazor am 02 März 2024, 13:00:19Es gibt für NTFY_CLIENT jetzt eine update URL: https://rm.byterazor.de/upd-fhem-ntfy/controls_byterazor-fhem-ntfy.txtscheint nicht mehr zu funktionieren. Die Seite ist offline (siehe hier).
sub ntfy {
my ($message, $priority, $tags, $title, $cmd1, $button1, $cmd2, $button2, $cmd3, $button3) = @_;
# Set defaults
if (!defined $priority) {$priority = 3}
if (!defined $tags) {$tags = "house_with_garden"};
if (!defined $title or $title eq "") {$title = "FHEM"}
if ($tags !~ m/house_with_garden/) {
$tags = $tags.",house_with_garden";
}
# Prepare headers
my $param = {
url => "https://ntfy.example.org/fhem",
method => "POST",
timeout => 10,
callback => sub() {},
header => "Content-Type: application/json\r\nAuthorization: Bearer REDACTED\r\np: $priority\r\nta: $tags\r\nt: $title",
data => $message
};
# For actions:
my $actions = "";
my $url = "https://example.org/REDACTED";
my $type = "http";
my $jsonheader = "headers.Content-Type=application/json";
# Build action header
if (defined $cmd1) {
$actions = "$type, $button1, $url, $jsonheader, body={\"cmd\":\"$cmd1\"}";
}
if (defined $cmd2) {
$actions .= "; $type, $button2, $url, $jsonheader, body={\"cmd\":\"$cmd2\"}";
}
if (defined $cmd3) {
$actions .= "; $type, $button3, $url, $jsonheader, body={\"cmd\":\"$cmd3\"}";
}
# Add header
if ($actions ne "") {
$param->{header} .= "\r\nActions: $actions";
}
# Make request
HttpUtils_NonblockingGet($param);
}
sub ntfyBat {
my ($msg, $tags) = @_;
$tags = defined $tags && length $tags ? ",$tags" : "";
ntfy($msg,4,"battery".$tags)
}
sub ntfyError {
my ($msg, $tags) = @_;
$tags = defined $tags && length $tags ? ",$tags" : "";
ntfy($msg, 5, "x".$tags);
}
sub ntfyErrorSilent {
my ($msg, $tags) = @_;
$tags = defined $tags && length $tags ? ",$tags" : "";
ntfy($msg,2,"x".$tags)
}
sub ntfyOk {
my ($msg, $tags) = @_;
$tags = defined $tags && length $tags ? ",$tags" : "";
ntfy($msg,2,"white_check_mark".$tags)
}ntfy("Nicht Stören aktiviert.",4,"shushing_face,crescent_moon","","set sys_dnd off","Deaktivieren");Sieht dann aus wie im angehängten Screenshot.ntfy("Spülmaschine läuft!",2,"plate_with_cutlery,arrows_counterclockwise");und z.B. für eine Batteriebenachrichtigung:ntfyBat("Die Batterie von ".AttrVal($NAME,"alias","")." ist fast leer! (".$EVTPART1." %)");
Zitat von: dergolem am 14 Januar 2026, 06:58:12... "xtamp" gefunden...
Gruß Denis
...&nonce=61356×tamp=17... und es macht keine Probleme.