Google assistant say the Raspberry Pi temperature



  • I put my Rasberry Pi in a handmade box and I am concerned about it's temperature. So I created this trigger to be able to check the Pi temperature using google assistant.

    {"trigger":"Pi temperature","command":"python3 /home/pi/temperature.py","ground":"background","voice":"system temperature","voiceReply":"The pi temperature is {{result}} degrees","allowParams": "false"}
    

    The Python3 script

    #!/usr/bin/env python3
    
    import subprocess
    import os
    
    reply = str(subprocess.check_output(['vcgencmd', 'measure_temp']))
    result = reply[reply.find('=') + 1: reply.find('C')- 1]
    os.system('~/.TRIGGERcmdData/sendresult.sh ' + result)
    


  • @hm123, that is awesome. Thanks for sharing it.


Log in to reply