美文网首页
树莓派 WebIOPi

树莓派 WebIOPi

作者: StormerX | 来源:发表于2020-06-18 18:05 被阅读0次

WebIOPi官网

http://webiopi.trouch.com/

安装

wget http://sourceforge.net/projects/webiopi/files/WebIOPi-0.7.1.tar.gz
tar xvzf WebIOPi-0.7.1.tar.gz

如果是以下型号的树莓派,一定要把下面的补丁文件复制到安装目录,先安装补丁,然后再执行setup.sh安装脚本。
WebIOPi-0.7.1 Patch for Raspberry B+, Pi2, Pi3, and Pi4 https://github.com/doublebind/raspi

cd WebIOPi-0.7.1
wget https://raw.githubusercontent.com/doublebind/raspi/master/webiopi-pi2bplus.patch
patch -p1 -i webiopi-pi2bplus.patch

sudo ./setup.sh

常用命令

//查看帮助
sudo webiopi -h
// 启动到8000端口:
sudo webiopi 8000
// 后台启动:
sudo /etc/init.d/webiopi start
或者
sudo systemctl start webiopi
//停止后台运行
sudo systemctl stop webiopi
// 开机自启:
sudo update-rc.d webiopi defaults

修改密码

Change Password

The WebIOPi server uses an encrypted file that contains both login and password. To generate this file, simply run the webiopi-passwd command with sudo and follow instructions :

$ sudo webiopi-passwd
WebIOPi passwd file generator
Enter Login: webiopi
Enter Password: 
Confirm password: 

Hash: e70c940a189251e9cd4515b3a1a6c6f02aa05c744a456ce360fe14bf2c5c0353
Saved to /etc/webiopi/passwd

Then restart the default server :

$ sudo /etc/init.d/webiopi restart

去掉身份验证

Remove Protection

To remove login/password protection, you can ever remove /etc/webiopi/passwd or empty it, then restart the webiopi server.

webiopi-passwd syntax

$ webiopi-passwd -h
WebIOPi passwd file generator
Usage: webiopi-passwd [--help|file]
Compute and display hash used by WebIOPi for Authentication
Login and Password are prompted
    --help    Display this help
    -h
    file    Save hash to file

By default, the hash is saved in /etc/webiopi/passwd. Specifying a file allows to save the hash in another file, to use it with custom servers.

Auto start at boot

To setup your system to start webiopi at boot :

$ sudo update-rc.d webiopi defaults
To remove webiopi start from boot :

$ sudo update-rc.d webiopi remove

配置文件内容 /etc/webiopi/config

[GPIO]
# Initialize following GPIOs with given function and optional value
# This is used during WebIOPi start process
#21 = IN
#23 = OUT 0
#24 = OUT 0
#25 = OUT 1

#------------------------------------------------------------------------#

[~GPIO]
# Reset following GPIOs with given function and optional value
# This is used at the end of WebIOPi stop process
#21 = IN
#23 = IN
#24 = IN
#25 = OUT 0

#------------------------------------------------------------------------#

[SCRIPTS]
# Load custom scripts syntax :
# name = sourcefile
#   each sourcefile may have setup, loop and destroy functions and macros
#myscript = /home/pi/webiopi/examples/scripts/macros/script.py

#------------------------------------------------------------------------#

[HTTP]
# HTTP Server configuration
enabled = true
port = 8000

# File containing sha256(base64("user:password"))
# Use webiopi-passwd command to generate it
passwd-file = /etc/webiopi/passwd

# Change login prompt message
prompt = "WebIOPi"

# Use doc-root to change default HTML and resource files location
#doc-root = /home/pi/webiopi/examples/scripts/macros

# Use welcome-file to change the default "Welcome" file
#welcome-file = index.html

#------------------------------------------------------------------------#

[COAP]
# CoAP Server configuration
enabled = true
port = 5683
# Enable CoAP multicast
multicast = true

#------------------------------------------------------------------------#

[DEVICES]
# Device configuration syntax:
# name = device [args...]
#   name   : used in the URL mapping
#   device : device name
#   args   : (optional) see device driver doc
# If enabled, devices configured here are mapped on REST API /device/name
# Devices are also accessible in custom scripts using deviceInstance(name)
# See device driver doc for methods and URI scheme available

# Raspberry native UART on GPIO, uncomment to enable
# Don't forget to remove console on ttyAMA0 in /boot/cmdline.txt
# And also disable getty on ttyAMA0 in /etc/inittab
#serial0 = Serial device:ttyAMA0 baudrate:9600

# USB serial adapters
#usb0 = Serial device:ttyUSB0 baudrate:9600
#usb1 = Serial device:ttyACM0 baudrate:9600

#temp0 = TMP102
#temp1 = TMP102 slave:0x49
#temp2 = DS18B20
#temp3 = DS18B20 slave:28-0000049bc218

#bmp = BMP085

#gpio0 = PCF8574
#gpio1 = PCF8574 slave:0x21

#light0 = TSL2561T
#light1 = TSL2561T slave:0b0101001

#gpio0 = MCP23017
#gpio1 = MCP23017 slave:0x21
#gpio2 = MCP23017 slave:0x22

#pwm0 = PCA9685
#pwm1 = PCA9685 slave:0x41

#adc0 = MCP3008
#adc1 = MCP3008 chip:1 vref:5
#dac1 = MCP4922 chip:1

#------------------------------------------------------------------------#

[REST]
# By default, REST API allows to GET/POST on all GPIOs
# Use gpio-export to limit GPIO available through REST API  
#gpio-export = 21, 23, 24, 25

# Uncomment to forbid changing GPIO values 
#gpio-post-value = false

# Uncomment to forbid changing GPIO functions 
#gpio-post-function = false 

# Uncomment to disable automatic device mapping
#device-mapping = false

#------------------------------------------------------------------------#

[ROUTES]
# Custom REST API route syntax :
# source = destination
#   source      : URL to route
#   destination : Resulting URL
# Adding routes allows to simplify access with Human comprehensive URLs

# In the next example with have the bedroom light connected to GPIO 25
# and a temperature sensor named temp2, defined in [DEVICES] section
#  - GET  /bedroom/light       => GET  /GPIO/25/value, returns the light state
#  - POST /bedroom/light/0     => POST /GPIO/25/value/0, turn off the light
#  - POST /bedroom/light/1     => POST /GPIO/25/value/1, turn on the light
#  - GET  /bedroom/temperature => GET  /devices/temp2/temperature/c, returns the temperature in celsius
#/bedroom/light = /GPIO/25/value
#/bedroom/temperature = /devices/temp2/temperature/c

#/livingroom/light = /devices/expander0/0
#/livingroom/brightness = /devices/adc/0/float
#/livingroom/temperature = /devices/temp0/temperature/c

#/weather/temperature = /devices/bmp/temperature/c
#/weather/pressure = /devices/bmp/pressure/hpa

相关文章

  • 树莓派 WebIOPi

    WebIOPi官网 http://webiopi.trouch.com/ 安装 wget http://sourc...

  • 使用webiopi远程控制树莓派

    一、局域网访问webiopi配置 1、必须安装python开发版,即python-dev,不然后面很多软件都会安装...

  • 树莓派针脚图

    树莓派40Pin引脚对照表 本表格适用于树莓派B+、树莓派2B、树莓派A+,并且兼容树莓派B,树莓派B为26Pin...

  • 树莓派上手资料

    树莓派开箱上手教程树莓派下载资料使用手机连接树莓派1使用手机连接树莓派2树莓派实验室无显示屏启动树莓派 如何用pu...

  • 树莓派技术网站导航

    树莓派官网 安装 树莓派Mac OS X下安装系统开启ssh登陆 使用教程 树莓派实验室树莓派吧树莓派中文站 项目...

  • 可移动的图像识别小车(树莓派+摄像头)

    熟悉树莓派 树莓派介绍 树莓派安装系统 picamera的API 树莓派连接显示器不亮屏的解决方案 树莓派摄像头的...

  • 树莓派连接WiFi实现无线上网

    问题:我的树莓派怎么上网呢? 解答: 树莓派基金会于2016年2月发布了树莓派3,较前一代树莓派2,树莓派3的处理...

  • 树莓派4没显示器?手机来凑

    一、快速查找树莓派的IP 二、ssh连接树莓派 三、vnc连接树莓派

  • 新手教程:如何 SSH 进入树莓派

    在这篇树莓派文章中,你将学到如何在树莓派中启用 SSH 以及之后如何通过 SSH 进入树莓派。 在你可以用树莓派做...

  • 树莓派串口配置及minicom的安装

    1.树莓派串口配置:树莓派串口默认用于终端调试,如需使用串口,则需要修改树莓派设置。执行如下命令进入树莓派配置:s...

网友评论

      本文标题:树莓派 WebIOPi

      本文链接:https://www.haomeiwen.com/subject/yatpxktx.html