From 36e96b0fd262bd13c7eaf57495243b4c2877cb94 Mon Sep 17 00:00:00 2001 From: Beta-User <> Date: Thu, 1 Sep 2022 17:28:44 +0000 Subject: [PATCH] 10_RHASSPY: try to fix dev identification w/o room for old methods git-svn-id: https://svn.fhem.de/fhem/trunk@26367 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/contrib/RHASSPY/10_RHASSPY.pm | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/fhem/contrib/RHASSPY/10_RHASSPY.pm b/fhem/contrib/RHASSPY/10_RHASSPY.pm index 134a1f2a0..c2cea5ef1 100644 --- a/fhem/contrib/RHASSPY/10_RHASSPY.pm +++ b/fhem/contrib/RHASSPY/10_RHASSPY.pm @@ -2012,6 +2012,8 @@ sub getDeviceByName { return 0 if $droom; #no further check if explicit room was requested! my @maybees; + my $oldType = $intent =~ m,(MediaChannels|Colors),x; + for (sort keys %{$hash->{helper}{devicemap}{rhasspyRooms}}) { my $dev = $hash->{helper}{devicemap}{rhasspyRooms}{$_}{$name}; #return $device if $device; @@ -2022,7 +2024,7 @@ sub getDeviceByName { && defined $hash->{helper}{devicemap}{devices}{$dev}->{prio} && defined $hash->{helper}{devicemap}{devices}{$dev}{prio}->{outsideRoom} && $hash->{helper}{devicemap}{devices}{$dev}{prio}->{outsideRoom} =~ m{\b$type\b}xms; - if ( $intent ) { + if ( $intent && !$oldType ) { if ( $type ) { push @maybees, $dev if defined $hash->{helper}{devicemap}{devices}{$dev}->{intents} && defined $hash->{helper}{devicemap}{devices}{$dev}{intents}->{$intent} @@ -2033,6 +2035,14 @@ sub getDeviceByName { push @maybees, $dev if defined $hash->{helper}{devicemap}{devices}{$dev}->{intents} && defined $hash->{helper}{devicemap}{devices}{$dev}{intents}->{$intent}; } + } elsif ( $intent && $oldType ) { + if ( $type ) { + push @maybees, $dev if defined $hash->{helper}{devicemap}{devices}{$dev}->{$intent} + && defined $hash->{helper}{devicemap}{devices}{$dev}->{$intent} + && defined $hash->{helper}{devicemap}{devices}{$dev}->{$intent}->{$type}; + } else { + push @maybees, $dev if defined $hash->{helper}{devicemap}{devices}{$dev}->{$intent}; + } } else { push @maybees, $dev; } @@ -5223,14 +5233,13 @@ sub handleIntentMediaChannels { Log3($hash->{NAME}, 5, "handleIntentMediaChannels called"); # Mindestens Channel muss übergeben worden sein - return respond( $hash, $data, getResponse($hash, 'NoMediaChannelFound') ) if !exists $data->{Channel}; + my $channel = $data->{Channel} // return respond( $hash, $data, getResponse($hash, 'NoMediaChannelFound') ); my $room = getRoomName($hash, $data); - my $channel = $data->{Channel}; # Passendes Gerät suchen my $device = exists $data->{Device} - ? getDeviceByName( $hash, $room, $data->{Device}, $data->{Room}, 'MediaChannels', 'MediaChannels' ) + ? getDeviceByName( $hash, $room, $data->{Device}, $data->{Room}, $channel, 'MediaChannels' ) : getDeviceByMediaChannel($hash, $room, $channel); return respond( $hash, $data, getResponse($hash, 'NoMediaChannelFound') ) if !defined $device; return getNeedsClarification( $hash, $data, 'ParadoxData', 'Room', [$data->{Device}, $data->{Room}] ) if !$device; @@ -6123,6 +6132,9 @@ sieht funktional aus, bisher keine Beschwerden... #Who am I / Who are you? Personenbezogene Kommunikation? möglich, erwünscht, typische Anwendungsszenarien...? +#https://community.rhasspy.org/t/simultaneously-receiving-commands-from-multiple-satellites/3810/3 +Instead i have to check whether the next message is a repeat. + =end ToDo =encoding utf8