From 75ab2b09b5e5551b5b527c7d0fde92c80beb5b31 Mon Sep 17 00:00:00 2001 From: Beta-User Date: Tue, 20 Apr 2021 06:02:27 +0000 Subject: [PATCH] mqtt2.template: add Roon Core git-svn-id: https://svn.fhem.de/fhem/trunk@24285 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/FHEM/98_WeekdayTimer.pm | 6 ++-- fhem/FHEM/lib/AttrTemplate/mqtt2.template | 41 +++++++++++++++++++++++ 2 files changed, 44 insertions(+), 3 deletions(-) diff --git a/fhem/FHEM/98_WeekdayTimer.pm b/fhem/FHEM/98_WeekdayTimer.pm index d3f2dd71b..8eff1291a 100644 --- a/fhem/FHEM/98_WeekdayTimer.pm +++ b/fhem/FHEM/98_WeekdayTimer.pm @@ -893,7 +893,7 @@ sub WeekdayTimer_SetTimer { #$tipHash = $hash if !defined $tipHash; $modules{WeekdayTimer}{timerInThePastHash} = $tipHash; - resetRegisteredInternalTimer('delayed', time + 5, \&WeekdayTimer_delayedTimerInPast, $tipHash, 0); + resetRegisteredInternalTimer('delayed', time + 5 + AttrVal($name,'WDT_sendDelay',0), \&WeekdayTimer_delayedTimerInPast, $tipHash, 0); return; } @@ -1395,8 +1395,8 @@ sub WeekdayTimer_SetParm { ################################################################################ sub WeekdayTimer_SetAllParms { my $group = shift // q{all}; - my @wdtNames = $group eq 'all' ? devspec2array('TYPE=WeekdayTimer') - : devspec2array("TYPE=WeekdayTimer:FILTER=WDT_Group=$group"); + my @wdtNames = $group eq 'all' ? devspec2array('TYPE=WeekdayTimer:FILTER=disable!=1') + : devspec2array("TYPE=WeekdayTimer:FILTER=WDT_Group=$group:FILTER=disable!=1"); for my $wdName ( @wdtNames ) { WeekdayTimer_SetParm($wdName); diff --git a/fhem/FHEM/lib/AttrTemplate/mqtt2.template b/fhem/FHEM/lib/AttrTemplate/mqtt2.template index 40f01de0a..21c83c206 100644 --- a/fhem/FHEM/lib/AttrTemplate/mqtt2.template +++ b/fhem/FHEM/lib/AttrTemplate/mqtt2.template @@ -4482,7 +4482,48 @@ Input:currentTrack_TrackUri.* {sonos2mqtt_ur($name,'Input')} set DEVICE x_raw_payload {"command": "adv-command","input": {"cmd":"GetZoneInfo","reply":"ZoneInfo"}} setreading DEVICE attrTemplateVersion 20210303 +##### +### roon via mqtt extension +### +#contributed by mferstl, https://forum.fhem.de/index.php/topic,94495.msg1149947.html#msg1149947 +name:roon +filter:TYPE=MQTT2_DEVICE +desc:See doku for roon mqtt extension https://github.com/fjgalesloot/roon-extension-mqttf.
Note: preliminary version +# first set the ZONE +par:ZONENAME;ZONENAME is the roon zone you want to control +attr DEVICE devicetopic ZONENAME +# define up to ten internet radio stations +attr DEVICE userattr radios +attr DEVICE radios BR-KLASSIK, MDR Klassik, Klassik Radio: Barock + +# set readings +attr DEVICE readingList .*roon.*/$\DEVICETOPIC/state:.* state\ + .*roon.*/$\DEVICETOPIC/seek_position:.* track_position\ + .*roon.*/$\DEVICETOPIC/now_playing/three_line/line1:.* track_name\ + .*roon.*/$\DEVICETOPIC/now_playing/three_line/line2:.* track_artist\ + .*roon.*/$\DEVICETOPIC/now_playing/three_line/line3:.* track_album\ + .*roon.*/$\DEVICETOPIC/outputs/$\DEVICETOPIC/volume/value:.* volume\ + .*roon.*/$\DEVICETOPIC/outputs/$\DEVICETOPIC/volume/is_muted:.* muted\ + .*roon.*/$\DEVICETOPIC/settings/loop:.* loop\ + .*roon.*/$\DEVICETOPIC/settings/shuffle:.* shuffle +# setlist +# Commands to use in FHEM are with capital first letter ; the "mute" setting is for alexa only +attr DEVICE setList play roon/$\DEVICETOPIC/command play\ + pause roon/$\DEVICETOPIC/command pause\ + stop roon/$\DEVICETOPIC/command stop\ + next roon/$\DEVICETOPIC/command next\ + previous roon/$\DEVICETOPIC/command previous\ + mute:on,off { my $mute = $EVTPART1 eq 'on' ? 'mute' : 'unmute';; "roon/$\DEVICETOPIC/outputs/$\DEVICETOPIC/volume/set $mute"}\ + volume:slider,0,1,100 roon/$\DEVICETOPIC/outputs/$\DEVICETOPIC/volume/set $EVTPART1\ + mute roon/$\DEVICETOPIC/outputs/$\DEVICETOPIC/volume/set mute\ + channel:uzsuSelectRadio,1,2,3,4,5,6,7,8,9,10 { my @radios = split(/,/,AttrVal($NAME,"radios","BR-KLASSIK")) ;; "roon/$\DEVICETOPIC/browse/internet_radio ".$radios[$EVTPART1-1];; } + +# some Web commands +attr DEVICE webCmd play:pause:stop:next:previous:mute:volume:radio + +set DEVICE attrTemplate speechcontrol_gdt_and_mapping GENERICDEVTYPE=media HOMEBRIDGEMAPPING="On:cmdOn=play,cmdOff=stop PlaybackController:playback,values=play;pause;stop;previous;next ChannelController:reading=radio,cmd=radio Volume=volume,maxValue=60,minStep=3,delay=true Mute:reading=muted,cmd=mute" +setreading DEVICE attrTemplateVersion 20210420 ########################################### #source post: https://forum.fhem.de/index.php/topic,109946.0.html