mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-02-25 09:55:38 +00:00
99_sonos2mqttUtils.pm:Forum topic=111711.msg1267736
git-svn-id: https://svn.fhem.de/fhem/trunk@28317 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
3698ae2561
commit
214bd4df1d
@ -419,7 +419,7 @@ my $acmd = shift // return 'error';
|
||||
#
|
||||
# syntax:
|
||||
# set SonosBridge listalarms
|
||||
# set Speaker alarm enable|disable|update all|id[,id]|json
|
||||
# set Speaker alarm enable|disable|update all|id[,id]|json [volume=xx]
|
||||
#
|
||||
#######
|
||||
sub sonos2mqtt_alarm
|
||||
@ -457,8 +457,14 @@ if ($NAME eq $bridge) {
|
||||
my @arr = split(' ',$EVENT);
|
||||
my $cmd = lc shift @arr;
|
||||
if ($cmd eq 'alarm') {
|
||||
my $annex = "";
|
||||
$arr[-1] =~ /^[Vv]olume.([0-9]+)$/;
|
||||
if (defined($1)) {
|
||||
$annex .= ',"Volume":'.$1;
|
||||
pop @arr;
|
||||
}
|
||||
my $acmd = lc shift @arr;
|
||||
my $ids = shift @arr //return 'all|id[,id]|json missing, usage alarm enable|disable|update all|id[,id]|json';
|
||||
my $ids = shift @arr //return 'all|id[,id]|json missing, usage alarm enable|disable|update all|id[,id]|json [volume=xx]';
|
||||
my %t=('enable'=>'true','disable'=>'false');
|
||||
if ($acmd eq 'update') {
|
||||
fhem(qq(set $bridge setalarm $ids));
|
||||
@ -466,11 +472,11 @@ if ($cmd eq 'alarm') {
|
||||
} elsif ($acmd eq 'enable' or $acmd eq 'disable') {
|
||||
if ($ids eq "all") { $ids = ReadingsVal($NAME,"AlarmListIDs","")}
|
||||
for (split ',',$ids) {
|
||||
fhem(qq(set $bridge setalarm {"ID":$_,"Enabled":$t{$acmd}}));
|
||||
fhem(qq(set $bridge setalarm {"ID":$_,"Enabled":$t{$acmd}$annex}));
|
||||
}
|
||||
return '';
|
||||
}
|
||||
} else {return 'usage alarm enable|disable|update all|id[,id]|json'}
|
||||
} else {return 'usage alarm enable|disable|update all|id[,id]|json [volume=xx]'}
|
||||
}
|
||||
|
||||
sub sonos2mqtt_reading
|
||||
|
Loading…
x
Reference in New Issue
Block a user