def post(self):
parser = reqparse.RequestParser()
parser.add_argument('tianshuoSwitch', type=str)
parser.add_argument('tianshuoNo', type=int)
args = parser.parse_args()
print(args)
tianshuoNo = args['tianshuoNo']
tianshuoSwitch = args['tianshuoSwitch']
if tianshuoSwitch == '1':
output_hex = calc_modus_hex_str_to_send(tianshuoNo, 6, 0, 0, 0, 9)
rs485_socket_send(output_hex)
print("{0} switch on!".format(tianshuoNo))
elif tianshuoSwitch == '0':
output_hex = calc_modus_hex_str_to_send(tianshuoNo, 6, 0, 0, 0, 1)
rs485_socket_send(output_hex)
print("{0} switch off!".format(tianshuoNo))
评论列表
文章目录