Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import time
- import sys
- import requests
- from meross_cloud import MerossHttpClient
- if __name__=='__main__':
- httpHandler = MerossHttpClient(email="your meross email", password="your meross password")
- # Retrieves the list of supported devices
- devices = httpHandler.list_supported_devices()
- # Returns the current power consumption and voltage from the plug
- # (Note: this is not really realtime, but close enough)
- electricity = devices[0].get_electricity()
- current_status = devices[0].get_electricity()
- str1 = str(current_status)
- start1=str1.find('power')+8
- end1=str1.find(",",start1)
- output_s=str1[start1:end1-1]
- output_n=int(output_s)/100
- output_h=round(int(output_n))
- # Parsing URL
- httpurl = 'http://user:password@domoticz ip address/json.htm?type=command¶m=udevice&idx=Device ID&nvalue=0&svalue='+str(output_h)+';0;0;0;'+str(output_n)+';0'
- # Sending data to Domoticz
- r = requests.get(httpurl)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement