Action_Device_Wie_geht_es_dir.py 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. # -*- coding: utf-8 -*-
  2. import Action_Base
  3. import datetime
  4. @Action_Base.Snips("Device_Wie_geht_es_dir","deviceHowAreYou")
  5. class Action_Device_Wie_geht_es_dir(Action_Base.Action_Base):
  6. def beforeGetMessage(self,intent_message):
  7. if intent_message is not None:
  8. self.common.modState("angry", -40)
  9. self.common.modState("happyness", 20)
  10. self.common.modState("depresive", -55)
  11. return True
  12. def getMessage(self, intent_message):
  13. if intent_message is not None:
  14. if intent_message.slots.Beleidigung != None and len(intent_message.slots.Beleidigung)>0:
  15. bel = str(intent_message.slots.Beleidigung.first().value)
  16. print("Device Stats:")
  17. print(" angry: "+str(self.common.deviceStats.angry))
  18. print(" happyness: "+str(self.common.deviceStats.happyness))
  19. print(" depressive: "+str(self.common.deviceStats.depressive))
  20. print(" lonely: "+str(self.common.deviceStats.lonely))
  21. print(" temperature: "+str(self.common.deviceStats.temperature))
  22. print("House Stats:")
  23. if self.common.HM is not None:
  24. print(" Homematic: "+str(self.common.HM.bConnected==True))
  25. print(" Homematic Url: "+self.common.HM.url)
  26. else:
  27. print(" Homematic: None")
  28. print(" Homematic Url: -")
  29. print(" temp_avg: "+str(self.common.houseStats.temp_avg))
  30. print(" temp_coldest: "+str(self.common.houseStats.temp_coldest))
  31. print(" temp_hottest: "+str(self.common.houseStats.temp_hottest))
  32. print(" windowOpen: "+str(self.common.houseStats.windowOpen))
  33. print(" lightOn: "+str(self.common.houseStats.lightOn))
  34. print(" atHome: "+str(self.common.houseStats.atHome))
  35. print(" sleeping: "+str(self.common.houseStats.sleeping))
  36. print("Outdoor Stats:")
  37. print(" temperature: "+str(self.common.outdoorStats.temperature))
  38. print(" windy: "+str(self.common.outdoorStats.windy))
  39. print(" pressure: "+str(self.common.outdoorStats.pressure))
  40. print(" humidity: "+str(self.common.outdoorStats.humidity))
  41. print(" windSpeed: "+str(self.common.outdoorStats.windSpeed))
  42. print(" windDegree: "+str(self.common.outdoorStats.windDegree))
  43. print(" clouds: "+str(self.common.outdoorStats.clouds))
  44. print(" raining: "+str(self.common.outdoorStats.raining))
  45. print(" snowing: "+str(self.common.outdoorStats.snowing))
  46. if self.common.deviceStats.lastTalk == None:
  47. prin(" lastTalk: None")
  48. else:
  49. print(" lastTalk: "+self.common.deviceStats.lastTalk.strftime("%d.%m.%Y - %H:%M:%S"))
  50. return self.getMoodMessage()