daily pastebin goal
90%
SHARE
TWEET

Untitled

a guest Nov 6th, 2018 50 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import time
  2. import sys
  3. import requests
  4. from meross_cloud import MerossHttpClient
  5.  
  6. if __name__=='__main__':
  7. httpHandler = MerossHttpClient(email="your meross email", password="your meross password")
  8.  
  9. # Retrieves the list of supported devices
  10. devices = httpHandler.list_supported_devices()
  11.  
  12. # Returns the current power consumption and voltage from the plug
  13. # (Note: this is not really realtime, but close enough)
  14. electricity = devices[0].get_electricity()
  15.  
  16. current_status = devices[0].get_electricity()
  17. str1 = str(current_status)
  18. start1=str1.find('power')+8
  19. end1=str1.find(",",start1)
  20.  
  21. output_s=str1[start1:end1-1]
  22. output_n=int(output_s)/100
  23. output_h=round(int(output_n))
  24. # Parsing URL
  25. httpurl = 'http://user:password@domoticz ip address/json.htm?type=command&param=udevice&idx=Device ID&nvalue=0&svalue='+str(output_h)+';0;0;0;'+str(output_n)+';0'
  26. # Sending data to Domoticz
  27. r = requests.get(httpurl)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top