diff --git a/Snips/Intents/AEspIntent.cs b/Snips/Intents/AEspIntent.cs index f5a84d6..fa1c224 100644 --- a/Snips/Intents/AEspIntent.cs +++ b/Snips/Intents/AEspIntent.cs @@ -29,5 +29,21 @@ namespace BlubbFish.Iot.Snips.Intents { this.espid = t.Key; } } + + protected String GetSpeakName(String name) { + String ort = name.Substring(8); + switch(ort) { + case "Bad": + case "Dach": + return "im " + ort; + case "Arbeit": + return "im " + ort + "szimmer"; + case "Wohn": + return "im " + ort + "zimmer"; + case "Kueche": + return "in der Küche"; + } + return ""; + } } } diff --git a/Snips/Intents/AIntent.cs b/Snips/Intents/AIntent.cs index 1adc34b..632c7a2 100644 --- a/Snips/Intents/AIntent.cs +++ b/Snips/Intents/AIntent.cs @@ -21,26 +21,32 @@ namespace BlubbFish.Iot.Snips.Intents { } } - protected void SnipsSay(String text) => ((ADataBackend)this.snips).Send("hermes/tts/say", - JsonMapper.ToJson( - new Dictionary { - { "id",this.data["id"].ToString() }, - { "lang","de" }, - { "sessionId", this.data["sessionId"].ToString() }, - { "siteId","default" }, - { "text",text } - } - ) - ); + protected void SnipsSay(String text) { + ((ADataBackend)this.snips).Send("hermes/tts/say", + JsonMapper.ToJson( + new Dictionary { + { "id",this.data["id"].ToString() }, + { "lang","de" }, + { "sessionId", this.data["sessionId"].ToString() }, + { "siteId","default" }, + { "text",text } + } + ) + ); + Console.WriteLine("TTS: " + text); + } - protected void SnipsEndSpeak() => ((ADataBackend)this.snips).Send("hermes/tts/sayFinished", - JsonMapper.ToJson( - new Dictionary { - { "id", this.data["id"].ToString() }, - { "sessionId", this.data["sessionId"].ToString() } - } - ) - ); + protected void SnipsEndSpeak() { + ((ADataBackend)this.snips).Send("hermes/tts/sayFinished", + JsonMapper.ToJson( + new Dictionary { + { "id", this.data["id"].ToString() }, + { "sessionId", this.data["sessionId"].ToString() } + } + ) + ); + Console.WriteLine("say Finished"); + } public abstract void Parse(); diff --git a/Snips/Intents/GetHum.cs b/Snips/Intents/GetHum.cs index f16bd5d..9a1fdcb 100644 --- a/Snips/Intents/GetHum.cs +++ b/Snips/Intents/GetHum.cs @@ -11,7 +11,7 @@ namespace BlubbFish.Iot.Snips.Intents { public override void Answer() { if(this.espid != null) { - this.SnipsSay("Die Luftfeuchtigkeit beträgt " + this.esps[this.espid].Humidity + " Prozent relative Luftfeuchtigkeit im " + this.slots["ort"] + " !"); + this.SnipsSay("Die Luftfeuchtigkeit beträgt " + Math.Round(this.esps[this.espid].Humidity, 1) + " Prozent relative Luftfeuchtigkeit " + this.GetSpeakName(this.espid) + "!"); } else { this.SnipsSay("Ich habe bisher keine Sensordaten erhalten!"); } diff --git a/Snips/Intents/GetTemp.cs b/Snips/Intents/GetTemp.cs index 6b58e2d..c8a3045 100644 --- a/Snips/Intents/GetTemp.cs +++ b/Snips/Intents/GetTemp.cs @@ -11,7 +11,7 @@ namespace BlubbFish.Iot.Snips.Intents { public override void Answer() { if(this.espid != null) { - this.SnipsSay("Im " + this.slots["ort"] + " ist es " + this.esps[this.espid].Temperature + " Grad "+this.slots["feel"]+"!"); + this.SnipsSay(this.GetSpeakName(this.espid) + " ist es " + Math.Round(this.esps[this.espid].Temperature,1) + " Grad "+this.slots["feel"]+"!"); } else { this.SnipsSay("Ich habe bisher keine Sensordaten erhalten!"); } diff --git a/Snips/Intents/Wetter.cs b/Snips/Intents/Wetter.cs index d3d4a3e..e28cd26 100644 --- a/Snips/Intents/Wetter.cs +++ b/Snips/Intents/Wetter.cs @@ -31,7 +31,7 @@ namespace BlubbFish.Iot.Snips.Intents { } if(html != null) { String file = null; - MatchCollection m = new Regex("\"(.*VHDL13_DWEH_([0-9]{6}).*)\"").Matches(html); + MatchCollection m = new Regex("\"(.*VHDL13_DWEH_[0-9]{6}.*([0-9]{10}).*)\"").Matches(html); if(m.Count > 1) { Int32 d = Int32.Parse(m[0].Groups[2].Value); file = m[0].Groups[1].Value; diff --git a/Snips/Properties/AssemblyInfo.cs b/Snips/Properties/AssemblyInfo.cs index aab0c70..ab17cc3 100644 --- a/Snips/Properties/AssemblyInfo.cs +++ b/Snips/Properties/AssemblyInfo.cs @@ -33,9 +33,10 @@ using System.Runtime.InteropServices; // Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden, // übernehmen, indem Sie "*" eingeben: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0")] -[assembly: AssemblyFileVersion("1.0.0")] +[assembly: AssemblyVersion("1.0.1")] +[assembly: AssemblyFileVersion("1.0.1")] /* * 1.0.0 First Version + * 1.0.1 Bugfixing */ diff --git a/Snips/SnipsBot.cs b/Snips/SnipsBot.cs index 87daf2d..e8599a1 100644 --- a/Snips/SnipsBot.cs +++ b/Snips/SnipsBot.cs @@ -31,8 +31,10 @@ namespace BlubbFish.Iot.Snips { intent = new Wetter(data, this.sources["snips"]); } if(intent != null) { + Console.WriteLine("Intent Start " + data["intent"]["intentName"].ToString()); intent.Parse(); intent.Answer(); + Console.WriteLine("Intent Finished!"); } } catch { } }