From b548cd255df98adebf9dc1cf7de6eb7d8f399211 Mon Sep 17 00:00:00 2001 From: justme-1968 Date: Fri, 28 Apr 2017 12:10:41 +0000 Subject: [PATCH] 39_alexa.pm: fixed multiple sample utterances with slots. see forum: https://forum.fhem.de/index.php/topic,65890.msg627381.html#msg627381 git-svn-id: https://svn.fhem.de/fhem/trunk/fhem@14128 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- FHEM/39_alexa.pm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/FHEM/39_alexa.pm b/FHEM/39_alexa.pm index 4ecfc7b0c..738581547 100644 --- a/FHEM/39_alexa.pm +++ b/FHEM/39_alexa.pm @@ -469,13 +469,16 @@ Log 1, Dumper $characteristicsOfIntent; $intent_name = "FHEMperlCodeIntent$nr"; } -Log 1, $intent_name; + my $slot_names = {}; my $u = $utterance; while( $u =~ /\{(.*?)\}/g ) { my $slot = $1; my ($name, $values) = split( /:|=/, $slot, 2 ); my $slot_name = "${intent_name}_${name}"; + next if( $slot_names->{$slot_name} ); + $slot_names->{$slot_name} = 1; + if( $values ) { if( $values && $values =~ /^AMAZON/ ) { push @{$slots}, { name => $slot_name, type => $values };