Guest User

Untitled

a guest
Feb 17th, 2019
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.56 KB | None | 0 0
  1. if u'おはよう' in word:
  2. msg = 'おはようございます!今は' + datetimestr + 'です!'
  3. #device = "light"
  4. command= ["tv", "tvon"]
  5. elif u'いってきます' in word:
  6. msg = 'いってらっしゃい!今日はきっといい事ありますよ!'
  7. command= ["light", "loff"]
  8. elif u'ただいま' in word:
  9. msg = 'おかえりなさい!おつかれさまでした!'
  10. command = ["tv", "tvon"]
  11. elif u'おやすみ' in word:
  12. msg = 'おやすみなさい!良い夢を!'
  13. command= ["light", "loff"]
  14. elif u'テレビオン' in word:
  15. msg = 'テレビを付けます!'
  16. command = ["tv", "tvon"]
  17. elif u'加湿器オン' in word:
  18. msg = '加湿器を付けます!'
  19. command = ["humid", "hon"]
  20. elif u'さよなら' in word or u'バイバイ' in word:
  21. msg = 'また話しかけてね!'
  22.  
  23.  
  24. 以下の部分で、コマンドに応じて赤外線送信や、室温のチェック、写真、LINE送付などを定義しています。取り入れたい機能に応じて、プログラムの記述を変えてみて下さい。
  25. [julius_remote.pyの一部]
  26. args = ['irsend', '-#', '1', 'SEND_ONCE', command[0], command[1]]
  27. try:
  28. led_blink("red",1)
  29. print(msg)
  30. os.system(aquest_dir + msg + ' | aplay')
  31. os.system('python ' + bme_command)
  32. os.system('python ' + camera_command)
  33. cam_msg = '写真を撮ってラインに送りました!'
  34. os.system(aquest_dir + cam_msg + ' | aplay')
  35. subprocess.Popen(args)
  36. print(command)
  37. led_blink("green",3)
  38. except OSError:
  39. print('command not found.')
Add Comment
Please, Sign In to add comment