Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed inconsistent use of tabs #70

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 37 additions & 37 deletions code/lan_ewlink_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,32 +183,32 @@ def performer_func(self, sub_id):
elif self. command_num == 7:
# 7 command("ROOT")
ret=self.get_signal_intensity(ip=ip,port=port,sub_id=sub_id)
elif self. command_num==8:
#8命令(获取设备状态信息)
ret=self.get_dev_info_api(ip=ip,port=port,sub_id=sub_id)
elif self. command_num==9:
#9命令(解锁ota)
print("self.command_vrg==",self.command_vrg)
ret=self.set_unlock(ip=ip,port=port,sub_id=sub_id)
print("ret",ret)
if ret['error'] == 0:
#10命令(发送升级信息)
ret=self.set_ota_flash(sha256sum= self.command_vrg["sha256sum"], sever_ip= self.command_vrg["sever_ip"], sever_port=self. command_vrg["sever_port"], ip=ip, port=port, sub_id=sub_id)
elif self. command_num==8:
#8命令(获取设备状态信息)
ret=self.get_dev_info_api(ip=ip,port=port,sub_id=sub_id)
elif self. command_num==9:
#9命令(解锁ota)
print("self.command_vrg==",self.command_vrg)
ret=self.set_unlock(ip=ip,port=port,sub_id=sub_id)
print("ret",ret)
if ret['error'] == 0:
#10命令(发送升级信息)
ret=self.set_ota_flash(sha256sum= self.command_vrg["sha256sum"], sever_ip= self.command_vrg["sever_ip"], sever_port=self. command_vrg["sever_port"], ip=ip, port=port, sub_id=sub_id)
return ret

def send_data(self, send_url, send_data):
"""
send data to device by HTTP PORT
"""
#try:
print("send:",send_url,str(send_data))
response =self.ht.postRequest(send_url,send_data)
print("response:",str(response))
if response["result"]:
return json.loads(response["text"])
else:
return 1
"""
send data to device by HTTP PORT
"""
#try:
print("send:",send_url,str(send_data))
response =self.ht.postRequest(send_url,send_data)
print("response:",str(response))
if response["result"]:
return json.loads(response["text"])
else:
return 1

def set_OUT(self, **info):
"""
Set the lights on and off
Expand All @@ -232,10 +232,10 @@ def set_OUT(self, **info):
data["sequence"] = str(int(time.time()))
sub_id = info["sub_id"]
data["deviceid"] = sub_id
if out_sta:
data["data"]= {"switch": "on"}
else:
data["data"]= {"switch": "off"}
if out_sta:
data["data"]= {"switch": "on"}
else:
data["data"]= {"switch": "off"}
# 3. Call Http_API(postRequest) to send.
return self.send_data(send_url=url, send_data=data)

Expand All @@ -262,12 +262,12 @@ def set_power_up_state(self, **info):
data["sequence"] = str(int(time.time()))
sub_id = info["sub_id"]
data["deviceid"] = sub_id
if(state== 0):
data["data"]= {"startup": "off"}
elif (state== 1):
data["data"]= {"startup": "on"}
elif (state== 2):
data["data"]= {"startup": "stay"}
if(state== 0):
data["data"]= {"startup": "off"}
elif (state== 1):
data["data"]= {"startup": "on"}
elif (state== 2):
data["data"]= {"startup": "stay"}
# 3. Call Http_API(postRequest) to send.
return self.send_data(send_url=url, send_data=data)

Expand Down Expand Up @@ -376,7 +376,7 @@ def set_unlock(self, **info):
data["sequence"] = str(int(time.time()))
sub_id = info["sub_id"]
data["deviceid"] = sub_id
data["data"]= { }
data["data"]= { }
# 3. Call Http_API(postRequest) to send.
return self.send_data(send_url=url, send_data=data)

Expand Down Expand Up @@ -405,7 +405,7 @@ def set_ota_flash(self, **info):
data["sequence"] = str(int(time.time()))
sub_id = info["sub_id"]
data["deviceid"] = sub_id
data["data"]= { }
data["data"]= { }
# 3. Call Http_API(postRequest) to send.
return self.send_data(send_url=url, send_data=data)

Expand All @@ -422,4 +422,4 @@ def get_dev_info_api(self,**info):
sub_id=info["sub_id"]
data["deviceid"]=sub_id
data["data"]= { }
return self.send_data(send_url=url, send_data=data)
return self.send_data(send_url=url, send_data=data)
4 changes: 2 additions & 2 deletions code/tool_01DIY85.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
Parses the user's input(lan_ewlink_api and Dialog_text).
"""


import os
import sys
import time
from PySide2.QtGui import *
Expand Down Expand Up @@ -430,7 +430,7 @@ def result_to_ui(self, result_str):
return
result_list = result_str.split("\n")
print("The return value is received:", result_list)
self.send_result[result_list[0]]=eval(result_list[1])
self.send_result[result_list[0]]=eval(result_list[1])


def run_detection(self, command_num, **comand_vrg):
Expand Down