grain.py 文件源码

python
阅读 24 收藏 0 点赞 0 评论 0

项目:smart-iiot 作者: quanpower 项目源码 文件源码
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))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号