简体   繁体   English

通过用户输入将数据发送到IoT设备

[英]Sending data to IoT device from user input

I would like to send the data entered in a textbox to the IoT device instead of sending "on" which is already predefined. 我想将在文本框中输入的数据发送到IoT设备,而不是发送已经预定义的“ on”。 How can I do this? 我怎样才能做到这一点?

<form action="/light/on" method="POST">
  <input type="submit" value="Turn me on">
 </form>

You can change the form to be like this: 您可以将表单更改为如下形式:

    <form action="/light/" method="POST">
        <input type="text" name="command" value="{{request.form.command}}">
        <input type="submit" value="Submit command">
    </form>

Then handle the POST request at server side accordingly. 然后在服务器端相应地处理POST请求。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM