webiopi配置文件说明(2)


# Uncomment to disable automatic device mapping
#device-mapping = false
【作用】
默认的情况下,通过REST API可以控制所有的GPIO端口。这些危险操作会和loop中的功能冲突,为了防止该情况可通过配置限制REST的功能,例如设置GPIO的方法和输出电平。


8.URL重路由
# 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


【作用】
使得REST API看起来更尤优美一些,暂时未详细测试。

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:http://www.heiqu.com/18410.html