2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-01-31 12:49:34 +00:00

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
This commit is contained in:
Beta-User 2022-09-01 17:28:44 +00:00
parent 277b7c5a91
commit 36e96b0fd2

View File

@ -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